实验环境:Oracle 11g R2 RAC (11.2.0.3.5)
Oracle Enterprise Linux 5.6 x86
1、创建 ASM 磁盘组
在两节点挂好磁盘后,在第一节点上对磁盘进行分区
[root@rac1 ~]# fdisk -l
Disk /dev/sde: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sde1 1 261 2096451 83 Linux
在第1节点上创建 ASM 磁盘
[root@rac1 ~]# oracleasm createdisk GOLDENGATE /dev/sde1
[root@rac1 ~]# oracleasm scandisks
[root@rac1 ~]# oracleasm listdisks
DATA
FRA
GOLDENGATE
OCR_VOTE
在第2节点上扫描ASM磁盘
[root@rac2 ~]# oracleasm listdisks
DATA
FRA
GOLDENGATE
OCR_VOTE
在第一节点上切换到 grid 用户下,执行 ASMCA 创建 ASM 磁盘组
要在 ASM diskgroup 上创建 Oracle ADVM volume ,diskgroup 的
COMPATIBLE.ASM
和 COMPATIBLE.ADVM
兼容性必须 设置为 11.2.0.2。
可以在创建磁盘组时选择“Advanced Options”设置diskgroup的该属性,也可以通过 sql 命令创建磁盘组或者修改磁盘组的该属性,
方法如下:
ALTER DISKGROUP goldengate SET ATTRIBUTE 'compatible.asm' = '11.2.0.2';
ALTER DISKGROUP goldengate SET ATTRIBUTE 'compatible.rdbms' = '11.2.0.2';
ALTER DISKGROUP goldengate SET ATTRIBUTE 'compatible.advm' = '11.2.0.2';
2、创建 Oracle
ADVM volume
ADVM volume
切换到grid用户下,进入ASMCMD命令行界面
su - grid
[grid@rac1 ~]$ export ORACLE_SID=+ASM1
[grid@rac1 ~]$ asmcmd
核实刚刚创建的ASM磁盘组的实际大小
ASMCMD> lsdg
State Type Rebal Sector Block AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB Offline_disks Voting_files Name
MOUNTED EXTERN N 512 4096 1048576 5114 3027 0 3027 0 N DATA/
MOUNTED EXTERN N 512 4096 1048576 5114 4613 0 4613 0 N FRA/
MOUNTED EXTERN N 512 4096 1048576 2047 29 0 29 0 N GOLDENGATE/
MOUNTED EXTERN N 512 4096 1048576 2047 1651 0 1651 0 Y OCR_VOTE/
创建 Oracle ADVM 卷
ASMCMD> volcreate -G GOLDENGATE -s 1900m GOLDENGATE
注意这里 -s 选项指定的大小一定不得超过lsdg 显示的实际大小值,否则会报如下错误:
ASMCMD> volcreate -G GOLDENGATE -s 1950m GOLDENGATE
ORA-15032: not all alterations performed
ORA-15041: diskgroup "GOLDENGATE" space exhausted (DBD ERROR: OCIStmtExecute)
确定Oracle ADVM 卷是否创建
ASMCMD> volinfo -G GOLDENGATE GOLDENGATE
Diskgroup Name: GOLDENGATE Volume Name: GOLDENGATE
Volume Device: /dev/asm/goldengate-257
State: ENABLED
Size (MB): 1920
Resize Unit (MB): 32
Redundancy: UNPROT
Stripe Columns: 4
Stripe Width (K): 128
Usage:
Mountpath:
SQL> col volume_device for a30
SQL> col volume_name for a30
SQL> SELECT volume_name, volume_device FROM V$ASM_VOLUME
2 WHERE volume_name ='GOLDENGATE'; VOLUME_NAME VOLUME_DEVICE
------------------------------ ------------------------------
GOLDENGATE /dev/asm/goldengate-257
3、创建Oracle ACFS 文件系统
[root@rac1 ~]# /sbin/mkfs -t acfs /dev/asm/goldengate-257
mkfs.acfs: version = 11.2.0.3.0
mkfs.acfs: on-disk version = 39.0
mkfs.acfs: volume = /dev/asm/goldengate-257
mkfs.acfs: volume size = 2013265920
mkfs.acfs: Format complete.
在节点1和2上分别创建 ACFS 文件系统的挂载点
[root@rac1 ~]# su - oracle
[oracle@rac1 ~]$ mkdir -p /home/oracle/ggs
[root@rac2 ~]# su - oracle
[oracle@rac2 ~]$ mkdir -p /home/oracle/ggs
在集群 mount registery 中注册刚刚创建的 ACFS 文件系统,也可以不注册,直接手动挂载。
注册 ACFS 文件系统的好处是在集群每隔30秒检查 mount registery 时会在每个节点自动挂载该文件系统,同时当集群软件或系统重启后也会自动挂载该文件系统。
[root@rac1 ~]# /sbin/acfsutil registry -a /dev/asm/goldengate-257 /home/oracle/ggs
acfsutil registry: mount point /home/oracle/ggs successfully added to Oracle Registry
手动挂载命令如下:
[root@rac1 ~]# /bin/mount -t acfs /dev/asm/goldengate-257 /home/oracle/ggs
执行注册命令后等待30秒,然后在各节点查看ACFS文件系统是否挂载
[root@rac1 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 30G 20G 7.7G 73% /
/dev/sda3 1003M 39M 914M 5% /tmp
tmpfs 1.3G 454M 814M 36% /dev/shm
/dev/asm/goldengate-257
1.9G 73M 1.9G 4% /home/oracle/ggs
[oracle@rac2 ~]$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 30G 21G 7.3G 74% /
/dev/sda3 1003M 39M 914M 5% /tmp
tmpfs 1.3G 450M 818M 36% /dev/shm
/dev/asm/goldengate-257
1.9G 137M 1.8G 8% /home/oracle/ggs
4、测试文件系统
[root@rac1 ~]# chown -R oracle:oinstall /home/oracle/ggs
第一节点
[oracle@rac1 ~]$ echo "Oracle ACFS File System" > /home/oracle/ggs/acfs.log
[oracle@rac1 ggs]$ more /home/oracle/ggs/acfs.log
Oracle ACFS File System
第二节点
[oracle@rac2 ~]$ more /home/oracle/ggs/acfs.log
Oracle ACFS File System
转载请注明作者出处及原文链接,否则将追究法律责任:
作者:xiangsir
原文链接:http://blog.csdn.net/xiangsir/article/details/10007779
QQ:444367417
MSN:xiangsir@hotmail.com