用于check repair DISKGROUP用
[@more@]#!/bin/sh
export ORACLE_BASE=/oracle/app
export ORA_ASM_HOME=${ORACLE_BASE}/11gR1/db
export ORACLE_SID=+ASM24
function repair_dg(){
sqlstr="alter diskgroup $2 check DISK "
x=`expr $1 * 8`
i=`expr $x - 8`
if [ $1 -eq 9 ];then
j=70
else
j=`expr $x - 1`
fi
while ((i<=j))
do
if [ $i -eq $j ];then
flag=`printf '%04d' $i`
sqlstr1=$sqlstr" DATA_"$flag
((i=i+1))
continue
fi
flag=`printf '%04d' $i`
sqlstr=$sqlstr" $2_"$flag","
((i=i+1))
done
echo $sqlstr1" repair;" >/tmp/repair_dg_$1.sql
$ORA_ASM_HOME/bin/sqlplus -S "/ as sysdba" <select 'begin: '||to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from dual;
SELECT SYS_CONTEXT ('userenv', 'sid') from dual;
--@/tmp/repair_dg_$1.sql;
select 'end: '||to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from dual;
exit
EOD
}
repair_dg 1 DATA &
repair_dg 2 DATA &
repair_dg 3 DATA &
repair_dg 4 DATA &
repair_dg 5 DATA &
repair_dg 6 DATA &
repair_dg 7 DATA &
repair_dg 8 DATA &
repair_dg 9 DATA &
解释一下:
1,data这个diskgroup下有71个disk (DATA_0000--DATA_0070)
2,要求用9个并发同时执行check repair操作,
alter diskgroup check disk repair会做哪些事,在asm guide/sql reference中有说明
3,脚本设置成前面8个脚本每个检查8个disk,最后一个检查7个,共计8*8+7=71个
4,注意必须连asm instance才能执行
5,被check的dg必须mount
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/94384/viewspace-1028911/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/94384/viewspace-1028911/