Linux下搭建Oracle11g RAC(5)----配置ASM磁盘
将共享磁盘格式化、然后用asmlib将其配置为ASM磁盘,用于将来存放OCR、Voting Disk和数据库用。
注意:只需在其中1个节点上格式化就可以,接下来我们选择在node1节点上格式化。
这里我们以asmlib软件来创建ASM磁盘,而不使用raw disk,而且从11gR2开始,OUI的图形界面已经不再支持raw disk。
格式化共享磁盘
① 以root用户分别在两个节点上执行fdisk命令,查看现有硬盘分区信息:
node1:
[root@node1 ~]# fdisk -l
Disk /dev/sda: 21.4 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System /dev/sda1 * 1 2163 17374266 83 Linux /dev/sda2 2164 2609 3582495 82 Linux swap / Solaris
Disk /dev/sdb: 524 MB, 524288000 bytes 64 heads, 32 sectors/track, 500 cylinders Units = cylinders of 2048 * 512 = 1048576 bytes
Disk /dev/sdb doesn‘t contain a valid partition table
Disk /dev/sdc: 524 MB, 524288000 bytes 64 heads, 32 sectors/track, 500 cylinders Units = cylinders of 2048 * 512 = 1048576 bytes
Disk /dev/sdc doesn‘t contain a valid partition table
Disk /dev/sdd: 3221 MB, 3221225472 bytes 255 heads, 63 sectors/track, 391 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdd doesn‘t contain a valid partition table
Disk /dev/sde: 3221 MB, 3221225472 bytes 255 heads, 63 sectors/track, 391 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sde doesn‘t contain a valid partition table [root@node1 ~]# |
node2:
[root@node2 ~]# fdisk -l
Disk /dev/sda: 21.4 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System /dev/sda1 * 1 2163 17374266 83 Linux /dev/sda2 2164 2609 3582495 82 Linux swap / Solaris
Disk /dev/sdb: 524 MB, 524288000 bytes 64 heads, 32 sectors/track, 500 cylinders Units = cylinders of 2048 * 512 = 1048576 bytes
Disk /dev/sdb doesn‘t contain a valid partition table
Disk /dev/sdc: 524 MB, 524288000 bytes 64 heads, 32 sectors/track, 500 cylinders Units = cylinders of 2048 * 512 = 1048576 bytes
Disk /dev/sdc doesn‘t contain a valid partition table
Disk /dev/sdd: 3221 MB, 3221225472 bytes 255 heads, 63 sectors/track, 391 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdd doesn‘t contain a valid partition table
Disk /dev/sde: 3221 MB, 3221225472 bytes 255 heads, 63 sectors/track, 391 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sde doesn‘t contain a valid partition table [root@node2 ~]# |
从上,我们可以看到目前两个节点上的分区信息一致:其中/dev/sda是用于存放操作系统的,/dev/sdb、/dev/sdc、/dev/sdd、/dev/sde这4块盘都没有分区信息
② root用户在node1上格式化/dev/sdb、/dev/sdc、/dev/sdd、/dev/sde这4块盘
[root@node1 ~]# fdisk /dev/sdb Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel Building a new DOS disklabel. Changes will remain in memory only, until you decide to write them. After that, of course, the previous content won‘t be recoverable.
Warning: invalid flag 0×0000 of partition table 4 will be corrected by w(rite)
Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-500, default 1): Using default value 1 Last cylinder or +size or +sizeM or +sizeK (1-500, default 500): Using default value 500
Command (m for help): w The partition table has been altered!
Calling ioctl() to re-read partition table. Syncing disks. [root@node1 ~]# |
说明:fdisk /dev/sdb表示要对/dev/sdb磁盘进行格式化,其中,输入的命令分别表示:
n表示新建1个分区;
p表示分区类型选择为primary partition 主分区;
1表示分区编号从1开始;
起始、终止柱面选择默认值,即1和500;
w表示将新建的分区信息写入硬盘分区表。
③ 重复上述步骤②,以root用户在node1上分别格式化其余3块磁盘:
④ 格式化完毕之后,在node1,node2节点上分别看到下述信息:
node1:
[root@node1 ~]# fdisk -l
Disk /dev/sda: 21.4 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System /dev/sda1 * 1 2163 17374266 83 Linux /dev/sda2 2164 2609 3582495 82 Linux swap / Solaris
Disk /dev/sdb: 524 MB, 524288000 bytes 64 heads, 32 sectors/track, 500 cylinders Units = cylinders of 2048 * 512 = 1048576 bytes
Device Boot Start End Blocks Id System /dev/sdb1 1 500 511984 83 Linux
Disk /dev/sdc: 524 MB, 524288000 bytes 64 heads, 32 sectors/track, 500 cylinders Units = cylinders of 2048 * 512 = 1048576 bytes
Device Boot Start End Blocks Id System /dev/sdc1 1 500 511984 83 Linux
Disk /dev/sdd: 3221 MB, 3221225472 bytes 255 heads, 63 sectors/track, 391 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System /dev/sdd1 1 391 3140676 83 Linux
Disk /dev/sde: 3221 MB, 3221225472 bytes 255 heads, 63 sectors/track, 391 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System /dev/sde1 1 391 3140676 83 Linux [root@node1 ~]# |
node2:
[root@node2 ~]# fdisk -l
Disk /dev/sda: 21.4 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System /dev/sda1 * 1 2163 17374266 83 Linux /dev/sda2 2164 2609 3582495 82 Linux swap / Solaris
Disk /dev/sdb: 524 MB, 524288000 bytes 64 heads, 32 sectors/track, 500 cylinders Units = cylinders of 2048 * 512 = 1048576 bytes
Device Boot Start End Blocks Id System /dev/sdb1 1 500 511984 83 Linux
Disk /dev/sdc: 524 MB, 524288000 bytes 64 heads, 32 sectors/track, 500 cylinders Units = cylinders of 2048 * 512 = 1048576 bytes
Device Boot Start End Blocks Id System /dev/sdc1 1 500 511984 83 Linux
Disk /dev/sdd: 3221 MB, 3221225472 bytes 255 heads, 63 sectors/track, 391 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System /dev/sdd1 1 391 3140676 83 Linux
Disk /dev/sde: 3221 MB, 3221225472 bytes 255 heads, 63 sectors/track, 391 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System /dev/sde1 1 391 3140676 83 Linux # |
至此,格式化共享磁盘完毕。
在两个节点上安装ASM RPM软件包
在安装ASM软件包时,要注意选择的软件包要与操作系统平台、内核版本选择一致。ASM软件包可以到Oracle官网下载。
node1安装:
[root@node1 ~]# rpm -qa|grep asm 用上述命令,并未发现节点1上安装任何asm软件包。 [root@node1 ~]# cd asm_rpm/ [root@node1 asm_rpm]# ll total 136 -rw-r–r– 1 root root 25977 Apr 26 11:19 oracleasm-2.6.18-194.el5-2.0.5-1.el5.x86_64.rpm -rw-r–r– 1 root root 14176 Apr 26 11:19 oracleasmlib-2.0.4-1.el5.x86_64.rpm -rw-r–r– 1 root root 89027 Apr 26 11:19 oracleasm-support-2.1.3-1.el5.x86_64.rpm [root@node1 asm_rpm]# rpm -ivh oracleasm-support-2.1.3-1.el5.x86_64.rpm warning: oracleasm-support-2.1.3-1.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159 Preparing… ########################################### [100%] 1:oracleasm-support ########################################### [100%] [root@node1 asm_rpm]# rpm -ivh oracleasm-2.6.18-194.el5-2.0.5-1.el5.x86_64.rpm warning: oracleasm-2.6.18-194.el5-2.0.5-1.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159 Preparing… ########################################### [100%] 1:oracleasm-2.6.18-194.el########################################### [100%] [root@node1 asm_rpm]# rpm -ivh oracleasmlib-2.0.4-1.el5.x86_64.rpm warning: oracleasmlib-2.0.4-1.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159 Preparing… ########################################### [100%] 1:oracleasmlib ########################################### [100%] [root@node1 asm_rpm]# rpm -qa|grep asm oracleasm-2.6.18-194.el5-2.0.5-1.el5 oracleasm-support-2.1.3-1.el5 oracleasmlib-2.0.4-1.el5 [root@node1 asm_rpm]# |
node2 安装:
[root@node2 asm_rpm]# ll total 136 -rw-r–r– 1 root root 25977 Apr 26 11:20 oracleasm-2.6.18-194.el5-2.0.5-1.el5.x86_64.rpm -rw-r–r– 1 root root 14176 Apr 26 11:20 oracleasmlib-2.0.4-1.el5.x86_64.rpm -rw-r–r– 1 root root 89027 Apr 26 11:20 oracleasm-support-2.1.3-1.el5.x86_64.rpm [root@node2 asm_rpm]# rpm -qa|grep asm [root@node2 asm_rpm]# rpm -ivh oracleasm-support-2.1.3-1.el5.x86_64.rpm warning: oracleasm-support-2.1.3-1.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159 Preparing… ########################################### [100%] 1:oracleasm-support ########################################### [100%] [root@node2 asm_rpm]# rpm -ivh oracleasm-2.6.18-194.el5-2.0.5-1.el5.x86_64.rpm warning: oracleasm-2.6.18-194.el5-2.0.5-1.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159 Preparing… ########################################### [100%] 1:oracleasm-2.6.18-194.el########################################### [100%] [root@node2 asm_rpm]# rpm -ivh oracleasmlib-2.0.4-1.el5.x86_64.rpm warning: oracleasmlib-2.0.4-1.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159 Preparing… ########################################### [100%] 1:oracleasmlib ########################################### [100%] [root@node2 asm_rpm]# rpm -qa|grep asm oracleasmlib-2.0.4-1.el5 oracleasm-support-2.1.3-1.el5 oracleasm-2.6.18-194.el5-2.0.5-1.el5 [root@node2 asm_rpm]# |
说明:安装上述3个ASM RPM软件包时要先安装oracleasm-support-2.1.3-1.el5软件包,其次安装oracleasm-2.6.18-194.el5-2.0.5-1.el5软件包,最后安装oracleasmlib-2.0.4-1.el5软件包。
安装完毕后,执行 rpm -qa|grep asm确认是否安装成功。
配置ASM driver服务
在node1上以root用户进行配置。在安装完3个ASM RPM软件包之后,可以通过执行/usr/sbin/oracleasm命令来进行配置,也可以通过执行/etc/init.d/oracleasm命令来进行配置,后者命令是Oracle 10g中进行ASM配置的命令,Oracle推荐执行前者命令,不过后者命令保留使用。
① 查看ASM服务状态:
[root@node1 ~]# /usr/sbin/oracleasm status
Checking if ASM is loaded: no
Checking if /dev/oracleasm is mounted: no
[root@node1 ~]#
看到,默认情况下ASM服务并未开启。具体命令和相关参数可以直接执行下述命令来获取:
[root@node1 ~]# /usr/sbin/oracleasm -h Usage: oracleasm [--exec-path=<exec_path>] <command> [ <args> ] oracleasm –exec-path oracleasm -h oracleasm -V
The basic oracleasm commands are: configure Configure the Oracle Linux ASMLib driver init Load and initialize the ASMLib driver exit Stop the ASMLib driver scandisks Scan the system for Oracle ASMLib disks status Display the status of the Oracle ASMLib driver listdisks List known Oracle ASMLib disks querydisk Determine if a disk belongs to Oracle ASMlib createdisk Allocate a device for Oracle ASMLib use deletedisk Return a device to the operating system renamedisk Change the label of an Oracle ASMlib disk update-driver Download the latest ASMLib driver [root@node1 ~]# |
② 配置ASM服务:
[root@node1 ~]# /usr/sbin/oracleasm configure -i 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 []: asmadmin 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 [root@node1 ~]# /usr/sbin/oracleasm status Checking if ASM is loaded: no Checking if /dev/oracleasm is mounted: no [root@node1 ~]# /usr/sbin/oracleasm init Loading module "oracleasm": oracleasm Mounting ASMlib driver filesystem: /dev/oracleasm [root@node1 ~]# /usr/sbin/oracleasm configure ORACLEASM_ENABLED=true ORACLEASM_UID=grid ORACLEASM_GID=asmadmin ORACLEASM_SCANBOOT=true ORACLEASM_SCANORDER="" ORACLEASM_SCANEXCLUDE="" [root@node1 ~]# |
说明:/usr/sbin/oracleasm configure -i命令进行配置时,用户配置为grid,组为asmadmin,启动ASM library driver驱动服务,并且将其配置为随着操作系统的启动而自动启动。
配置完成后,记得执行 /usr/sbin/oracleasm init命令来加载oracleasm内核模块。
③ 在node2上执行上述步骤②,完成ASM服务配置。
配置ASM磁盘
我们安装ASM RPM软件包,配置ASM 驱动服务的最终目的是要创建ASM磁盘,为将来安装grid软件、创建Oracle数据库提供存储。
说明:只需在一个节点上创建ASM磁盘即可!创建完之后,在其它节点上执行/usr/sbin/oracleasm scandisks之后,就可看到ASM磁盘。
接下来,开始创建ASM磁盘:
① 执行/usr/sbin/oracleasm createdisk来创建ASM磁盘
[root@node1 ~]# /usr/sbin/oracleasm listdisks [root@node1 ~]# /usr/sbin/oracleasm createdisk -h Usage: oracleasm-createdisk [-l <manager>] [-v] <label> <device> [root@node1 ~]# /usr/sbin/oracleasm createdisk VOL1 /dev/sdb1 Writing disk header: done Instantiating disk: done [root@node1 ~]# /usr/sbin/oracleasm createdisk VOL2 /dev/sdc1 Writing disk header: done Instantiating disk: done [root@node1 ~]# /usr/sbin/oracleasm createdisk VOL3 /dev/sdd1 Writing disk header: done Instantiating disk: done [root@node1 ~]# /usr/sbin/oracleasm createdisk VOL4 /dev/sde1 Writing disk header: done Instantiating disk: done [root@node1 ~]# /usr/sbin/oracleasm listdisks VOL1 VOL2 VOL3 VOL4 [root@node1 ~]# |
从上看到,创建出来4块ASM磁盘。此时,node2上还看不到刚创建的ASM磁盘。
② node2 执行/usr/sbin/oracleasm scandisks扫描磁盘
[root@node2 ~]# /usr/sbin/oracleasm listdisks [root@node2 ~]# /usr/sbin/oracleasm scandisks Reloading disk partitions: done Cleaning any stale ASM disks… Scanning system for ASM disks… Instantiating disk "VOL1" Instantiating disk "VOL2" Instantiating disk "VOL3" Instantiating disk "VOL4" [root@node2 ~]# /usr/sbin/oracleasm listdisks VOL1 VOL2 VOL3 VOL4 [root@node2 ~]# |
③ 如何确定ASM磁盘同物理磁盘之间的对应关系?
[root@node1 ~]# /usr/sbin/oracleasm querydisk /dev/sd* Device "/dev/sda" is not marked as an ASM disk Device "/dev/sda1" is not marked as an ASM disk Device "/dev/sda2" is not marked as an ASM disk Device "/dev/sdb" is not marked as an ASM disk Device "/dev/sdb1" is marked an ASM disk with the label "VOL1" Device "/dev/sdc" is not marked as an ASM disk Device "/dev/sdc1" is marked an ASM disk with the label "VOL2" Device "/dev/sdd" is not marked as an ASM disk Device "/dev/sdd1" is marked an ASM disk with the label "VOL3" Device "/dev/sde" is not marked as an ASM disk Device "/dev/sde1" is marked an ASM disk with the label "VOL4" [root@node1 ~]# |
至此,ASM磁盘准备工作已经完成!
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。