Blog Archive

I am an Oracle database Consultant My Areas of Interests being High availabilty,Infrastructure consulting and Performance Tuning. I am posting Topics of My interests Related to these Technology Areas. Do post Your comments as well.

Sunday 11 February 2007

Simulating Recovery On ASM -Oracle 10g

Test Cases for Simulation of recovery on Oracle Database 10g (ASM)

Test CASE 1

$ sqlplus dwsadm/
Partitioning, OLAP and Data Mining options
SQL> create table steve4 tablespace t as select * from steve;
Table created.
SQL> connect / as sysdbaConnected.
SQL> select substr(FILE_NAME,1,40),file_id from DBA_DATA_FILES order by 2;
SUBSTR(FILE_NAME,1,40) FILE_ID---------------------------------------- ----------+DBDG/dws/datafile/system.261.570971303 1+DBDG/dws/datafile/undotbs.262.570971331 2...+DBDG/dws/datafile/oam_data.528.57098196 264+DBDG/dws/datafile/oam_index.529.5709819 265+DBDG/dws/datafile/mmdata.530.570981965 266+DBDG/dws/datafile/t.533.572622185 269 <==
269 rows selected.
SQL> shutdown immediate;Database closed.Database dismounted.ORACLE instance shut down.
Then, connected to the ASM instance:
SQL> alter diskgroup DBDG drop file '+DBDG/dws/datafile/t.533.572622185';
Diskgroup altered.
Back to the Oracle Instance:
SQL> startup
ORACLE instance started.
Total System Global Area 2147483648 bytes
Fixed Size 1303536 bytes
Variable Size 516168720 bytes
Database Buffers 1627389952 bytes
Redo Buffers 2621440 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 269 - see DBWR trace fileORA-01110: data file 269: '+DBDG/dws/datafile/t.533.572622185'
$ rman target /
RMAN> restore datafile '+DBDG/dws/datafile/t.533.572622185';
Starting restore at 26-OCT-05using target database controlfile instead of recovery catalogallocated channel: ORA_DISK_1channel ORA_DISK_1: sid=554 devtype=DISKallocated channel: ORA_DISK_2channel ORA_DISK_2: sid=553 devtype=DISK
channel ORA_DISK_1: restoring datafile 00269input datafilecopy recid=6433 stamp=572607429 filename=+FLASHDG/dws/datafile/t.640.572607427destination for restore of datafile 00269: +DBDG/dws/datafile/t.533.572622185channel ORA_DISK_1: copied datafilecopy of datafile 00269output filename=+DBDG/dws/datafile/t.533.572690975 recid=7778 stamp=572690976Finished restore at 26-OCT-05
Note the Name of the Output File Highlighted above , this file name might not correspond to the original file name due to the file naming conventions in ASM
RMAN> recover datafile '+DBDG/dws/datafile/t.533.572690975';
Starting recover at 26-OCT-05using channel ORA_DISK_1using channel ORA_DISK_2channel ORA_DISK_1: starting incremental datafile backupset restorechannel ORA_DISK_1: specifying datafile(s) to restore from backup setdestination for restore of datafile 00269: +DBDG/dws/datafile/t.533.572690975channel ORA_DISK_1: restored backup piece 1piece handle=+FLASHDG/dws/backupset/2005_10_25/nnndn1_tag20051025t133032_0.642.572621443 tag=TAG20051025T133032channel ORA_DISK_1: restore complete
starting media recovery
archive log thread 1 sequence 1 is ......archive log filename=+FLASHDG/dws/arc...media recovery completeFinished recover at 26-OCT-05

SQL> alter database open;
Database altered.
SQL> connect dwsadm/Connected.
SQL> select count(*) from steve4;
COUNT(*)----------534287

Test CASE 2

Setup DetailsUnixOracle 10g Using ASMTwo ASM disk groupsDBDG ==> for the databaseFLASHDG ==> for Backup and recovery related filesRMAN as backupsRunning Incrementally updated image copiesUsing block change tracking
A 'dd' Command can be to wipe out the entire entire DBDG disk for the database This will cause the oracle database to shutdown. In order to recover, you will have to

1. recreate the disk group
2. startup nomount
3. set DBID
4. restore controlfile from autobackup;
5. restore database until scn
6. recover database until scn

You will need to disable the change tracking option when the database is mounted.
SQL> startup mount
SQL> alter database disable block change tracking;
Perform the recovery and once finished and the databse is opened, you can enable it again:
SQL> alter database enable block change tracking;

No comments: