在11.2中,Oracle利用ASM的功能提供了ACFS文件系统功能。
在9中,RAC环境可以使用Oracle提供的ocfs cluster文件系统。而11.2中,ACFS文件系统是OCFS的替代功能,ACFS同样可以提供CLUSTER共享。
对于Linux系统,Oracle在11.2.0.1提供了这个功能,在11.2.0.2中,Solaris系统支持这个功能。
bash-3.00$ sqlplus / as sysasm
SQL*Plus: Release 11.2.0.2.0 Production on Tue Dec 28 23:09:14 2010
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options
SQL> select instance_name from gv$instance;
INSTANCE_NAME
----------------
+ASM1
+ASM2
首先确认CLUSTER和ASM已经配置成功,然后利用ASM创建VOLUME:
SQL> host asmcmd
ASMCMD> volcreate -G data oravolume
ASMCMD> volcreate -G data -s 20G oravolume
ASMCMD> volinfo -G data oravolume
Diskgroup Name: DATA
Volume Name: ORAVOLUME
Volume Device: /dev/asm/oravolume-39
State: ENABLED
Size (MB): 20480
Resize Unit (MB): 256
Redundancy: UNPROT
Stripe Columns: 4
Stripe Width (K): 128
Usage:
Mountpath:
ASMCMD> exit
SQL> select volume_name, volume_device
2
from v$asm_volume;
VOLUME_NAME VOLUME_DEVICE
------------------------------ --------------------------------------------------
ORAVOLUME /dev/asm/oravolume-39
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit
Production
With the Real Application Clusters and Automatic Storage Management options
下面利用操作系统mkfs来创建文件系统:
bash-3.00$ su -
口令:
Sun Microsystems Inc. SunOS 5.10 Generic January 2005
# mkfs -F acfs /dev/asm/oravolume-39
mkfs: version = 11.2.0.2.0
mkfs: on-disk version = 39.0
mkfs: volume = /dev/asm/roravolume-39
mkfs: volume size = 21474836480
mkfs: Format complete.
# mount -F acfs /dev/asm/oravolume-39 /data/oracle/product/11.2
# chown -R oracle:oinstall /data/oracle/product/11.2
chown: .ACFS: 权限被否定
chown: .fileid: 权限被否定
chown: repl: 权限被否定
chown: staging: 权限被否定
chown: ready: 权限被否定
chown: processed: 权限被否定
chown: logs: 权限被否定
chown: snaps: 权限被否定
chown: lost+found: 权限被否定
至此文件系统已经加载到操作系统中,且给oracle用户授权,下面可以用oracle用户访问:
bash-3.00$ echo "racnode1"
>> /data/oracle/product/11.2/test.log
bash-3.00$ more /data/oracle/product/11.2/test.log
racnode1
如果想要加载的文件系统变成CLUSTER文件系统,还需要在其他节点上运行:
bash-3.00$ sqlplus / as sysasm
SQL*Plus: Release 11.2.0.2.0 Production on Wed Dec 29 00:02:00 2010
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options
SQL> select instance_name from v$instance;
INSTANCE_NAME
----------------
+ASM2
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit
Production
With the Real Application Clusters and Automatic Storage Management options
bash-3.00$ asmcmd
ASMCMD> volenable -G data oravolume
ASMCMD> volinfo -G data oravolume
Diskgroup Name: DATA
Volume Name: ORAVOLUME
Volume Device: /dev/asm/oravolume-39
State: ENABLED
Size (MB): 20480
Resize Unit (MB): 256
Redundancy: UNPROT
Stripe Columns: 4
Stripe Width (K): 128
Usage: ACFS
Mountpath: /data/oracle/product/11.2
ASMCMD> exit
bash-3.00$ su -
口令:
Sun Microsystems Inc. SunOS 5.10 Generic January 2005
# mount -F acfs /dev/asm/oravolume-39 /data/oracle/product/11.2
# chown -R oracle:oinstall /data/oracle/product/11.2
chown: .ACFS: 权限被否定
chown: .fileid: 权限被否定
chown: repl: 权限被否定
chown: staging: 权限被否定
chown: ready: 权限被否定
chown: processed: 权限被否定
chown: logs: 权限被否定
chown: snaps: 权限被否定
chown: lost+found: 权限被否定
# exit
bash-3.00$ more /data/oracle/product/11.2/test.log
racnode1
可以登陆asm实例检查acfs文件系统信息:
bash-3.00$ sqlplus / as sysasm
SQL*Plus: Release 11.2.0.2.0 Production on Wed Dec 29 00:09:41 2010
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options
SQL> set pages 100 lines 120
SQL> col volume_name format a12
SQL> col volume_device format a22
SQL> col mountpath format a25
SQL> select group_number, volume_name, size_mb, volume_device, mountpath
2
from v$asm_volume;
GROUP_NUMBER VOLUME_NAME SIZE_MB VOLUME_DEVICE MOUNTPATH
------------ ------------ ---------- ---------------------- -------------------------
1 ORAVOLUME 20480 /dev/asm/oravolume-39 /data/oracle/product/11.2