linux下Oracle11g RAC搭建(四)
三、配置共享存储
配置ASM管理准备
1)OCRDISK :存储CRS资源配置信息
2)VOTEDISK:仲裁盘,记录节点状态
3)DataDisk:存放datafile、controlfile、redologfile、spfile等
4)RecoveryArea:存放flashbackdatabase log、archivelog、rmanbackup等
安装asm软件包
分别在node1和node2安装
node1下:
[root@node1 ~]# cd /soft
[root@node1 soft]# ls
asm linux_11gR2_database_1of2.zip linux_11gR2_database_2of2.zip linux_11gR2_grid.zip
[root@node1 asm]# cd asm
[root@node1 asm]# ls
oracleasm-2.6.18-194.el5-2.0.5-1.el5.i686.rpm
oracleasmlib-2.0.4-1.el5.i386.rpm
oracleasm-support-2.1.3-1.el5.i386.rpm
注意和内核版本的匹配
说明:
1、查看到asm软件包版本2.6.18-194.el5,系统内核版本2.6.18-194.el5,两者匹配,可以继续安装;
2、i386代表32位。
[root@node1 asm]# uname-a 或uname -r
//检查系统内核版本是否和asm版本相同
Linux node1 2.6.18-194.el5 #1 SMP Tue Mar 16 21:52:43 EDT 2010 i686 i686i386 GNU/Linux
node1下安装软件包
[root@node1 asm]# rpm -ivh *
//安装3个软件包,i-install,v-安装过程,h-显示安装信息,*-全部软件包
[root@node1 asm]# rpm -qa |grep asm //查看安装完成的信息
node2下安装软件包
node2下:
[root@node1 /]# scp/soft/asm/* node2:/home/oracle/
//把asm下的软件包从node1拷贝到node2下面
或[root@node1 soft]# scp -r asm node2:/home/oracle/
[root@node2 ~]#cd/home/oracle
[root@node2 oracle]# ls
oracleasm-2.6.18-194.el5-2.0.5-1.el5.i686.rpm
oracleasmlib-2.0.4-1.el5.i386.rpm
oracleasm-support-2.1.3-1.el5.i386.rpm
[root@node2 asm]# rpm -ivh *
1)在共享阵列上建立分区
在node1分区,完成后在node2查看
OCR+VOTE盘:3个1G
DATABASE 盘:2个5G
RECOVERY盘:2个4G
3个1G的为OCR_VOTE1盘 其中两个为镜像
2个5G的为ASM_DATA1盘 其中一个为镜像
2个4G的为ASM_RCY1盘 其中一个为镜像
[root@node1 ~]# fdisk -l
//查看磁盘信息
Disk /dev/sda: 21.4 GB, 21474836480bytes
255 heads, 63 sectors/track, 2610cylinders
Units = cylinders of 16065 * 512 =8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 2610 20860402+ 8e Linux LVM
Disk /dev/sdc: 22.7 GB, 22769827840bytes
255 heads, 63 sectors/track, 2768cylinders
Units = cylinders of 16065 * 512 =8225280 bytes
Disk /dev/sdc doesn‘t contain avalid partition table
#fdisk/dev/sdc //对sdc分区
OCR+VOTE
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p //先创建第一个主分区
Partition number (1-4): 1
First cylinder (1-2610, default 1): 1
Last cylinder or +size or +sizeM or+sizeK (1-2610, default 2610): +1024M
//表示主分区的大小为1024M,OCR盘分1G
OCR+VOTE
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p //创建第二个主分区
Partition number (1-4): 2
First cylinder (126-2610, default1):
Last cylinder or +size or +sizeM or+sizeK (126-2610, default 2610): +1024M
OCR+VOTE
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p //创建第三个主分区
Partition number (1-4): 3
First cylinder (251-2610, default 251):
Last cylinder or +size or +sizeM or+sizeK (251-2610, default 2610): +1024M
创建扩展分区
Command (m for help): n
Command action
e extended
p primary partition (1-4)
e //在创建一个扩展分区,大小为剩下的全部容量
Partition number (1-4): 4
First cylinder (376-2610, default 376):
Using default value 126
Last cylinder or +size or +sizeM or+sizeK (376-2610, default 2610):
Using default value 2610
databasearea
Command (m for help): n
Command action
l logical (5 or over) //再创建逻辑分区
p primary partition (1-4)
l
First cylinder (376-3916, default 376):
Using default value 376
Last cylinder or +size or +sizeM or+sizeK (376-3916, default 3916): +5G
databasearea
Command (m for help): n
Command action
l logical (5 or over) //再创建逻辑分区
p primary partition (1-4)
l
First cylinder (985-3916, default 985):
Using default value 985
Last cylinder or +size or +sizeM or+sizeK (985-3916, default 3916): +5G
recoveryarea
Command (m for help): n
Command action
l logical (5 or over) //再创建逻辑分区
p primary partition (1-4)
l
First cylinder (1594-3916, default 1594):
Using default value 1594
Last cylinder or +size or +sizeM or+sizeK (1594-3916, default 3916): +4G
recoveryarea
Command (m for help): n
Command action
l logical (5 or over) //再创建逻辑分区
p primary partition (1-4)
l
First cylinder (2081-3916, default 2081):
Using default value 2081
Last cylinder or +size or +sizeM or+sizeK (2081-3916, default 3916): +4G
剩余一些空间,单独分了一个区
Command (m for help): n
Command action
l logical (5 or over) //再创建逻辑分区
p primary partition (1-4)
l
First cylinder (2568-3916, default 2568):
Using default value 2568
Last cylinder or +size or +sizeM or+sizeK (2568-3916, default 3916):
Command (m for help): p //查看分区结果
Command (m for help): w //保存退出
[root@node1 ~]# fdisk -l //分区结果
2)创建asm盘
配置asm 磁盘(node1、node2)
node1上
[root@node1 soft]# serviceoracleasm configure
Configuring the Oracle ASM library driver.
This will configure the on-boot properties of theOracle ASM library
driver. Thefollowing 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 []: asmadmin
Start Oracle ASM library driver on boot (y/n) [n]: y
Scan for Oracle ASM disks on boot (y/n) [y]:
Writing Oracle ASM library driver configuration: done
Initializing the Oracle ASMLib driver: [ OK ]
Scanning the system for Oracle ASMLib disks: [ OK ]
node2上
[root@node2 asm]# serviceoracleasm configure
Configuring the Oracle ASM library driver.
This will configure the on-boot properties of theOracle ASM library
driver. Thefollowing 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 []: asmadmin
Start Oracle ASM library driver on boot (y/n) [n]: y
Scan for Oracle ASM disks on boot (y/n) [y]:
Writing Oracle ASM library driver configuration: done
Initializing the Oracle ASMLib driver: [ OK ]
Scanning the system for Oracle ASMLib disks: [ OK ]
建立asm 磁盘(node1)
在node1上
[root@node1 soft]# serviceoracleasm
Usage: /etc/init.d/oracleasm{start|stop|restart|enable|disable|configure|createdisk|deletedisk|querydisk|listdisks|scandisks|status}
[root@node1 soft]# serviceoracleasm createdisk OCR_VOTE1 /dev/sdc1
//磁盘名用大写
Marking disk "OCR_VOTE1" as an ASM disk:[ OK ]
[root@node1 soft]# serviceoracleasm createdisk OCR_VOTE2 /dev/sdc2
Marking disk "OCR_VOTE2" as an ASM disk:[ OK ]
[root@node1 soft]# serviceoracleasm createdisk OCR_VOTE3 /dev/sdc3
Marking disk "OCR_VOTE3" as an ASM disk:[ OK ]
[root@node1 soft]# serviceoracleasm createdisk ASM_DATA1 /dev/sdc5
Marking disk "ASM_DATA1" as an ASM disk:[ OK ]
[root@node1 soft]# serviceoracleasm createdisk ASM_DATA2 /dev/sdc6
Marking disk "ASM_DATA2" as an ASM disk:[ OK ]
[root@node1 soft]# serviceoracleasm createdisk ASM_RCY1 /dev/sdc7
Marking disk "ASM_RCY1" as an ASM disk:[ OK ]
[root@node1 soft]# serviceoracleasm createdisk ASM_RCY2 /dev/sdc8
Marking disk "ASM_RCY2" as an ASM disk:[ OK ]
[root@node1 soft]# serviceoracleasm listdisks //查看asm创建结果
ASM_DATA1
ASM_DATA2
ASM_RCY1
ASM_RCY2
OCR_VOTE1
OCR_VOTE2
OCR_VOTE3
验证ASM磁盘信息(node2)
在node2节点扫描出磁盘,查看共享磁盘信息
[root@node2 asm]# serviceoracleasm scandisks //扫描共享磁盘asm
Scanning the system for Oracle ASMLib disks: [ OK ]
[root@node2 asm]# serviceoracleasm listdisks //查看共享盘信息
ASM_DATA1
ASM_DATA2
ASM_RCY1
ASM_RCY2
OCR_VOTE1
OCR_VOTE2
OCR_VOTE3