现在的位置: 首页 > 综合 > 正文

ORACLE RAC 用虚拟机增加asm硬盘

2013年09月18日 ⁄ 综合 ⁄ 共 4293字 ⁄ 字号 评论关闭

我的RAC 虚拟机,昨天在做备份的时候提示DISKGROUP空间不足,于是增加ASMDISK便摆上日程,在安装RAC的时候,我有2个ASM DISKGROUP分别是 +DG, +RECOVERYDEST,现在+RECOVERYDEST空间不足,安装的时候又没有创建多余的ASMDISK,只有现在亡羊补牢,在2个节点同时用虚拟机创建ASMDISK,然后用 alter diskgroup add disk 命令增加SIZE。具体步骤如下,

 

1,先shutdown 虚拟机,点EDIT =>HARD DISK=>ADD=>CREATE NEW VIRTUAL DISK=>SCSI 等按部就班,搞定后启动vm。

2,为Oracle ASM 创建磁盘分区。

为 Oracle ASM/dev/sdb准备一组原始磁盘。

在 rac1 上,以 root 用户身份执行

# fdisk /dev/sdb

Command (m for help): n

Command action

e extended

p primary partition (1-4)p

Partition number (1-4): 1

First cylinder (1-512, default 1):

Using default value 1

Last cylinder or +size or +sizeM or +sizeK (1-2610, default 2610):

Using default value 2610

Command (m for help): w

The partition table has been altered!

calling ioctl() to re-read partition table.

Syncing disks.



3, 为 ASM 磁盘映射原始设备。


仅当
您打算使用标准 Linux I/O 创建 ASM 磁盘时,才需要原始设备映射。创建 ASM 磁盘的另一个方法是使用 Oracle 提供的 ASM 库驱动

程序。稍后,您将使用 ASM 库驱动程序配置 ASM 磁盘。

执行以下任务,将原始设备映射到先前创建的共享分区。每次引导集群节点时,原始设备都必须与块设备绑定。

将以下行添加到 /etc/sysconfig/rawdevices 中。

 

/dev/raw/raw4 /dev/sdb1
(这里每个人的情况不同,按实际分区操作)

要使映射立即生效,以 root 用户身份执行以下命令:

# /sbin/service rawdevices restart

[root@rac1 ~]# chown oracle:dba /dev/raw/raw4 (这里开始更改权限)

[root@rac1 ~]# chmod 660 /dev/raw/raw4

[root@rac1 ~]# ls -lat /dev/raw/raw4

crw-rw---- 1 oracle dba 162, 4 Mar 3 11:02 /dev/raw/raw4

crw-rw---- 1 oracle dba 162, 3 Mar 3 11:02 /dev/raw/raw3

crw-rw---- 1 oracle dba 162, 2 Mar 3 11:02 /dev/raw/raw2

crw-rw---- 1 oracle dba 162, 1 Mar 3 11:02 /dev/raw/raw1

以 oracle 用户身份执行

rac1-> ln -sf /dev/raw/raw4 /u01/oradata/devdb/asmdisk4

4,配置 Oracle 自动存储管理 (ASM)

Oracle ASM 与 Oracle 数据库紧密集成在一起,并与 Oracle 的数据管理工具套件配合工作。它可以简化数据库存储管理,并提供原始磁

盘 I/O 的性能。

配置 ASMLib。

以 root 用户身份在两个节点上配置 ASMLib。

# /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 without typing an

answer will keep that current value. Ctrl-C will abort.

Default user to own the driver interface []: oracle

Default group to own the driver interface []: dba

Start Oracle ASM library driver on boot (y/n) [n]: y

Fix permissions of Oracle ASM disks on boot (y/n) [y]: y

Writing Oracle ASM library driver configuration: [ OK ]

Loading module "oracleasm": [ OK ]

Mounting ASMlib driver filesystem: [ OK ]

Scanning system for ASM disks: [ OK ]

创建 ASM 磁盘。

