一.背景
清明前一天给客户扩容了系统的asm磁盘组,记录如下:
二.环境
vsphere 7
oracle linux 6.9
11.2.0.4
三.步骤
3.1.物理添加磁盘
vsphere控制台添加共享盘。(注意跟本地盘的区别:scsi控制总线为1,独立持久)
3.2.不重启识别磁盘
ll /proc/scsi/scsi
echo “- - -” > /sys/class/scsi_host/host0/scan
echo “- - -” > /sys/class/scsi_host/host1/scan
echo “- - -” > /sys/class/scsi_host/host2/scan
echo “- - -” > /sys/class/scsi_host/host3/scan
3.3.确定磁盘的wwid号码
这里需要注意的是,因为两边本地盘的数量不一定一致。
所以后面添加共享盘的时候盘符不一定一致。比如同一块盘,在一节点为sdd,在二节点是sde。
所以我们需要确定唯一的wwid号码
例如我们下面的环境中,二节点就比本地盘多几块盘。
/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/sd*
[root@rac1 ~]# /sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/sda [root@rac1 ~]# /sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/sdb [root@rac1 ~]# /sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/sdc [root@rac1 ~]# /sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/sdd 36000c29da776b71748731db99819cdc7 [root@rac1 ~]# /sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/sde 36000c2976a8896c01c006db6f7a885f5 [root@rac1 ~]# /sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/sdf 36000c299db784e0db28df01908856368 [root@rac1 ~]# /sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/sdg 36000c29860fa8fdcc71865740477730d [root@rac1 ~]# /sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/sdh 36000c29ffd630b2446735485d3d0617a [root@rac1 ~]# /sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/sdi 36000c29c024e6f398e731f48e1acc422 [root@rac1 ~]# /sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/sdj 36000c295113b873469529a5845d2f793 [root@rac1 ~]# /sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/sdk 36000c29122c86f0184cd91f4fea20311 [root@rac1 ~]# /sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/sdl 36000c29b81a2682b3a4aac2f235d3d8c [root@rac1 ~]# rac2: [root@rac2 ~]# /sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/sda [root@rac2 ~]# /sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/sdb 36000c29da776b71748731db99819cdc7 [root@rac2 ~]# /sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/sdc 36000c2976a8896c01c006db6f7a885f5 [root@rac2 ~]# /sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/sdd 36000c299db784e0db28df01908856368 [root@rac2 ~]# /sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/sde 36000c29860fa8fdcc71865740477730d [root@rac2 ~]# /sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/sdf 36000c29ffd630b2446735485d3d0617a [root@rac2 ~]# /sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/sdg 36000c29c024e6f398e731f48e1acc422 [root@rac2 ~]# /sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/sdh 36000c295113b873469529a5845d2f793 [root@rac2 ~]# /sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/sdi 36000c29122c86f0184cd91f4fea20311 [root@rac2 ~]# /sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/sdj 36000c29b81a2682b3a4aac2f235d3d8c
3.4.扩容之前记录
[root@rac1 ~]# ll /dev/asm*
brw-rw---- 1 grid asmadmin 8, 48 Apr 2 18:53 /dev/asm-diskb
brw-rw---- 1 grid asmadmin 8, 64 Apr 2 18:53 /dev/asm-diskc
brw-rw---- 1 grid asmadmin 8, 80 Apr 2 18:53 /dev/asm-diskd
brw-rw---- 1 grid asmadmin 8, 96 Apr 2 18:52 /dev/asm-diske
brw-rw---- 1 grid asmadmin 8, 112 Apr 2 18:52 /dev/asm-diskg
brw-rw---- 1 grid asmadmin 8, 128 Apr 2 18:51 /dev/asm-diskh
You have mail in /var/spool/mail/root
[root@rac1 ~]#
[root@rac2 ~]# ll /dev/asm*
brw-rw---- 1 grid asmadmin 8, 16 Apr 2 18:53 /dev/asm-diskb
brw-rw---- 1 grid asmadmin 8, 32 Apr 2 18:53 /dev/asm-diskc
brw-rw---- 1 grid asmadmin 8, 48 Apr 2 18:53 /dev/asm-diskd
brw-rw---- 1 grid asmadmin 8, 64 Apr 2 18:52 /dev/asm-diske
brw-rw---- 1 grid asmadmin 8, 80 Apr 2 18:52 /dev/asm-diskg
brw-rw---- 1 grid asmadmin 8, 96 Apr 2 18:52 /dev/asm-diskh
You have mail in /var/spool/mail/root
[root@rac2 ~]#
检查数据库状态。
检查数据库日志。
检查之前的备份是否成功。
关闭数据库和集群。
shutdown immediate;
crsctl stop crs
3.5.编辑udev配置文件
[root@rac1 rules.d]# cat 99-oracle-asmdevices.rules KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="36000c29da776b71748731db99819cdc7",NAME="asm-diskb",OWNER="grid",GROUP="asmadmin",MODE="0660" KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="36000c2976a8896c01c006db6f7a885f5",NAME="asm-diskc",OWNER="grid",GROUP="asmadmin",MODE="0660" KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="36000c299db784e0db28df01908856368",NAME="asm-diskd",OWNER="grid",GROUP="asmadmin",MODE="0660" KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="36000c29860fa8fdcc71865740477730d",NAME="asm-diske",OWNER="grid",GROUP="asmadmin",MODE="0660" KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="36000c29ffd630b2446735485d3d0617a",NAME="asm-diskg",OWNER="grid",GROUP="asmadmin",MODE="0660" KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="36000c29c024e6f398e731f48e1acc422",NAME="asm-diskh",OWNER="grid",GROUP="asmadmin",MODE="0660" KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="36000c295113b873469529a5845d2f793",NAME="asm-diski",OWNER="grid",GROUP="asmadmin",MODE="0660" KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="36000c29122c86f0184cd91f4fea20311",NAME="asm-diskj",OWNER="grid",GROUP="asmadmin",MODE="0660" KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="36000c29b81a2682b3a4aac2f235d3d8c",NAME="asm-diskk",OWNER="grid",GROUP="asmadmin",MODE="0660" [root@rac1 rules.d]#
start_udev
3.6.验证是否添加成功
[root@rac1 rules.d]# ll /dev/asm*
brw-rw---- 1 grid asmadmin 8, 48 Apr 2 19:03 /dev/asm-diskb
brw-rw---- 1 grid asmadmin 8, 64 Apr 2 19:03 /dev/asm-diskc
brw-rw---- 1 grid asmadmin 8, 80 Apr 2 19:03 /dev/asm-diskd
brw-rw---- 1 grid asmadmin 8, 96 Apr 2 19:03 /dev/asm-diske
brw-rw---- 1 grid asmadmin 8, 112 Apr 2 19:03 /dev/asm-diskg
brw-rw---- 1 grid asmadmin 8, 128 Apr 2 19:03 /dev/asm-diskh
brw-rw---- 1 grid asmadmin 8, 144 Apr 2 19:03 /dev/asm-diski
brw-rw---- 1 grid asmadmin 8, 160 Apr 2 19:03 /dev/asm-diskj
brw-rw---- 1 grid asmadmin 8, 176 Apr 2 19:03 /dev/asm-diskk
[root@rac1 rules.d]#
[root@rac2 rules.d]# ll /dev/asm*
brw-rw---- 1 grid asmadmin 8, 16 Apr 2 19:03 /dev/asm-diskb
brw-rw---- 1 grid asmadmin 8, 32 Apr 2 19:03 /dev/asm-diskc
brw-rw---- 1 grid asmadmin 8, 48 Apr 2 19:03 /dev/asm-diskd
brw-rw---- 1 grid asmadmin 8, 64 Apr 2 19:03 /dev/asm-diske
brw-rw---- 1 grid asmadmin 8, 80 Apr 2 19:03 /dev/asm-diskg
brw-rw---- 1 grid asmadmin 8, 96 Apr 2 19:03 /dev/asm-diskh
brw-rw---- 1 grid asmadmin 8, 112 Apr 2 19:03 /dev/asm-diski
brw-rw---- 1 grid asmadmin 8, 128 Apr 2 19:03 /dev/asm-diskj
brw-rw---- 1 grid asmadmin 8, 144 Apr 2 19:03 /dev/asm-diskk
[root@rac2 rules.d]#
SQL> select group_number,mount_status,name,path from v$asm_disk; GROUP_NUMBER MOUNT_S NAME PATH ------------ ------- ------------------------------ ---------------------------------------- 0 CLOSED /dev/asm-diski 0 CLOSED /dev/asm-diskj 0 CLOSED /dev/asm-diskk 1 CACHED DATA_0001 /dev/asm-diskh 1 CACHED DATA_0000 /dev/asm-diske 2 CACHED FRA_0001 /dev/asm-diskg 3 CACHED OCR_0001 /dev/asm-diskc 3 CACHED OCR_0002 /dev/asm-diskd 3 CACHED OCR_0000 /dev/asm-diskb
3.7.扩容磁盘组
alter diskgroup DATA add disk ‘/dev/asm-diski’ rebalance power 10;
–查看进度
select * from v$asm_operation;
alter diskgroup DATA add disk ‘/dev/asm-diskj’ rebalance power 10;
alter diskgroup DATA add disk ‘/dev/asm-diskk’ rebalance power 10;
–平衡完成之后
alter diskgroup DATA rebalance power 1;
3.8.验证是否扩容成功
SQL> set line 200 SQL> col name for a30 SQL> col path for a40 SQL> col state for a10 SQL> select name,path,state from v$asm_disk;SQL> SQL> SQL> SQL> NAME PATH STATE ------------------------------ ---------------------------------------- ---------- DATA_0002 /dev/asm-diski NORMAL DATA_0003 /dev/asm-diskj NORMAL DATA_0004 /dev/asm-diskk NORMAL DATA_0001 /dev/asm-diskh NORMAL DATA_0000 /dev/asm-diske NORMAL FRA_0001 /dev/asm-diskg NORMAL OCR_0001 /dev/asm-diskc NORMAL OCR_0002 /dev/asm-diskd NORMAL OCR_0000 /dev/asm-diskb NORMAL
SQL> select name,total_mb/1024,free_mb/1024 from v$asm_diskgroup;
四.总结
4.1.添加磁盘不重启生效
ll /proc/scsi/scsi
echo “- - -” > /sys/class/scsi_host/host0/scan
echo “- - -” > /sys/class/scsi_host/host1/scan
echo “- - -” > /sys/class/scsi_host/host2/scan
echo “- - -” > /sys/class/scsi_host/host3/scan
4.2.oracleasm包创建的asm磁盘组用如下命令:
–列出所有asm磁盘
/etc/init.d/oracleasm listdisks
–查询磁盘是否可用
/etc/init.d/oracleasm querydisk -p VOL1
–创建asm磁盘
oracleasm createdisk data2 /dev/sdj1
oracleasm scandisks
oracleasm listdisks
4.3.特别注意
一定要根据wwid号码来确定新加的盘是哪些,千万不能只看盘符来确定。
发表评论