适用范围

oracle 11g及以上数据库asm磁盘组新存储替换旧存储

问题概述

使用IBM新存储替换旧存储FalconStor

问题原因

IBM新存储的性能更优、数据库ASM底层存储进行替换

解决方案

1、存储信息确认及配置

1.1、ASM磁盘组及旧存储磁盘信息说明

磁盘组名称

冗余方式

磁盘WWID及大小

ASM磁盘路径

CRS

NORMAL

36000c29130bc55d46b0093070ebc8221 2G 36000c29130bc55d46b0093070ebc8222 2G 36000c29130bc55d46b0093070ebc8223 2G 36000c29130bc55d46b0093070ebc8224 2G

/dev/asm-ocr1 /dev/asm-ocr2 /dev/asm-ocr3 /dev/asm-ocr4

DATA

EXTERNAL

36000c29130bc55d46b0093070ebc8225 500G 36000c29130bc55d46b0093070ebc8226 500G 36000c29130bc55d46b0093070ebc8227 500G 36000c29130bc55d46b0093070ebc8228 500G

/dev/asm-data1 /dev/asm-data2 /dev/asm-data3 /dev/asm-data4

1.2、新存储磁盘信息说明

磁盘WWID及大小

ASM路径

新增到的磁盘组

36000c123456c55d46b0093070ebc8221 2G 36000c123456c55d46b0093070ebc8222 2G 36000c123456c55d46b0093070ebc8223 2G 36000c123456c55d46b0093070ebc8224 2G

/dev/asm-ocr5 /dev/asm-ocr6 /dev/asm-ocr7 /dev/asm-ocr8

CRS

36000c123456c55d46b0093070ebc8225 500G 36000c123456c55d46b0093070ebc8226 500G 36000c123456c55d46b0093070ebc8227 500G 36000c123456c55d46b0093070ebc8228 500G

/dev/asm-data5 /dev/asm-data6 /dev/asm-data7 /dev/asm-data8

DATA

1.3、确认新存储的磁盘wwid

– 扫盘(如果存储已经分配存储盘了,但是数据库服务器上不显示)
– 如果确定知道是host多少,指定host进行扫描,不确定的话可以全部扫描一遍

#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
…
#echo “- - -”>/sys/class/scsi_host/hostX/scan

或者使用脚本
#sh /usr/bin/rescan-scsi-bus.sh
– 确定wwid
#lsscsi -si --安装了lsscsi-0.27-6.el7.x86_64或其他版本的rpm包
#multipath -ll --使用了multipath作为多路径软件
#ls -l /dev/disk/by-id

2、修改multipath添加新增的磁盘

#cd /etc/ && cp multipath.conf multipath.conf.bak20220801
#vi /etc/multipath.conf
multipath {
wwid 36000c123456c55d46b0093070ebc8221
alias ocr5
path_grouping_policy multibus
}
multipath {
wwid 36000c123456c55d46b0093070ebc8222
alias ocr6
path_grouping_policy multibus
}
multipath {
wwid 36000c123456c55d46b0093070ebc8223
alias ocr7
path_grouping_policy multibus
}
multipath {
wwid 36000c123456c55d46b0093070ebc8224
alias ocr8
path_grouping_policy multibus
}
multipath {
wwid 36000c123456c55d46b0093070ebc8225
alias data5
path_grouping_policy multibus
}
multipath {
wwid 36000c123456c55d46b0093070ebc8226
alias data6
path_grouping_policy multibus
}
multipath {
wwid 36000c123456c55d46b0093070ebc8227
alias data7
path_grouping_policy multibus
}
multipath {
wwid 36000c123456c55d46b0093070ebc8228
alias data8
path_grouping_policy multibus
}
– reload multipath

#multipath -r

3、修改udev添加新增的磁盘

#vi /etc/udev/rules.d/99-oracle-asmdevices.rules

