Some adminitration script for RAC % ASM

liuf19780320發表於2012-02-01
dd if=/dev/zero of=/dev/VG_Disk1/LV_data01 bs=8192
dd if=/dev/zero of=/dev/VG_Disk2/LV_data02 bs=8192
dd if=/dev/zero of=/dev/VG_Disk2/LV_data03 bs=8192
/etc/init.d/oracleasm deletedisk DISK01
/etc/init.d/oracleasm deletedisk DISK02
/etc/init.d/oracleasm deletedisk DISK03
/etc/init.d/oracleasm createdisk DISK01 /dev/VG_Disk1/LV_data01
/etc/init.d/oracleasm createdisk DISK02 /dev/VG_Disk2/LV_data02
/etc/init.d/oracleasm createdisk DISK03 /dev/VG_Disk2/LV_data03
/etc/init.d/oracleasm querydisk DISK01
/etc/init.d/oracleasm querydisk DISK02
/etc/init.d/oracleasm querydisk DISK03

/PROD/oracle/product/grid/SL/perl/bin/perl -I/PROD/oracle/product/grid/SL/perl/lib -I/PROD/oracle/product/grid/SL/crs/install /PROD/oracle/product/grid/SL/crs/install/rootcrs.pl -deconfig -force

sh /PROD/oracle/product/grid/SL/root.sh
/PROD/oracle/product/grid/SL/perl/bin/perl -I/PROD/oracle/product/grid/SL/perl/lib -I/PROD/oracle/product/grid/SL/crs/install /PROD/oracle/product/grid/SL/crs/install/roothas.pl

/etc/init.d/init.ohasd disable


export ORACLE_SID=+ASM
export ORACLE_BASE=/PROD/oracle/product/grid
export ORACLE_HOME=/PROD/oracle/product/grid/SL
export PATH=$ORACLE_HOME/bin:$PATH:.
crsctl start has
crsctl status resource -t
srvctl status service -d FUSION
srvctl stop database -d FUSION
crsctl stop resource ora.asm
srvctl remove database -d FUSION
srvctl start diskgroup -g [-n ""]
srvctl stop diskgroup -g [-n ""] [-f]
srvctl status diskgroup -g [-n ""] [-a]
srvctl enable diskgroup -g [-n ""]
srvctl disable diskgroup -g [-n ""]
srvctl remove diskgroup -g [-f]
srvctl remove diskgroup -g data03
srvctl remove diskgroup -g data02
srvctl remove diskgroup -g data01
srvctl remove asm -f
srvctl add asm -p $ORACLE_HOME/dbs/init+ASM.ora

sqlplus '/as sysasm'

DROP DISKGROUP DATA01 INCLUDING CONTENTS;
DROP DISKGROUP DATA02 INCLUDING CONTENTS;
DROP DISKGROUP DATA03 INCLUDING CONTENTS;
CREATE DISKGROUP DATA01 EXTERNAL REDUNDANCY DISK 'ORCL:DISK01';
CREATE DISKGROUP DATA02 EXTERNAL REDUNDANCY DISK 'ORCL:DISK02';
CREATE DISKGROUP DATA03 EXTERNAL REDUNDANCY DISK 'ORCL:DISK03';

export ORACLE_SID=FUSION
export ORACLE_BASE=/PROD/oracle/product/fsdb
export ORACLE_HOME=/PROD/oracle/product/fsdb/SL
export PATH=$ORACLE_HOME/bin:$PATH:.

Convert DB from NO ASM to ASM:

set serveroutput on;
declare
cursor df01 is select name from v$datafile where name like '%/PROD/oradata/data01/%';
cursor df02 is select name from v$datafile where name like '%/PROD/oradata/data02/%';
cursor df03 is select name from v$datafile where name like '%/PROD/oradata/data03/%';
begin
dbms_output.put_line('run');
dbms_output.put_line('{');
for dfrec in df01 loop
dbms_output.put_line('set newname for datafile ' || '''' || dfrec.name || '''' || ' to ' || '''+' || 'DATA01' || dfrec.name || '''' || ';');
end loop;
for dfrec in df02 loop
dbms_output.put_line('set newname for datafile ' || '''' || dfrec.name || '''' || ' to ' || '''+' || 'DATA02' || dfrec.name || '''' || ';');
end loop;
for dfrec in df03 loop
dbms_output.put_line('set newname for datafile ' || '''' || dfrec.name || '''' || ' to ' || '''+' || 'DATA03' || dfrec.name || '''' || ';');
end loop;
dbms_output.put_line('restore database;');
dbms_output.put_line('switch datafile all;');
dbms_output.put_line('}');
end;
[@more@]

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/35496/viewspace-1057240/,如需轉載,請註明出處,否則將追究法律責任。

相關文章