1、OS 上检查 RAC 两结点主机OS能否检测到磁盘,且两结点指向的是同一物理盘
g CNSZ082275
su - grid
oracleasm listdisks
oracleasm listdisks | grep -i DATA_MCRY --两结点看到的磁盘要一致
ls -l /dev/oracleasm/disks/ | grep -i DATA_MCRY --两结点看到的磁盘要一致
g CNSZ082276
su - grid
oracleasm listdisks
oracleasm listdisks | grep -i DATA_MCRY --两结点看到的磁盘要一致
ls -l /dev/oracleasm/disks/ | grep -i DATA_MCRY --两结点看到的磁盘要一致
2、sqlplus 中检查两节点能否识别到ORACLE ASM 盘,且 PATH 路径一致
g CNSZ082275
su - grid (如果当前己经是grid了,就不用再切)
sqlplus / as sysasm
col path format a50
set linesize 300
set pagesize 300
SQL> select d.group_number,g.name diskgroup_name,disk_number,header_status,d.state,path,d.name disk_name,d.failgroup,d.failgroup_type,d.os_mb,d.total_mb,d.free_mb
from v$asm_disk d left outer join v$asm_diskgroup g on (d.group_number=g.group_number) where d.path like '%DATA_MCRY%';
g CNSZ082276
su - grid (如果当前己经是grid了,就不用再切)
sqlplus / as sysasm
SQL> select d.group_number,g.name diskgroup_name,disk_number,header_status,d.state,path,d.name disk_name,d.failgroup,d.failgroup_type,d.os_mb,d.total_mb,d.free_mb
from v$asm_disk d left outer join v$asm_diskgroup g on (d.group_number=g.group_number) where d.path like '%DATA_MCRY%';
3、备份 OCR (需请chang5 同事帮忙用root执行)
g CNSZ082275
su - root
ocrcheck
crsctl query css votedisk
ocrconfig -showbackup
ocrconfig -manualbackup
ocrconfig -showbackup
4、查看当前ASM中是否有其它磁盘组在做 rebalance ,如果有其它磁盘组在做 rebalance ,需要等其做完后,再操作(两节点都要看)
g CNSZ082275
su - grid (如果当前己经是grid了,就不用再切)
sqlplus / as sysasm
SQL> select d.name diskgroup_name,o.* from gv$asm_operation o,v$asm_diskgroup d where o.GROUP_NUMBER=d.GROUP_NUMBER; --这个查询为空,才能进行后面操作,否则要等
g CNSZ082276
su - grid (如果当前己经是grid了,就不用再切)
sqlplus / as sysasm
SQL> select d.name diskgroup_name,o.* from gv$asm_operation o,v$asm_diskgroup d where o.GROUP_NUMBER=d.GROUP_NUMBER; --这个查询为空,才能进行后面操作,否则要等
5、MCRY添加磁盘
g CNSZ082275
su - grid (如果当前己经是grid了,就不用再切)
sqlplus / as sysasm
SQL> select d.group_number,g.name diskgroup_name,disk_number,header_status,d.state,path,d.name disk_name,d.failgroup,d.failgroup_type,d.os_mb,d.total_mb,d.free_mb
from v$asm_disk d left outer join v$asm_diskgroup g on (d.group_number=g.group_number) where d.path like '%DATA_MCRY%';
SQL> alter diskgroup DATA_MCRY_DG add disk 'ORCL:DATA_MCRY_DISK001' name DATA_MCRY_DISK001 rebalance power 0;
SQL> alter diskgroup DATA_MCRY_DG add disk 'ORCL:DATA_MCRY_DISK002' name DATA_MCRY_DISK002 rebalance power 0;
SQL> alter diskgroup DATA_MCRY_DG add disk 'ORCL:DATA_MCRY_DISK003' name DATA_MCRY_DISK003 rebalance power 0;
SQL> alter diskgroup DATA_MCRY_DG add disk 'ORCL:DATA_MCRY_DISK004' name DATA_MCRY_DISK004 rebalance power 0;
SQL> alter diskgroup DATA_MCRY_DG add disk 'ORCL:DATA_MCRY_DISK005' name DATA_MCRY_DISK005 rebalance power 0;
SQL> alter diskgroup DATA_MCRY_DG add disk 'ORCL:DATA_MCRY_DISK006' name DATA_MCRY_DISK006 rebalance power 0;
SQL> alter diskgroup DATA_MCRY_DG add disk 'ORCL:DATA_MCRY_DISK007' name DATA_MCRY_DISK007 rebalance power 0;
SQL> alter diskgroup DATA_MCRY_DG add disk 'ORCL:DATA_MCRY_DISK008' name DATA_MCRY_DISK008 rebalance power 0;
SQL> alter diskgroup DATA_MCRY_DG add disk 'ORCL:DATA_MCRY_DISK009' name DATA_MCRY_DISK009 rebalance power 0;
SQL> alter diskgroup DATA_MCRY_DG add disk 'ORCL:DATA_MCRY_DISK010' name DATA_MCRY_DISK010 rebalance power 0;
SQL> alter diskgroup DATA_MCRY_DG add disk 'ORCL:DATA_MCRY_DISK011' name DATA_MCRY_DISK011 rebalance power 0;
SQL> alter diskgroup DATA_MCRY_DG add disk 'ORCL:DATA_MCRY_DISK012' name DATA_MCRY_DISK012 rebalance power 0;
SQL> alter diskgroup DATA_MCRY_DG add disk 'ORCL:DATA_MCRY_DISK013' name DATA_MCRY_DISK013 rebalance power 0;
SQL> alter diskgroup DATA_MCRY_DG add disk 'ORCL:DATA_MCRY_DISK014' name DATA_MCRY_DISK014 rebalance power 0;
SQL> alter diskgroup DATA_MCRY_DG add disk 'ORCL:DATA_MCRY_DISK015' name DATA_MCRY_DISK015 rebalance power 0;
SQL> alter diskgroup DATA_MCRY_DG add disk 'ORCL:DATA_MCRY_DISK016' name DATA_MCRY_DISK016 rebalance power 0;
SQL> select d.group_number,g.name diskgroup_name,disk_number,header_status,d.state,path,d.name disk_name,d.failgroup,d.failgroup_type,d.os_mb,d.total_mb,d.free_mb
from v$asm_disk d left outer join v$asm_diskgroup g on (d.group_number=g.group_number) where d.path like '%DATA_MCRY%';
5.1、在另一节点查看磁盘组状态是否与节点一一致,新磁盘是否加上去
g CNSZ082276
su - grid (如果当前己经是grid了,就不用再切)
sqlplus / as sysasm
SQL> select d.group_number,g.name diskgroup_name,disk_number,header_status,d.state,path,d.name disk_name,d.failgroup,d.failgroup_type,d.os_mb,d.total_mb,d.free_mb
from v$asm_disk d left outer join v$asm_diskgroup g on (d.group_number=g.group_number) where d.path like '%DATA_MCRY%';
5.2、开启 rebalance
g CNSZ082275
su - poracle
sqlplus / as sysdba -- 查看是否有长事务或备份在运行
select inst_id,sid, target,opname, sofar,totalwork,time_remaining from gv$session_longops where time_remaining>0;
su - grid (如果当前己经是grid了,就不用再切)
sqlplus / as sysasm
SQL> alter diskgroup DATA_MCRY_DG rebalance power 8;
SQL> select d.name diskgroup_name,o.* from gv$asm_operation o,v$asm_diskgroup d where o.GROUP_NUMBER=d.GROUP_NUMBER; -- 查看 rebalance 进度
5.3、在另一节点查看 rebalance 进度
g CNSZ082276
su - grid (如果当前己经是grid了,就不用再切)
sqlplus / as sysasm
SQL> select d.name diskgroup_name,o.* from gv$asm_operation o,v$asm_diskgroup d where o.GROUP_NUMBER=d.GROUP_NUMBER; -- 查看 rebalance 进度
5.4、验证(两节点 v$asm_operation 都为空,HEADER_STATU 状态为 MEMBER,才视为正常)
g CNSZ082275
su - grid (如果当前己经是grid了,就不用再切)
sqlplus / as sysasm
SQL> select d.name diskgroup_name,o.* from gv$asm_operation o,v$asm_diskgroup d where o.GROUP_NUMBER=d.GROUP_NUMBER; -- 要为空
SQL> select d.group_number,g.name diskgroup_name,disk_number,header_status,d.state,path,d.name disk_name,d.failgroup,d.failgroup_type,d.os_mb,d.total_mb,d.free_mb
from v$asm_disk d left outer join v$asm_diskgroup g on (d.group_number=g.group_number) where d.path like '%DATA_MCRY%'; ---HEADER_STATU为member
SQL> exit
/oracle_grid/grid/see_asm.sh DATA_MCRY_DG -- TOTAL_GB 要为 32T
g CNSZ082276
su - grid(如果当前己经是grid了,就不用再切)
sqlplus / as sysasm
SQL> select d.name diskgroup_name,o.* from gv$asm_operation o,v$asm_diskgroup d where o.GROUP_NUMBER=d.GROUP_NUMBER; -- 要为空
SQL> select d.group_number,g.name diskgroup_name,disk_number,header_status,d.state,path,d.name disk_name,d.failgroup,d.failgroup_type,d.os_mb,d.total_mb,d.free_mb
from v$asm_disk d left outer join v$asm_diskgroup g on (d.group_number=g.group_number) where d.path like '%DATA_MCRY%'; ---HEADER_STATU为member
/oracle_grid/grid/see_asm.sh DATA_MCRY_DG -- TOTAL_GB 要为 32T
6、MCRY删除老盘
--上一步 rebalance 完了才做
g CNSZ082275
su - grid (如果当前己经是grid了,就不用再切)
sqlplus / as sysasm
SQL> select g.name diskgroup_name,o.* from gv$asm_operation o,gv$asm_diskgroup g where o.group_number=g.group_number and o.inst_id=g.inst_id; -- 要为空
SQL> select d.group_number,g.name diskgroup_name,disk_number,header_status,d.state,path,d.name disk_name,d.failgroup,d.failgroup_type,d.os_mb,d.total_mb,d.free_mb
from v$asm_disk d left outer join v$asm_diskgroup g on (d.group_number=g.group_number) where d.path like '%DATA_MCRY%';
SQL> alter diskgroup DATA_MCRY_DG drop disk DATA_MCRY_NDISK001 rebalance power 0;
SQL> alter diskgroup DATA_MCRY_DG drop disk DATA_MCRY_NDISK002 rebalance power 0;
SQL> alter diskgroup DATA_MCRY_DG drop disk DATA_MCRY_NDISK003 rebalance power 0;
SQL> alter diskgroup DATA_MCRY_DG drop disk DATA_MCRY_NDISK004 rebalance power 0;
SQL> alter diskgroup DATA_MCRY_DG drop disk DATA_MCRY_NDISK005 rebalance power 0;
SQL> alter diskgroup DATA_MCRY_DG drop disk DATA_MCRY_NDISK006 rebalance power 0;
SQL> alter diskgroup DATA_MCRY_DG drop disk DATA_MCRY_NDISK007 rebalance power 0;
SQL> alter diskgroup DATA_MCRY_DG drop disk DATA_MCRY_NDISK008 rebalance power 0;
SQL> alter diskgroup DATA_MCRY_DG drop disk DATA_MCRY_NDISK009 rebalance power 0;
SQL> alter diskgroup DATA_MCRY_DG drop disk DATA_MCRY_NDISK010 rebalance power 0;
SQL> alter diskgroup DATA_MCRY_DG drop disk DATA_MCRY_NDISK011 rebalance power 0;
SQL> alter diskgroup DATA_MCRY_DG drop disk DATA_MCRY_NDISK012 rebalance power 0;
SQL> alter diskgroup DATA_MCRY_DG drop disk DATA_MCRY_NDISK013 rebalance power 0;
SQL> alter diskgroup DATA_MCRY_DG drop disk DATA_MCRY_NDISK014 rebalance power 0;
SQL> alter diskgroup DATA_MCRY_DG drop disk DATA_MCRY_NDISK015 rebalance power 0;
SQL> alter diskgroup DATA_MCRY_DG drop disk DATA_MCRY_NDISK016 rebalance power 0;
SQL> alter diskgroup DATA_MCRY_DG drop disk DATA_MCRY_NDISK017 rebalance power 0;
SQL> alter diskgroup DATA_MCRY_DG drop disk DATA_MCRY_NDISK018 rebalance power 0;
SQL> alter diskgroup DATA_MCRY_DG drop disk DATA_MCRY_NDISK019 rebalance power 0;
SQL> alter diskgroup DATA_MCRY_DG drop disk DATA_MCRY_NDISK020 rebalance power 0;
SQL> alter diskgroup DATA_MCRY_DG drop disk DATA_MCRY_NDISK021 rebalance power 0;
SQL> alter diskgroup DATA_MCRY_DG drop disk DATA_MCRY_NDISK022 rebalance power 0;
SQL> alter diskgroup DATA_MCRY_DG drop disk DATA_MCRY_NDISK023 rebalance power 0;
SQL> alter diskgroup DATA_MCRY_DG drop disk DATA_MCRY_NDISK024 rebalance power 0;
SQL> alter diskgroup DATA_MCRY_DG drop disk DATA_MCRY_NDISK025 rebalance power 0;
SQL> alter diskgroup DATA_MCRY_DG drop disk DATA_MCRY_NDISK026 rebalance power 0;
SQL> alter diskgroup DATA_MCRY_DG drop disk DATA_MCRY_NDISK027 rebalance power 0;
SQL> alter diskgroup DATA_MCRY_DG drop disk DATA_MCRY_NDISK028 rebalance power 0;
SQL> alter diskgroup DATA_MCRY_DG drop disk DATA_MCRY_NDISK029 rebalance power 0;
SQL> alter diskgroup DATA_MCRY_DG drop disk DATA_MCRY_NDISK030 rebalance power 0;
SQL> select d.group_number,g.name diskgroup_name,disk_number,header_status,d.state,path,d.name disk_name,d.failgroup,d.failgroup_type,d.os_mb,d.total_mb,d.free_mb
from v$asm_disk d left outer join v$asm_diskgroup g on (d.group_number=g.group_number) where d.path like '%DATA_MCRY%';
-- STATE 会变为 DROPPING
6.1、开启 rebalance
g CNSZ082275
su - grid (如果当前己经是grid了,就不用再切)
sqlplus / as sysasm
SQL> select g.name diskgroup_name,o.* from gv$asm_operation o,gv$asm_diskgroup g where o.group_number=g.group_number and o.inst_id=g.inst_id;
SQL> alter diskgroup DATA_MCRY_DG rebalance power 8;
SQL> select g.name diskgroup_name,o.* from gv$asm_operation o,gv$asm_diskgroup g where o.group_number=g.group_number and o.inst_id=g.inst_id; -- 查看 rebalance 进度
6.2、验证(两节点 v$asm_operation 都为空,HEADER_STATU 状态为 MEMBER,才视为正常)
g CNSZ082275
su - grid (如果当前己经是grid了,就不用再切)
sqlplus / as sysasm
SQL> select g.name diskgroup_name,o.* from gv$asm_operation o,gv$asm_diskgroup g where o.group_number=g.group_number and o.inst_id=g.inst_id; -- 为空,说明完成
SQL> select d.group_number,g.name diskgroup_name,disk_number,header_status,d.state,path,d.name disk_name,d.failgroup,d.failgroup_type,d.os_mb,d.total_mb,d.free_mb
from v$asm_disk d left outer join v$asm_diskgroup g on (d.group_number=g.group_number) where d.path like '%DATA_MCRY%';
-- 只有 2个 DATA_MCRY_NDISK001... 的磁盘 HEADER_STATU 状态为 MEMBER,2个被移除的磁盘状态为 FORMER
SQL> exit
/oracle_grid/grid/see_asm.sh DATA_MCRY_DG -- TOTAL_GB 要为 16T
g CNSZ082276
su - grid (如果当前己经是grid了,就不用再切)
sqlplus / as sysasm
SQL> select * from v$asm_operation; -- 要为空
SQL> select d.group_number,g.name diskgroup_name,disk_number,header_status,d.state,path,d.name disk_name,d.failgroup,d.failgroup_type,d.os_mb,d.total_mb,d.free_mb
from v$asm_disk d left outer join v$asm_diskgroup g on (d.group_number=g.group_number) where d.path like '%DATA_MCRY%';
-- 只有 2个 DATA_MCRY_NDISK001... 的磁盘 HEADER_STATU 状态为 MEMBER,2个被移除的磁盘状态为 FORMER
/oracle_grid/grid/see_asm.sh DATA_MCRY_DG -- TOTAL_GB 要为 16T
7、回滚
--附:应急、回滚方案(正常情况下无需操作,如有意外需要进行回滚,请先电话联系到 DA 和 老刘总才能进行这一步的操作)
#######see_asm.sh脚本#########################
#!/bin/bash
if [ $# -eq 1 ]
then
asm_diskgroup_name=$(echo $1 | tr '[a-z]' '[A-Z]')
SQL="select name asm_diskgroup_name,round(total_mb/1024,2) total_gb,round(free_mb/1024,2) free_gb,round(usable_file_mb/1024,2) usable_file_gb,round(usable_file_mb/total_mb*100,2) free_pct,round(100-(usable_file_mb/total_mb*100),2) used_pct from v\$asm_diskgroup where name like '%"${asm_diskgroup_name}"%' order by free_pct;"
else
SQL="select name asm_diskgroup_name,round(total_mb/1024,2) total_gb,round(free_mb/1024,2) free_gb,round(usable_file_mb/1024,2) usable_file_gb,round(usable_file_mb/total_mb*100,2) free_pct,round(100-(usable_file_mb/total_mb*100),2) used_pct from v\$asm_diskgroup order by free_pct;"
fi
sqlplus -S / as sysasm