ENV{DM_NAME}==“ocr5”, OWNER:=“grid”, GROUP:=“asmadmin”, MODE:=“660”, SYMLINK+=“asm-ocr5”
ENV{DM_NAME}==“ocr6”, OWNER:=“grid”, GROUP:=“asmadmin”, MODE:=“660”, SYMLINK+=“asm-ocr6”
ENV{DM_NAME}==“ocr7”, OWNER:=“grid”, GROUP:=“asmadmin”, MODE:=“660”, SYMLINK+=“asm-ocr7”
ENV{DM_NAME}==“ocr8”, OWNER:=“grid”, GROUP:=“asmadmin”, MODE:=“660”, SYMLINK+=“asm-ocr8”
ENV{DM_NAME}==“data5”, OWNER:=“grid”, GROUP:=“asmadmin”, MODE:=“660”, SYMLINK+=“asm-data5”
ENV{DM_NAME}==“data6”, OWNER:=“grid”, GROUP:=“asmadmin”, MODE:=“660”, SYMLINK+=“asm-data6”
ENV{DM_NAME}==“data7”, OWNER:=“grid”, GROUP:=“asmadmin”, MODE:=“660”, SYMLINK+=“asm-data7”
ENV{DM_NAME}==“data8”, OWNER:=“grid”, GROUP:=“asmadmin”, MODE:=“660”, SYMLINK+=“asm-data8”

– 触发权限生效

#udevadm control --reload-rules
#udevadm trigger --sysname-match=dm-15
#udevadm trigger --sysname-match=dm-16
#udevadm trigger --sysname-match=dm-17
#udevadm trigger --sysname-match=dm-18
#udevadm trigger --sysname-match=dm-19
#udevadm trigger --sysname-match=dm-20
#udevadm trigger --sysname-match=dm-21
#udevadm trigger --sysname-match=dm-22

– 检查属组及权限

#ll /dev/mapper/*
#ll /dev/dm-*|grep grid

4、确认磁盘可用性

#su - grid

$asmcmd lsdsk --candidate
$sqlplus / as sysasm<<eof
set linesize 200 pages 1000;
col name format a16;
col path format a30;
col HEADER_STATUS format a16;
select name,path,HEADER_STATUS,TOTAL_MB from v$asm_disk;
eof

5、备份ocr和votedisk

#/u01/app/11.2.0.4/grid/bin/ocrconfig -export /backup/20220801/ocr_20220801.exp
dd if=/dev/asm-ocr1 of=/backup/20220801/votedisk_20220801_ocr1.bak
dd if=/dev/asm-ocr2 of=/backup/20220801/votedisk_20220801_ocr2.bak
dd if=/dev/asm-ocr3 of=/backup/20220801/votedisk_20220801_ocr3.bak
dd if=/dev/asm-ocr4 of=/backup/20220801/votedisk_20220801_ocr4.bak

6、CRS磁盘组替换新存储

#su - grid

$sqlplus / as sysasm<<eof
alter diskgroup CRS add disk
‘/dev/asm-ocr5’,
‘/dev/asm-ocr6’,
‘/dev/asm-ocr7’,
‘/dev/asm-ocr8’
drop disk
OCR_0000,
OCR_0001,
OCR_0002,
OCR_00003
rebalance power 8;
eof

–查看rebalance进度
#su - grid

$sqlplus / as sysasm<<eof
select * from v$asm_operation;
eof

7、DATA磁盘组替换新存储

#su - grid

$sqlplus / as sysasm<<eof
alter diskgroup DATA add disk
‘/dev/asm-data5’,
‘/dev/asm-data6’,
‘/dev/asm-data7’,
‘/dev/asm-data8’
drop disk
DATA_0000,
DATA_0001,
DATA_0002,
DATA_0003
rebalance power 8;
eof

–查看rebalance进度
#su - grid

$sqlplus / as sysasm<<eof
select * from v$asm_operation;
eof

8、查看磁盘组磁盘状态

– 旧存储磁盘的状态为FORMER,新存储磁盘的状态为MEMBER

$ sqlplus / as sysasm<<eof
set linesize 200 pages 1000;
col name format a16;
col path format a30;
col HEADER_STATUS format a16;
select name,path,HEADER_STATUS,TOTAL_MB from v$asm_disk;
eof

9、检查集群状态及数据库状态

#su - grid

$crsctl stat res -t
#su - oracle
$sqlplus / as sysdba<<eof
select instance_name,status from gv$instance;
select name,open_mode from gv$database;
eof