以 root 用户身份在任何一个节点上创建 ASM 磁盘。

# /etc/init.d/oracleasm createdisk VOL4 /dev/sdb1

Marking disk "/dev/sdb1" as an ASM disk: [ OK ]

# /etc/init.d/oracleasm listdisks

VOL1

VOL2

VOL3

VOL4

至此,OS LEVEL的ASMDISK 设置完毕,下一步开始ORACLE RAC的设置。(这里卖个关子,如果这样后面肯定有问题,大家可以先想想

问题在哪?)

开始进入ORACLE ,运行以下命令

[oracle@rac1 bin]$ export ORACLE_SID=devdb1

[oracle@rac1 bin]$ srvctl start nodeapps -n rac1

PRKH-1010 : Unable to communicate with CRS services.

[OCR Error(Native: prsr_initCLSS:[21])]

[oracle@rac1 bin]$ srvctl start asm -n rac1

PRKH-1010 : Unable to communicate with CRS services.

再检查[root@rac1 bin]# /etc/init.d/o2cb status


Module "configfs": Loaded

Filesystem "configfs": Mounted

Module "ocfs2_nodemanager": Loaded

Module "ocfs2_dlm": Loaded

Module "ocfs2_dlmfs": Loaded

Filesystem "ocfs2_dlmfs": Mounted

Checking O2CB cluster ocfs2: Online

Heartbeat dead threshold: 61

Network idle timeout: 30000

Network keepalive delay: 2000

Network reconnect delay: 2000

Checking O2CB heartbeat: Not active


蒙了吧,问题来了,OCFS2出问题了,OCFS2 是 Oracle 开发的一个通用集群文件系统,与 Enterprise Linux 内核集成在一起。它允许

所有节点在集群文件系统上同时共享文件,因而消除了管理原始设备的需求。这里,您将在 OCFS2 文件系统中寄宿 OCR 和表决磁盘。

可以从 OCFS2 用户指南获取有关 OCFS2 的其他信息。

左思右想,为什么出现这个错误呢,原来,在你添加虚拟机硬盘的时候,虚拟机自动把新的DISK 作为/DEV/SDB, 也就是说原来挂载的的

OCFS2 盘被推到 /DEV/SDC 去了,这里要重新设置

挂载文件系统。





要挂载文件系统,在两个节点上执行以下命令。

# mount -t ocfs2 -o datavolume,nointr /dev/sdc1 /ocfs

要在引导时挂载文件系统,在两个节点的 /etc/fstab 中添加以下行。

/etc/fstab

/dev/sdc1 /ocfs ocfs2 _netdev,datavolume,nointr 0

再执行[root@rac1 bin]# /etc/init.d/o2cb status

Module "configfs": Loaded

Filesystem "configfs": Mounted

Module "ocfs2_nodemanager": Loaded

Module "ocfs2_dlm": Loaded

Module "ocfs2_dlmfs": Loaded

Filesystem "ocfs2_dlmfs": Mounted

Checking O2CB cluster ocfs2: Online

Heartbeat dead threshold: 61

Network idle timeout: 3000

Network keepalive delay: 2000

Network reconnect delay: 2000

Checking O2CB heartbeat: Active


好问题解决了。



[oracle@rac1 bin]$ export ORACLE_SID=devdb1

[oracle@rac1 bin]$ srvctl start nodeapps -n rac1

[oracle@rac1 bin]$ srvctl start asm -n rac1

[oracle@rac1 bin]$ srvctl start instance -d devdb -i devdb1

[oracle@rac1 bin]$ sqlplus '/as sysdba'



SQL*Plus: Release 10.2.0.1.0 - Production on Thu Mar 3 13:10:43 2011

Copyright (c) 1982, 2005, Oracle. All rights reserved.

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - ProductioWith the Partitioning,

Real Application Clusters, OLAP and Data Mining options

SQL> select open_mode from v$database



OPEN_MODE

----------

READ WRITE



(持续。。。。)
































































抱歉!评论已关闭.