1.安装ASMLib相关包,并初始化ASMLIB
安装ASMLib一共需要3个rpm包,分别是kmod-oracleasm,oracleasmlib和oracleasm-support,注意选择合适的版本安装,比如我这里环境:
节点1、节点2用同样的步骤安装这三个rpm软件包,不再赘述。
kmod-oracleasm-2.0.8-13.el6_8.x86_64.rpm
oracleasmlib-2.0.12-1.el6.x86_64.rpm
oracleasm-support-2.1.8-1.el6.x86_64.rpm
/etc/init.d/oracleasm configure
过程如下:
[root@rac1 u02]# ls
kmod-oracleasm-2.0.8-13.el6_8.x86_64.rpm
ocm.rsp
oracleasmlib-2.0.12-1.el6.x86_64.rpm
oracleasm-support-2.1.8-1.el6.x86_64.rpm
[root@rac1 u02]# rpm -ivh oracleasm-support-2.1.8-1.el6.x86_64.rpm
warning: oracleasm-support-2.1.8-1.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing... ########################################### [100%]
1:oracleasm-support ########################################### [100%]
[root@rac1 u02]# rpm -ivh kmod-oracleasm-2.0.8-13.el6_8.x86_64.rpm
warning: kmod-oracleasm-2.0.8-13.el6_8.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 192a7d7d: NOKEY
Preparing... ########################################### [100%]
1:kmod-oracleasm ########################################### [100%]
[root@rac1 u02]#
[root@rac1 u02]# rpm -ivh oracleasmlib-2.0.12-1.el6.x86_64.rpm
warning: oracleasmlib-2.0.12-1.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing... ########################################### [100%]
1:oracleasmlib ########################################### [100%]
[root@rac1 u02]# /etc/init.d/oracleasm configure
Configuring the Oracle ASM library driver.
This will configure the on-boot properties of the Oracle ASM library
driver. The following questions will determine whether the driver is
loaded on boot and what permissions it will have. The current values
will be shown in brackets ('[]'). Hitting <ENTER> without typing an
answer will keep that current value. Ctrl-C will abort.
Default user to own the driver interface []: grid
Default group to own the driver interface []: asmdba
Start Oracle ASM library driver on boot (y/n) [n]: y
Scan for Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: done
Initializing the Oracle ASMLib driver: [ OK ]
Scanning the system for Oracle ASMLib disks: [ OK ]
2.配置ASMLib,创建ASM磁盘与磁盘组
磁盘分区
/dev/sde: 3 36000c2936286649b0db7d385e512151b
/dev/sdf: 3 36000c29a4543434fc08498c23bbbb6bb
fdisk /dev/sde sde1
fdisk /dev/sdf sdf1
ls -l /dev/sd* //查看磁盘
oracleasm querydisk -v -p DATA1(查看ASM磁盘DATA1用了那块磁盘)
oracleasm listdisks(列出已有的ASM磁盘)
less /var/log/oracleasm (创建ASM磁盘的日志)
oracleasm createdisk DATA1 /dev/sdel(创建ASM磁盘)
oracleasm scandisks (扫描出ASM磁盘,节点2)
su - grid
sqlplus / as sysasm
alter diskgroup DATA add disk 'ORCL:DATA1' rebalance power 7;//给实例ORCL的FJMZDBDB01添加磁盘,重平衡程度为7(扩容)
alter diskgroup DATA drop disk 'DATA1' rebalance power 7;(剔除磁盘)
create diskgroup DATA external redundancy disk 'ORCL:DATA1'; 11G的库,可以加上,ATTRIBUTE 'compatible.rdbms' = '11.2', 'compatible.asm' = '11.2';//创建磁盘组,冗余为external
select * from v$asm_operation;//查看rebalance的状态,无结果返回则rebalance结束