1) Create the new ACFS diskgroup:
[grid@asmlnx2 ~]$ sqlplus "/as sysasm"
SQL*Plus: Release 11.2.0.3.0 Production on Fri Apr 6 17:38:38 2012
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Automatic Storage Management option
SQL> CREATE DISKGROUP ACFSDG EXTERNAL REDUNDANCY DISK
'ORCL:ASMDISKNEW10' SIZE 14653 M
ATTRIBUTE 'compatible.rdbms' = '11.2', 'compatible.asm' = '11.2', 'compatible.advm' = '11.2'; 2 3
Diskgroup created.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Automatic Storage Management option
[grid@asmlnx2 ~]$
2) Create the ADVM volume in the new diskgroup:
[grid@asmlnx2 ~]$ sqlplus "/as sysasm"
SQL*Plus: Release 11.2.0.3.0 Production on Fri Apr 6 17:41:09 2012
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Automatic Storage Management option
SQL> ALTER DISKGROUP ACFSDG ADD VOLUME EBERNALVOL SIZE 14G;
Diskgroup altered.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Automatic Storage Management option
3) Create the mount point as root OS user:
[root@asmlnx2 ~]# mkdir /u03acfs
[root@asmlnx2 ~]# chown grid:oinstall /u03acfs
[root@asmlnx2 ~]# ls -ld /u03acfs
drwxr-xr-x 2 grid oinstall 4096 Apr 6 17:45 /u03acfs
4) As grid user create the ACFS filesystem:
[grid@asmlnx2 ~]$ id
uid=1100(grid) gid=501(oinstall) groups=500(dba),501(oinstall),1100(asmadmin),1300(asmdba),1301(asmoper)
[grid@asmlnx2 ~]$ /sbin/mkfs -t acfs -b 4k /dev/asm/ebernalvol-168
mkfs.acfs: version = 11.2.0.3.0
mkfs.acfs: on-disk version = 39.0
mkfs.acfs: volume = /dev/asm/ebernalvol-168
mkfs.acfs: volume size = 15032385536
mkfs.acfs: Format complete.
[grid@asmlnx2 ~]$
5) As grid user register the ACFS filesystem & ADVM volume:
[grid@asmlnx2 ~]$ /sbin/acfsutil registry -f -a /dev/asm/ebernalvol-168 /u03acfs
acfsutil registry: ACFS-05062: cannot query CRS resource
[grid@asmlnx2 ~]$
SQL> /* ASMCMD */alter diskgroup oggacfs drop volume 'oggvol1'
2013-05-16 14:29:28.669000 +08:00
SUCCESS: /* ASMCMD */alter diskgroup oggacfs drop volume 'oggvol1'
SQL> alter diskgroup oggacfs resize volume oggvol1 size 90G
ORA-15032: not all alterations performed
ORA-15476: ACFS volumes must be resized with the 'acfsutil size' operating system command.
ERROR: alter diskgroup oggacfs resize volume oggvol1 size 90G
-- 可以增减文件系统大小
$ acfsutil size -10G /ogg,多个节点都会变化。
acfsutil size: new file system size: 95563022336 (91136MB)
$ hostname
zehdb2
$ df -g
Filesystem GB blocks Free %Used Iused %Iused Mounted on
/dev/hd4 2.00 1.62 20% 11728 3% /
/dev/hd2 4.00 1.28 69% 56972 16% /usr
/dev/hd9var 4.00 3.39 16% 8604 2% /var
/dev/hd3 8.00 6.42 20% 13653 1% /tmp
/dev/hd1 2.00 2.00 1% 51 1% /home
/dev/hd11admin 0.25 0.25 1% 5 1% /admin
/proc - - - - - /proc
/dev/hd10opt 4.00 3.32 17% 12042 2% /opt
/dev/livedump 0.25 0.25 1% 4 1% /var/adm/ras/livedump
/dev/fslv00 30.00 23.34 23% 1791 1% /ftp
/dev/fslv01 30.00 8.78 71% 155524 7% /u01
/dev/asm/oggvol1-31 89.00 88.74 1% 542984 1% /ogg
$
# hostname
zehdb1
# df -g
Filesystem GB blocks Free %Used Iused %Iused Mounted on
/dev/hd4 2.00 1.60 21% 11729 4% /
/dev/hd2 4.00 1.28 69% 56976 16% /usr
/dev/hd9var 4.00 3.40 16% 8651 2% /var
/dev/hd3 8.00 6.85 15% 11478 1% /tmp
/dev/hd1 2.00 2.00 1% 66 1% /home
/dev/hd11admin 0.25 0.25 1% 5 1% /admin
/proc - - - - - /proc
/dev/hd10opt 4.00 3.32 17% 12042 2% /opt
/dev/livedump 0.25 0.25 1% 4 1% /var/adm/ras/livedump
/dev/fslv00 10.00 3.38 67% 6238 1% /ftp
/dev/fslv01 30.00 7.16 77% 265813 12% /u01
/dev/asm/oggvol1-31 89.00 88.74 1% 542984 1% /ogg
#
execute with root user
$ /sbin/helpers/acfs/mount /dev/asm/oggvol1-31 /ogg
$ /sbin/helpers/acfs/mount -o all
一:查看acfs相关的服务是否正常
[grid@rac1 ~]$ crs_stat -t -v ora.registry.acfs
Name Type R/RA F/FT Target State Host
----------------------------------------------------------------------
ora....ry.acfs ora....fs.type 0/5 0/ ONLINE ONLINE rac1
[grid@rac1 ~]$ crs_stat -t -v ora.ACFS.dg
Name Type R/RA F/FT Target State Host
----------------------------------------------------------------------
ora.ACFS.dg ora....up.type 0/5 0/ ONLINE ONLINE rac1
二:使用asmca图形化工具,在asm磁盘组中创建volume并格式化成ACFS文件系统
[root@rac1 ~]# su - grid
[grid@rac1 ~]$ !exp
export DISPLAY=192.168.1.105:0
[grid@rac1 ~]$ asmca
三:查看两个节点是否均已成功挂载ACFS,并测试读写
[grid@rac1 ~]$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda3 26G 14G 11G 58% /
/dev/vda1 99M 12M 83M 13% /boot
tmpfs 1.2G 787M 441M 65% /dev/shm
/dev/asm/vol1-330 5.0G 75M 5.0G 2% /u01/app/grid/acfsmounts/acfs_vol1
[grid@rac1 ~]$ ssh rac2 "df -h"
Filesystem Size Used Avail Use% Mounted on
/dev/vda3 26G 14G 10G 59% /
/dev/vda1 99M 12M 83M 13% /boot
tmpfs 1.2G 787M 441M 65% /dev/shm
/dev/asm/vol1-330 5.0G 75M 5.0G 2% /u01/app/grid/acfsmounts/acfs_vol1
[grid@rac1 ~]$ cd /u01/app/grid/acfsmounts/acfs_vol1
[grid@rac1 acfs_vol1]$ ls
lost+found
drwx------ 2 root root 65536 Jul 9 09:24 lost+found
[grid@rac1 acfs_vol1]$ cp /etc/passwd ./
[grid@rac2 ~]$ cd /u01/app/grid/acfsmounts/acfs_vol1
[grid@rac2 acfs_vol1]$ ls
lost+found passwd
[grid@rac2 acfs_vol1]$ head -1 passwd
root:x:0:0:root:/root:/bin/bash
四:在asmcmd命令行下面操作
[grid@rac1 ~]$ echo $ORACLE_SID
+ASM1
[grid@rac1 ~]$ asmcmd
ASMCMD> ls
ACFS/
CRS/
DATA/
FRA/
ASMCMD> volcreate //查看帮助命令
usage: volcreate -G diskgroup -s size [ --column number ] [ --width stripe_width ] [--redundancy {high|mirror|unprotected} ]
[--primary {hot|cold}] [--secondary {hot|cold}] volume
help: help volcreate
ASMCMD> volcreate -G ACFS -s 5G vol2 //如果空间不足就会报这个错误
ORA-15032: not all alterations performed
ORA-15041: diskgroup "ACFS" space exhausted (DBD ERROR: OCIStmtExecute)
ASMCMD> volcreate -G ACFS -s 4G vol2
ASMCMD> volinfo -G ACFS vol2
Diskgroup Name: ACFS
Volume Name: VOL2
Volume Device: /dev/asm/vol2-330
State: ENABLED
Size (MB): 4096
Resize Unit (MB): 32
Redundancy: UNPROT
Stripe Columns: 4
Stripe Width (K): 128
Usage:
Mountpath:
ASMCMD> volinfo -G ACFS vol1
Diskgroup Name: ACFS
Volume Name: VOL1
Volume Device: /dev/asm/vol1-330
State: ENABLED
Size (MB): 5120
Resize Unit (MB): 32
Redundancy: UNPROT
Stripe Columns: 4
Stripe Width (K): 128
Usage: ACFS
Mountpath: /u01/app/grid/acfsmounts/acfs_vol1
[root@rac1 ~]# mkdir /vol2 (节点2创建相同的挂载点)
[root@rac1 ~]# mkfs.acfs /dev/asm/vol2-330
mkfs.acfs: version = 11.2.0.3.0
mkfs.acfs: on-disk version = 39.0
mkfs.acfs: volume = /dev/asm/vol2-330
mkfs.acfs: volume size = 4294967296
mkfs.acfs: Format complete.
[root@rac1 ~]# mount -t acfs /dev/asm/vol2-330 /vol2/
[root@rac1 ~]# df -h /vol2
Filesystem Size Used Avail Use% Mounted on
/dev/asm/vol2-330 4.0G 45M 4.0G 2% /vol2
[root@rac1 ~]# acfsutil registry -a /dev/asm/vol2-330 /vol2/(注册后,节点2会自动挂载)
acfsutil registry: mount point /vol2 successfully added to Oracle Registry
更多ACFS的使用场景,如使用ACFS快照,删除卷和ACFS的维护等请参考:
http://candon123.blog.51cto.com/704299/469004
http://docs.oracle.com/cd/E16338_01/server.112/e10500/asmfilesystem.htm#CACGJEAJ