这篇文章给大家分享的是有关oracle12c RAC如何创建ADVM和ACFS的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。
ACFS是oracle database 11gR2的一个新特性。关于ACFS的更多信息请参考官方文档。这篇文章是基于12C RAC环境写的,不知道在非RAC环境中,还能不能使用ACFS呢,有兴趣的朋友可以测试下。以下内容是如何使用asmca、命令行以及sql语句去创建ADVM,进而创建ACFS。其中在操作系统中会用到mount、umount、acfsutil、mkfs.acfs、srvctl等几个命令。其中的acfsutil是不属于任何一个rpm软件包的,只有你安装了grid组件之后才会出现。ADVM主要是为了使除了数据库之外的第三方应用程序也可以使用asm存储,这样不限于使asm局限于自家的数据库领域。要想使用ADVM首先必须安装grid,已经创建好了asm磁盘,asm磁盘组。一个advm卷可以占用一个磁盘组的所有空间,也可以占用部分空间,一个advm卷的空间只能来自于一个asm磁盘组,但是一个asm磁盘组可以创建多个advm卷。每次创建的advm卷都会在/dev/asm/目录下产生一个文件,用于创建文件系统。
1、使用asmca命令进行图形化工具创建(1)在创建ADVM之间,首选in需要创建ASM磁盘组,下图是创建好的磁盘组,ACFS磁盘组用于接下来的实验使用(2)点击Volumes->create,输入卷名称和卷大小以及选择ASM磁盘组(3)ADVM创建成功,发现state是未启用的状态(4)在卷wjqvol1上创建ACFS文件系统,并选择自动挂载,输入挂载点(5)【可忽略】点击show command,查看创建ACFS的相关命令,便于后续可以手动的去创建ACFS(6)点击ok后,提示执行下面的脚本(7)切换到root用户,执行该脚本,然后点击close(8)查看ACFS文件系统在RAC的两个节点都挂载成功[grid@c01n01 ~]$ df -Th Filesystem Type
Size Used Avail Use% Mounted on/dev/xvda2 ext3
9.7G 2.8G 6.4G
31% /tmpfs
tmpfs 4.0G 1.3G
2.8G 31% /dev/shm/dev/xvda1 ext3
243M 83M
147M 37% /boot/dev/xvdc1 ext3
2.0G 38M 1.9G
2% /home/dev/xvdd1 ext3
20G 12G 7.1G
62% /u01/dev/asm/wjqvol1-245 acfs 2.0G
145M 1.9G 8% /wjqacfs [grid@c01n01 ~]$[grid@c01n01 ~]$ ssh c01n02 “df -Th” Filesystem Type
Size Used Avail Use% Mounted on/dev/xvda2 ext3
9.7G 3.8G 5.5G
41% /tmpfs
tmpfs 4.0G 1.3G
2.8G 31% /dev/shm/dev/xvda1 ext3
243M 83M 147M
37% /boot/dev/xvdc1 ext3
2.0G 37M 1.9G
2% /home/dev/xvdd1 ext3
20G 12G 7.2G
61% /u01/dev/asm/wjqvol1-245 acfs 2.0G
145M 1.9G 8% /wjqacfs (9)查看ACFS相关的信息(10)查看crs资源可以发现刚才创建好的ADVM以及ACFS(11)进入挂载点,进行读写测试2、使用命令创建ADVM(1)在grid用户下执行asmcmd命令,创建ADVM[grid@c01n01 ~]$ asmcmd -p ASMCMD [+] > volinfo -G acfs wjqvol1 #该命令查看已存在卷的信息 Diskgroup Name: ACFS
Volume Name: WJQVOL1
Volume Device: /dev/asm/wjqvol1-245
State: ENABLED
Size (MB): 2048
Resize Unit (MB): 32
Redundancy: UNPROT
Stripe Columns: 4
Stripe Width (K): 128
Usage: ACFS
Mountpath: /wjqacfs(2)通过volcreate命令创建ADVM,并通过volinfo查看卷的信息[grid@c01n01 ~]$ asmcmd -p ASMCMD [+] > volcreate -G acfs -s 1G wjqvol2 ASMCMD [+] > volinfo -G acfs wjqvol2 Diskgroup Name: ACFS
Volume Name: WJQVOL2
Volume Device: /dev/asm/wjqvol2-245
State: ENABLED
Size (MB): 1024
Resize Unit (MB): 32
Redundancy: UNPROT
Stripe Columns: 4
Stripe Width (K): 128
Usage:
Mountpath:(3)可以通过volresize调整ADVM卷的大小ASMCMD [+] > volresize -G acfs -s 1.5G wjqvol2 ASMCMD [+] > volinfo -G acfs wjqvol2 Diskgroup Name: ACFS
Volume Name: WJQVOL2
Volume Device: /dev/asm/wjqvol2-245
State: ENABLED
Size (MB): 1536
Resize Unit (MB): 32
Redundancy: UNPROT
Stripe Columns: 4
Stripe Width (K): 128
Usage:
Mountpath:注意:调小的时候会出现下面的提示信息 ASMCMD [+] > volresize -G acfs -s 1G wjqvol2 The
requested size is smaller than the current size. Data
corruption may occur. Are
you sure? [y/n]: y ASMCMD [+] >ASMCMD [+] > volinfo -G acfs wjqvol2 Diskgroup Name: ACFS
Volume Name: WJQVOL2
Volume Device: /dev/asm/wjqvol2-245
State: ENABLED
Size (MB): 1024
Resize Unit (MB): 32
Redundancy: UNPROT
Stripe Columns: 4
Stripe Width (K): 128
Usage:
Mountpath:(4)通过volstat查看卷的使用相关信息ASMCMD [+acfs] > volstat DISKGROUP NUMBER / NAME: 3 / ACFS—————————————
VOLUME_NAME
READS BYTES_READ READ_TIME READ_ERRS
WRITES BYTES_WRITTEN WRITE_TIME WRITE_ERRS
————————————————————-
WJQVOL1
2685 1510912 47.366 0
1407 5386240 43.44 0
WJQVOL2
0 0 0 0
0 0 0 0
WJQVOL3
0 0 0 0
0 0 0 03、通过SQL命令创建ADVM(1)通过SQLplus进去,执行SQL语句[grid@c01n01 ~]$ sqlplus / as sysdba SQL*Plus: Release 12.1.0.1.0 Production on
Fri May 4 11:46:52 2018Copyright (c) 1982, 2013, Oracle. All rights reserved.Connected to:Oracle Database 12c Enterprise Edition
Release 12.1.0.1.0 – 64bit ProductionWith the Real Application Clusters and
Automatic Storage Management optionsSQL> alter diskgroup acfs add volume wjqvol3 size 1G; alter diskgroup acfs add volume wjqvol3
size 1G*ERROR at line 1:ORA-15032: not all alterations performedORA-15260: permission denied on ASM disk
group注意:sqlplus下创建advm不能使用sysdba权限登录,否则会报权限不足,需要使用sysasm权限 SQL> alter diskgroup acfs add volume wjqvol3 size
1G; Diskgroup altered.(2)使用sysasm权限登录进行创建[grid@c01n01 ~]$ sqlplus / as sysasm SQL*Plus: Release 12.1.0.1.0 Production on
Fri May 4 11:53:08 2018Copyright (c) 1982, 2013, Oracle. All rights reserved.Connected to:Oracle Database 12c Enterprise Edition
Release 12.1.0.1.0 – 64bit ProductionWith the Real Application Clusters and
Automatic Storage Management optionsSQL> alter diskgroup acfs resize volume wjqvol3 size
1.1G; alter diskgroup acfs resize volume wjqvol3
size 1.1G
*ERROR at line 1:ORA-02017: integer value required注意:通过SQL语句调整ADVM大小时,只能整数倍的调整 SQL> alter diskgroup acfs resize volume wjqvol3 size
2G; alter diskgroup acfs resize volume wjqvol3
size 2G*ERROR at line 1:ORA-15032: not all alterations performedORA-15041: diskgroup “ACFS” space
exhausted注意:调整的ADVM大小操作ASM磁盘组的大小会出现如上的报错信息 SQL> alter diskgroup acfs resize volume wjqvol3 size
2G; Diskgroup altered.(4)查看asm文件的相关信息SQL> select group_number,bytes,type from v$asm_file; GROUP_NUMBER BYTES TYPE———— ———-
——————–
1 1536 ASMPARAMETERFILE 1
165974016 OCRFILE
1 7680 PASSWORD
1 62922752 DATAFILE
1 419438592 DATAFILE
1 629153792 DATAFILE
1 2147491840 DATAFILE
1 104865792 DATAFILE
1 9945088 CONTROLFILE
1 52429312 ONLINELOG
1 52429312 ONLINELOG
1 52429312 ONLINELOG
1 20979712 TEMPFILE
1 3584 PARAMETERFILE
1 7680 PASSWORD
1 954212352 DATAFILE
1 838868992 DATAFILE
1 5251072 DATAFILE
1 183508992 DATAFILE
1 18956288 CONTROLFILE
1 52429312 ONLINELOG
1 52429312 ONLINELOG
1 109060096 TEMPFILE
1 376840192 DATAFILE
1 78651392 DATAFILE
1 52429312 ONLINELOG
1 52429312 ONLINELOG
1 3584 PARAMETERFILE
2 18956288 CONTROLFILE
2 52429312 ONLINELOG
2 52429312 ONLINELOG
2 52429312 ONLINELOG
2 52429312 ONLINELOG
3 2147483648 ASMVOL 3 1073741824 ASMVOL 3 2147483648 ASMVOL 36 rows selected.(4)查看ADVM卷的相关信息SQL> select volume_name,size_mb,state,volume_device,mountpath
from v$asm_volume; VOLUME_NAME SIZE_MB STATE VOLUME_DEVICE MOUNTPATH————— ———- ——–
—————————— ———-WJQVOL1 2048 REMOTE /dev/asm/wjqvol1-245 /wjqacfsWJQVOL2 1024 REMOTE /dev/asm/wjqvol2-245WJQVOL3 2048 REMOTE /dev/asm/wjqvol3-245(5)查看ADVM卷的使用相关信息SQL> select
volume_name,reads,writes,read_errs,bytes_read,bytes_written from
v$asm_volume_stat; VOLUME_NAME READS WRITES
READ_ERRS BYTES_READ BYTES_WRITTEN————— ———- ———-
———- ———- ————-WJQVOL1 0 0 0 0 0WJQVOL2 0 0 0 0 0WJQVOL3 0 0 0 0 0(6)查看/dev/asm路径下上面创建的ADVM卷文件[root@c01n01 ~]# ll /dev/asm/ total 0brwxrwx— 1 root asmadmin 252, 125441
May 3 16:01 wjqvol1-245brwxrwx— 1 root asmadmin 252, 125442
May 4 11:45 wjqvol2-245brwxrwx— 1 root asmadmin 252, 125443
May 4 11:53 wjqvol3-245上述已经实验(1)格式化成ext4文件系统[root@c01n01 ~]# mkfs.ext4 /dev/asm/wjqvol2-245 mke2fs 1.41.12 (17-May-2010)Filesystem label=OS type: LinuxBlock size=4096 (log=2)Fragment size=4096 (log=2)Stride=0 blocks, Stripe width=0 blocks65536 inodes, 262144 blocks13107 blocks (5.00%) reserved for the super
userFirst data block=0Maximum filesystem blocks=2684354568 block groups32768 blocks per group, 32768 fragments per
group8192 inodes per groupSuperblock backups stored on blocks:
32768, 98304, 163840, 229376Writing inode tables: doneCreating journal (8192 blocks): doneWriting superblocks and filesystem
accounting information: doneThis filesystem will be automatically
checked every 25 mounts or180 days, whichever comes first. Use tune2fs -c or -i to override.(2)挂载[root@c01n01 ~]# mkdir /wjqext4 [root@c01n01 ~]# mount /dev/asm/wjqvol2-245 /wjqext4 [root@c01n01 ~]# df -TH Filesystem Type
Size Used Avail Use% Mounted on/dev/xvda2 ext3
11G 3.0G 6.9G
31% /tmpfs
tmpfs 4.3G 1.3G
3.0G 31% /dev/shm/dev/xvda1 ext3
254M 87M 154M
37% /boot/dev/xvdc1 ext3
2.2G 39M 2.0G
2% /home/dev/xvdd1 ext3
21G 12G 7.7G
62% /u01192.0.2.1:/stage
nfs 11G
11G 0 100% /stage/dev/asm/wjqvol1-245 acfs 2.2G
152M 2.0G 8% /wjqacfs/dev/asm/wjqvol2-245 ext4 1.1G
35M 969M 4% /wjqext4 注意:ACFS不能用于linux根分区,不能用于grid的安装目录,不支持数据库文件(即asm存储的文件),使用acfs要依赖于advm卷 (1)格式化成acfs文件系统[root@c01n01 ~]# mkfs.acfs /dev/asm/wjqvol3-245 mkfs.acfs: version = 12.1.0.1.0mkfs.acfs: on-disk version = 39.0mkfs.acfs: volume = /dev/asm/wjqvol3-245mkfs.acfs: volume size = 2147483648mkfs.acfs: Format complete.(2)挂载,注意:这里只是临时挂载,只能在RAC的当前节点看到,其他的节点看不到[root@c01n01 ~]# mkdir /wjqacfs.man [root@c01n01 ~]# mount /dev/asm/wjqvol3-245 /wjqacfs.man mount: you must specify the filesystem type [root@c01n01 ~]# mount -t acfs /dev/asm/wjqvol3-245 /wjqacfs.man [root@c01n01 ~]# df -Th Filesystem Type
Size Used Avail Use% Mounted on/dev/xvda2 ext3
9.7G 2.8G 6.4G
31% /tmpfs
tmpfs 4.0G 1.3G
2.8G 31% /dev/shm/dev/xvda1
ext3 243M
83M 147M 37% /boot/dev/xvdc1 ext3
2.0G 38M 1.9G
2% /home/dev/xvdd1 ext3
20G 12G 7.1G
62% /u01/dev/asm/wjqvol1-245 acfs 2.0G
145M 1.9G 8% /wjqacfs/dev/asm/wjqvol2-245 ext4 1008M
34M 924M 4% /wjqext4/dev/asm/wjqvol3-245 acfs 2.0G
43M 2.0G 3% /wjqacfs.man (3)通过SQL查看挂载情况SQL> select
volume_name,size_mb,state,volume_device,mountpath from v$asm_volume; VOLUME_NAME SIZE_MB STATE VOLUME_DEVICE MOUNTPATH————— ———- ——–
——————– —————WJQVOL1 2048 REMOTE /dev/asm/wjqvol1-245 /wjqacfs WJQVOL2 1024 REMOTE /dev/asm/wjqvol2-245WJQVOL3 2048 REMOTE /dev/asm/wjqvol3-245 /wjqacfs.man (4)查看crs资源可以发现,可以看到创建ADVM卷,但是wjqvol3卷上创建的ACFS文件系统却看不到(5)通过asmca可以发现,在wjqvol3上创建的ACFS的state处于UNKNOWN[未挂载状态](6)下面通过命令进行永久的挂载永久挂载:[grid@c01n01 ~]$ srvctl add files免费主机域名ystem -d /dev/asm/wjqvol3-245
-m /wjqacfs.man -u grid -fstype ACFS -autostart ALWAYS PRCN-2018
: Current user grid is not a privileged user 注意:这里在grid下执行上述命令提示没有权限,只能在root用户下执行 [root@c01n01 ~]# /u01/app/12.1.0/grid/bin/srvctl add filesystem
-d /dev/asm/wjqvol3-245 -m /wjqacfs.man -u grid -fstype ACFS -autostart ALWAYS 启动该文件系统,然后查看是否自动挂载[root@c01n01 ~]# /u01/app/12.1.0/grid/bin/srvctl start
filesystem -d /dev/asm/wjqvol3-245 [root@c01n01 ~]# df -Th Filesystem Type
Size Used Avail Use% Mounted on/dev/xvda2 ext3
9.7G 2.8G 6.4G
31% /tmpfs
tmpfs 4.0G 1.3G
2.8G 31% /dev/shm/dev/xvda1 ext3
243M 83M 147M
37% /boot/dev/xvdc1 ext3
2.0G 38M 1.9G
2% /home/dev/xvdd1 ext3
20G 12G 7.1G
62% /u01192.0.2.1:/stage nfs 9.9G
9.7G 0 100% /stage/dev/asm/wjqvol1-245 acfs 2.0G
145M 1.9G 8% /wjqacfs/dev/a免费主机域名sm/wjqvol2-245 ext4 1008M
34M 924M 4% /wjqext4/dev/asm/wjqvol3-245 acfs 2.0G
43M 2.0G 3% /wjqacfs.man 查看crs资源发现,存在该文件系统,并且可以看到挂载的路径再次通过asmca查看,发现在wjqvol3上创建的ACFS的state是mount状态[grid@c01n01 ~]$ acfsutil version acfsutil version: 12.1.0.1.0[grid@c01n01 ~]$ acfsutil info fs /wjqacfs
ACFS Version: 12.1.0.1.0
flags: MountPoint,Available
mount time: Thu May 3 16:01:14 2018
volumes: 1
total size: 2147483648
total free: 1996140544
primary volume: /dev/asm/wjqvol1-245
label:
flags:
Primary,Available,ADVM
on-disk version: 39.0
allocation unit: 4096
major, minor: 252, 125441
size: 2147483648
free: 1996140544
ADVM diskgroup ACFS
ADVM resize increment: 33554432
ADVM redundancy: unprotected
ADVM stripe columns: 4
ADVM stripe width: 131072
number of snapshots: 0
snapshot space usage: 0
replication status: DISABLED/wjqacfs.man
ACFS Version: 12.1.0.1.0
flags: MountPoint,Available
mount time: Fri May 4 12:19:50 2018
volumes: 1
total size: 2147483648
total free: 2103123968
primary volume: /dev/asm/wjqvol3-245
label:
flags:
Primary,Available,ADVM
on-disk version: 39.0
allocation unit: 4096
major, minor: 252, 125443
size: 2147483648
free: 2103123968
ADVM diskgroup ACFS
ADVM resize increment: 33554432
ADVM redundancy: unprotected
ADVM stripe columns: 4 ADVM stripe width: 131072
number of snapshots: 0
snapshot space usage: 0
replication status: DISABLED(1)创建ACFS的快照[grid@c01n01 ~]$ acfsutil snap create wjqvol1 /wjqacfs acfsutil snap create: Snapshot operation is
complete.(2)快照创建成功后,在ACFS的挂载路径下会自动生成一个.ACFS的目录,该目录下的snaps可以查看快照[grid@c01n01 wjqvol1]$ pwd /wjqacfs/.ACFS/snaps/wjqvol1 [grid@c01n01 wjqvol1]$ ll total 4d????????? ? ? ?
? ? lost+found-rw-r–r– 1 grid oinstall 18 May 3 16:11 test.txt(3)更新之前创建快照前的文件test.txt[root@c01n01 wjqacfs]# echo “This is snapshot” >>
test.txt [root@c01n01 wjqacfs]# cat test.txt This is acfs testThis is snapshot(4)查看快照文件和现在文件的差异[root@c01n01 wjqacfs]# cat .ACFS/snaps/wjqvol1/test.txt This is acfs test(5)删除快照[root@c01n01 ~]# acfsutil snap delete wjqvol1 /wjqacfs acfsutil snap delete: Snapshot operation is
complete.[root@c01n01 ~]# acfsutil registry -d /wjqacfs.man acfsutil
registry: ACFS-03135: unable to locate mount point /wjqacfs.man in Oracle
Registry acfsutil
registry: ACFS-03112: unable to remove mount point /wjqacfs.man from Oracle
Registry 注意:如果出现如上的报错,说明在crs中没有该ACFS的资源,并没有注册到crs中,需要你按照永久挂载的方式进行注册后即可进行 [root@c01n01 ~]# acfsutil registry -d /wjqacfs.man acfsutil
registry: successfully removed ACFS mount point /wjqacfs.man from Oracle
Registry 3、查看挂载情况以及crs资源是否存在该ACFS信息[root@c01n01 ~]# df -Th Filesystem Type
Size Used Avail Use% Mounted on/dev/xvda2 ext3
9.7G 2.8G 6.4G
31% /tmpfs
tmpfs 4.0G 1.3G
2.8G 31% /dev/shm/dev/xvda1 ext3
243M 83M 147M
37% /boot/dev/xvdc1 ext3
2.0G 38M 1.9G
2% /home/dev/xvdd1 ext3
20G 12G 7.1G
62% /u01192.0.2.1:/stage nfs 9.9G
9.7G 0 100% /stage/dev/asm/wjqvol1-245 acfs 2.0G
145M 1.9G 8% /wjqacfs/dev/asm/wjqvol2-245 ext4 1008M
34M 924M 4% /wjqext4[root@c01n01 ~]# ll /dev/asm/ total 0brwxrwx— 1 root asmadmin 252, 125441
May 3 16:01 wjqvol1-245brwxrwx— 1 root asmadmin 252, 125442
May 4 12:15 wjqvol2-245brwxrwx—
1 root asmadmin 252, 125443 May 4 13:41
wjqvol3-245 [grid@c01n01 ~]$ asmcmd -p ASMCMD [+] > voldisable -G acfs wjqvol3#首先disbaleADVM卷,然后在删除 ASMCMD [+] > volinfo -G acfs wjqvol3 Diskgroup Name: ACFS
Volume Name: WJQVOL3
Volume Device: /dev/asm/wjqvol3-245 State: DISABLED
Size (MB): 2048
Resize Unit (MB): 32
Redundancy: UNPROT
Stripe Columns: 4
Stripe Width (K): 128
Usage:
Mountpath:ASMCMD [+] > voldelete -G acfs wjqvol3 #删除ADVM卷 确认卷已经完全的删除ASMCMD [+] > volstat DISKGROUP NUMBER / NAME: 3 / ACFS—————————————
VOLUME_NAME
READS BYTES_READ READ_TIME READ_ERRS
WRITES BYTES_WRITTEN WRITE_TIME WRITE_ERRS
————————————————————-
WJQVOL1
3049 5919744 53.171 0
1551 5567488 46.828 0
WJQVOL2
93 377856 .254 0
12397 50778112 4330.134 0[root@c01n01 ~]# ll /dev/asm/ total 0brwxrwx— 1 root asmadmin 252, 125441
May 3 16:01 wjqvol1-245brwxrwx— 1 root asmadmin 252, 125442
May 4 12:15 wjqvol2-245感谢各位的阅读!关于“oracle12c RAC如何创建ADVM和ACFS”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,让大家可以学到更多知识,如果觉得文章不错,可以把它分享出去让更多的人看到吧!
这篇文章主要介绍“数据库CLOB为空的判断方法是什么”,在日常操作中,相信很多人在数据库CLOB为空的判断方法是什么问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”数据库CLOB为空的判断方法是什么”的疑惑有所帮助!接下来,请跟着…