ASM HANDS-ON TRAINING

Lab 13 ASM and Rman Crash, Restore and Recovery Scenarios
Alejandro Vargas | Principal Support Consultant Oracle Advanced Customer Services

INDEX Summary.......................................................................................................................................................................3 Setup Archivelog Mode.................................................................................................................................................3 Full Rman Backup.........................................................................................................................................................5 Enable change tracking file...........................................................................................................................................6 Make A Full Incremental Hot Backup............................................................................................................................6 Checking the Backup..................................................................................................................................................11 Crash Restore and Recovery Scenarios.....................................................................................................................13 System tablespace loss...............................................................................................................................................13 Restore And Recover System Tablespace.................................................................................................................14 User datafile loss.........................................................................................................................................................18 ....................................................................................................................................................................................21 Restore and Recover users tablespace......................................................................................................................21 Online redologs loss....................................................................................................................................................25 ....................................................................................................................................................................................27 Restore and Recover from Online Redolog loss.........................................................................................................27 Restore And Recover From Controlfile Loss..............................................................................................................38 Total Database Loss ..................................................................................................................................................42 Restore And Recover From Total Loss.......................................................................................................................44 Scripts..........................................................................................................................................................................52 backup-incr-lev0-plus-recover.rmn..............................................................................................................................52 1-system-tablespace-loss............................................................................................................................................54 1-restore-from-system-tablespace-loss.......................................................................................................................55 2-user-datafile-loss......................................................................................................................................................56 2-restore-from-user-datafile-loss.................................................................................................................................58 3-online-redolog-loss...................................................................................................................................................59 3-restore-and-recover-from-online-redo-loss..............................................................................................................61 4-restore-and-recover-from-controlfile-loss.................................................................................................................62 1/67

ASM HANDS-ON TRAINING
Lab 13 ASM and Rman Crash, Restore and Recovery Scenarios
5-total-database-loss...................................................................................................................................................63 5-restore-and-recover-from-total-database-loss.........................................................................................................65

2/67

ASM HANDS-ON TRAINING
Lab 13 ASM and Rman Crash, Restore and Recovery Scenarios
Alejandro Vargas | Principal Support Consultant Oracle Advanced Customer Services

Summary
On this Lab we will review the following crash and recovery scenarios, and we will implement some of them: • • • • • • • • • • System tablespace loss Recover system tablespace User datafile loss Recover users tablespace Online redo loss Recover from redo loss Controlfile loss Recover from controlfile loss Database loss Recover from total loss

Setup Archivelog Mode
The tests wil be done using archivelog mode and hot backups, then we will restart the database on archivelog mode. [oracle@asmxpt app]$ ora ------------ORACLE_BASE=/u01/app/oracle ORACLE_HOME=/u01/app/oracle/11g_db ORACLE_SID=sati11 ------------oracle 6462 1 0 09:58 ? oracle 8904 1 0 Feb12 ? 3/67

00:00:06 ora_smon_sati11 00:00:02 asm_smon_+ASM

Database closed.7. ORACLE instance started.0. All rights reserved.0 .Production With the Partitioning.7. Restore and Recovery Scenarios ------------oracle 8693 1 0 Feb12 ? LISTENER_ASMXPT -inherit ------------[oracle@asmxpt app]$ sql 00:00:18 /u01/app/oracle/11g_db/bin/tnslsnr SQL*Plus: Release 11. Connected to: Oracle Database 11g Enterprise Edition Release 11.0. SQL> startup mount. Database dismounted. Oracle. OLAP. ORACLE instance shut down.Production on Fri Feb 13 14:17:45 2009 Copyright (c) 1982. Database altered. SQL> alter database archivelog. 4/67 bytes bytes bytes bytes bytes . Total System Global Area 351522816 Fixed Size 1313344 Variable Size 268436928 Database Buffers 75497472 Redo Buffers 6275072 Database mounted.0 .ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash. Data Mining and Real Application Testing options SQL> shutdown immediate. 2008.1.1.

ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash. Data Mining and Real Application Testing options Full Rman Backup Having the database set on archivelog mode we will make a full backup to the flash recovery area SQL> show parameters recov NAME -----------------------------------db_recovery_file_dest db_recovery_file_dest_size recovery_parallelism TYPE ----------string big integer integer VALUE -----------------------------+FRADG 6048M 0 5/67 .0 .Production With the Partitioning.0.7. Restore and Recovery Scenarios SQL> alter database open.1. OLAP. SQL> archive log list Database log mode Automatic archival Archive destination Oldest online log sequence Next log sequence to archive Current log sequence Archive Mode Enabled USE_DB_RECOVERY_FILE_DEST 1 1 1 SQL> exit Disconnected from Oracle Database 11g Enterprise Edition Release 11. Database altered.

ALLOCATE CHANNEL disk2 DEVICE TYPE DISK FORMAT '+FRADG/%U'.-------------------------------------------------. Database altered.---------ENABLED +FRADG/sati11/changetracking/ctf. STATUS FILENAME BYTES ---------. SQL> ALTER DATABASE ENABLE BLOCK CHANGE TRACKING USING FILE '+fradg'.678750225 11599872 Make A Full Incremental Hot Backup This backlup script is intended to make a backup that will be automatically updated with the last changes each time the script is invoked. RECOVER COPY OF DATABASE WITH TAG 'INCREMENTAL_DAILY_UPDATED' . SQL> select * from v$BLOCK_CHANGE_TRACKING . The first time the script is called there is no level 0 backup to update so a full level 0 backup is created. The second time all changed blocks since the previous backup are backed up Every other execution the last incremental is applied to the backup and a new incremental is created RUN { ALLOCATE CHANNEL disk1 DEVICE TYPE DISK FORMAT '+FRADG/%U'. Restore and Recovery Scenarios Enable change tracking file To be able to make incremental backups that will quickly find only the changed blocks we will enable change tracking file.ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash.259. BACKUP INCREMENTAL LEVEL 1 FOR RECOVER OF COPY WITH TAG 'INCREMENTAL_DAILY_UPDATED' 6/67 .

ASM HANDS-ON TRAINING
Lab 13 ASM and Rman Crash, Restore and Recovery Scenarios
DATABASE FORMAT '+FRADG/%U' PLUS ARCHIVELOG FORMAT '+FRADG/%U'; }

[oracle@asmxpt ~]$ rman target / Recovery Manager: Release 11.1.0.7.0 - Production on Sat Feb 14 04:07:31 2009 Copyright (c) 1982, 2007, Oracle. All rights reserved.

connected to target database: SATI11 (DBID=124143874) RMAN> @backup-incr-lev0-plus-recover.rmn RMAN> RUN 2> { 3> ALLOCATE CHANNEL disk1 DEVICE TYPE DISK ; 4> ALLOCATE CHANNEL disk2 DEVICE TYPE DISK ; 5> ALLOCATE CHANNEL disk3 DEVICE TYPE DISK ; 6> ALLOCATE CHANNEL disk4 DEVICE TYPE DISK ; 7> RECOVER COPY OF DATABASE 8> WITH TAG 'INCREMENTAL_DAILY_UPDATED' ; 9> BACKUP INCREMENTAL LEVEL 1 10> FOR RECOVER OF COPY WITH TAG 'INCREMENTAL_DAILY_UPDATED' 11> DATABASE PLUS ARCHIVELOG ; 12> } using target database control file instead of recovery catalog allocated channel: disk1 channel disk1: SID=130 device type=DISK

7/67

ASM HANDS-ON TRAINING
Lab 13 ASM and Rman Crash, Restore and Recovery Scenarios
allocated channel: disk2 channel disk2: SID=131 device type=DISK allocated channel: disk3 channel disk3: SID=127 device type=DISK allocated channel: disk4 channel disk4: SID=128 device type=DISK Starting recover at no copy of datafile no copy of datafile no copy of datafile no copy of datafile Finished recover at 14-FEB-09 1 found to 2 found to 3 found to 4 found to 14-FEB-09 recover recover recover recover

Starting backup at 14-FEB-09 current log archived channel disk1: starting archived log backup set channel disk1: specifying archived log(s) in backup set input archived log thread=1 sequence=2 RECID=2 STAMP=678773278 channel disk1: starting piece 1 at 14-FEB-09 channel disk2: starting archived log backup set channel disk2: specifying archived log(s) in backup set input archived log thread=1 sequence=1 RECID=1 STAMP=678751046 channel disk2: starting piece 1 at 14-FEB-09 channel disk1: finished piece 1 at 14-FEB-09 piece handle=+FRADG/sati11/backupset/2009_02_14/annnf0_tag20090214t040758_0.260.678773279 tag=TAG20090214T040758 comment=NONE channel disk1: backup set complete, elapsed time: 00:00:16 8/67

ASM HANDS-ON TRAINING
Lab 13 ASM and Rman Crash, Restore and Recovery Scenarios
channel disk2: finished piece 1 at 14-FEB-09 piece handle=+FRADG/sati11/backupset/2009_02_14/annnf0_tag20090214t040758_0.261.678773281 tag=TAG20090214T040758 comment=NONE channel disk2: backup set complete, elapsed time: 00:00:16 Finished backup at 14-FEB-09 Starting backup at 14-FEB-09 no parent backup or copy of datafile 1 found no parent backup or copy of datafile 2 found no parent backup or copy of datafile 3 found no parent backup or copy of datafile 4 found channel disk1: starting datafile copy input datafile file number=00001 name=+DATADGNR/sati11/datafile/system.259.678706167 channel disk2: starting datafile copy input datafile file number=00002 name=+DATADGNR/sati11/datafile/sysaux.261.678706169 channel disk3: starting datafile copy input datafile file number=00003 name=+DATADGNR/sati11/datafile/undotbs1.260.678706169 channel disk4: starting datafile copy input datafile file number=00004 name=+DATADGNR/sati11/datafile/users.268.678706171 output file name=+FRADG/sati11/datafile/users.265.678773315 tag=INCREMENTAL_DAILY_UPDATED RECID=1 STAMP=678773321 channel disk4: datafile copy complete, elapsed time: 00:00:26 output file name=+FRADG/sati11/datafile/undotbs1.264.678773305 tag=INCREMENTAL_DAILY_UPDATED RECID=2 STAMP=678773528 channel disk3: datafile copy complete, elapsed time: 00:03:53 output file name=+FRADG/sati11/datafile/system.262.678773299 tag=INCREMENTAL_DAILY_UPDATED RECID=4 STAMP=678773597 channel disk1: datafile copy complete, elapsed time: 00:05:05 output file name=+FRADG/sati11/datafile/sysaux.263.678773303 tag=INCREMENTAL_DAILY_UPDATED RECID=3 STAMP=678773597 channel disk2: datafile copy complete, elapsed time: 00:05:05 9/67

Restore and Recovery Scenarios Finished backup at 14-FEB-09 Starting backup at 14-FEB-09 current log archived channel disk1: starting archived log backup set channel disk1: specifying archived log(s) in backup set input archived log thread=1 sequence=3 RECID=3 STAMP=678773603 channel disk1: starting piece 1 at 14-FEB-09 channel disk1: finished piece 1 at 14-FEB-09 piece handle=+FRADG/sati11/backupset/2009_02_14/annnf0_tag20090214t041323_0.678773605 tag=TAG20090214T041323 comment=NONE channel disk1: backup set complete.268.ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash. elapsed time: 00:00:01 Finished backup at 14-FEB-09 Starting Control File and SPFILE Autobackup at 14-FEB-09 piece handle=+FRADG/sati11/autobackup/2009_02_14/s_678773606.678773609 comment=NONE Finished Control File and SPFILE Autobackup at 14-FEB-09 released channel: disk1 released channel: disk2 released channel: disk3 released channel: disk4 RMAN> **end-of-file** 10/67 .267.

00K DISK 00:00:00 14-FEB-09 BP Key: 6 Status: AVAILABLE Compressed: NO Tag: TAG20090214T041323 Piece Name: +FRADG/sati11/backupset/2009_02_14/annnf0_tag20090214t041323_0. 11/67 .---------. Restore and Recovery Scenarios Checking the Backup RMAN> list backupset.--------.---.267.36M DISK 00:00:03 14-FEB-09 BP Key: 7 Status: AVAILABLE Compressed: NO Tag: TAG20090214T041326 Piece Name: +FRADG/sati11/autobackup/2009_02_14/s_678773606.-----------.678773609 SPFILE Included: Modification time: 14-FEB-09 SPFILE db_unique_name: SATI11 Control File Included: Ckp SCN: 613098 Ckp time: 14-FEB-09 RMAN> list archivelog all.--------3 612605 14-FEB-09 613088 14-FEB-09 BS Key Type LV Size Device Type Elapsed Time Completion Time ------.268.----------.---------. using target database control file instead of recovery catalog List of Backup Sets =================== BS Key Size Device Type Elapsed Time Completion Time ------.---------.----------.ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash.---------.-----------.-.--------------6 362.678773605 List Thrd ---1 of Archived Logs in backup set 6 Seq Low SCN Low Time Next SCN Next Time ------.--------------7 Full 9.

678773605 12/67 . Restore and Recovery Scenarios List of Archived Log Copies for database with db_unique_name SATI11 ===================================================================== Key Thrd Seq S Low Time ------.266.------.ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash.---.--------3 1 3 A 14-FEB-09 Name: +FRADG/sati11/archivelog/2009_02_14/thread_1_seq_3.678773603 Checking the backup directories on ASM [oracle@asmxpt sati11]$ asmcmd ls -l fradg/sati11/AUTOBACKUP/2009_02_14/ Type AUTOBACKUP Type BACKUPSET Redund UNPROT Striped COARSE Time FEB 14 04:00:00 Sys Y Name s_678773606.267.678773609 [oracle@asmxpt sati11]$ asmcmd ls -l fradg/sati11/BACKUPSET/2009_02_14/ Redund UNPROT Striped COARSE Time FEB 14 04:00:00 Sys Y Name annnf0_TAG20090214T041323_0..268.

259.ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash....268.678779875 UNDOTBS1.678706169 USERS. Restore and Recovery Scenarios Crash Restore and Recovery Scenarios System tablespace loss On the first part of this scenario we will crash the database and remove the system tablespace.260.259. State MOUNTED MOUNTED Type NORMAL EXTERN Rebal N N Sector 512 512 Block 4096 4096 AU 1048576 1048576 Total_MB 8188 6141 Free_MB 3970 4401 Req_mir_free_MB 2047 0 Usable_file_MB 961 4401 Offline_disks 0 0 Name DATADGNR/ FRADG/ SYSAUX./1-system-tablespace-loss Generating database crash .678779875 ORACLE instance shut down.678706171 State Type Rebal Sector Block AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB Offline_disks Name 13/67 . System Tablespace Datafile is +DATADGNR/sati11/datafile/system..678706169 SYSTEM. we will try to get the database up… The scenario is run using the script : /home/oracle/CRASH-AND-RECOVERY-SCRIPTS/1-system-tablespace-loss [oracle@asmxpt ~/CRASH-AND-RECOVERY-SCRIPTS]$ .261. Generating system tablespace loss .

see DBWR trace file ORA-01110: data file 1: '+DATADGNR/sati11/datafile/system.260.restore-from-system-tablespace-loss 14/67 . ORACLE instance started. Restore and Recovery Scenarios MOUNTED MOUNTED NORMAL EXTERN N N 512 512 4096 4096 1048576 1048576 8188 6141 5374 4401 2047 0 1663 4401 0 0 DATADGNR/ FRADG/ SYSAUX.678779875' Restore And Recover System Tablespace The restore of a lost system tablespace is simple if we have a good backup.ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash. The restore and recover from system tablespace loss is run using this script: /home/oracle/CRASH-AND-RECOVERY-SCRIPTS/1.261.678706171 Trying to restart the database after the crash ..678706169 UNDOTBS1. Recover database.259. ORA-01157: cannot identify/lock data file 1 . it is implemented running the following commands: • • Restore datafile 1.678706169 USERS.268.. Total System Global Area 351522816 bytes Fixed Size 1313344 bytes Variable Size 272631232 bytes Database Buffers 71303168 bytes Redo Buffers 6275072 bytes Database mounted.

All rights reserved. 2007.678779875 channel ORA_DISK_1: copied datafile copy of datafile 00001 output file name=+DATADGNR/sati11/datafile/system.7. Restore and Recovery Scenarios [oracle@asmxpt ~/CRASH-AND-RECOVERY-SCRIPTS]$ . connected to target database: SATI11 (DBID=124143874.1.ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash.Production on Sat Feb 14 06:30:37 2009 Copyright (c) 1982.259./1-restore-from-system-tablespace-loss Executing Command : RESTORE and RECOVER SYSTEM DATAFILE Recovery Manager: Release 11. Oracle.0 .262. not open) RMAN> Starting restore at 14-FEB-09 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=152 device type=DISK channel ORA_DISK_1: restoring datafile 00001 input datafile copy RECID=4 STAMP=678773597 file name=+FRADG/sati11/datafile/system.0.678781847 RECID=0 STAMP=0 Finished restore at 14-FEB-09 RMAN> Starting recover at 14-FEB-09 using channel ORA_DISK_1 starting media recovery 15/67 .259.678773299 destination for restore of datafile 00001: +DATADGNR/sati11/datafile/system.

All rights reserved.0 .ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash.266.0.Production With the Partitioning. OLAP.678779175 thread=1 sequence=4 media recovery complete.257. elapsed time: 00:00:06 Finished recover at 14-FEB-09 RMAN> database opened RMAN> Recovery Manager complete. 2008. Data Mining and Real Application Testing options 16/67 . Restore and Recovery Scenarios archived log for thread 1 with sequence 3 is already on disk as file +FRADG/sati11/archivelog/2009_02_14/thread_1_seq_3.1.678773603 archived log for thread 1 with sequence 4 is already on disk as file +FRADG/sati11/archivelog/2009_02_14/thread_1_seq_4.266.678779175 archived log for thread 1 with sequence 5 is already on disk as file +FRADG/sati11/archivelog/2009_02_14/thread_1_seq_5.678773603 thread=1 sequence=3 archived log file name=+FRADG/sati11/archivelog/2009_02_14/thread_1_seq_4. SQL*Plus: Release 11.260.261. Connected to: Oracle Database 11g Enterprise Edition Release 11.7.1.7.0 .261. Oracle.0.678779567 archived log for thread 1 with sequence 6 is already on disk as file +FRADG/sati11/archivelog/2009_02_14/thread_1_seq_6.678780233 archived log file name=+FRADG/sati11/archivelog/2009_02_14/thread_1_seq_3.Production on Sat Feb 14 06:33:11 2009 Copyright (c) 1982.

260.1.0 Production With the Partitioning.ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash.678706169 +DATADGNR/sati11/datafile/users. Data Mining and Real Application Testing options 17/67 . Restore and Recovery Scenarios SQL> FILE_NAME -------------------------------------------------------------------------------+DATADGNR/sati11/datafile/system.678706171 SQL> Disconnected from Oracle Database 11g Enterprise Edition Release 11.259.268.678781847 +DATADGNR/sati11/datafile/sysaux.678706169 +DATADGNR/sati11/datafile/undotbs1.7.261.0. OLAP.

Table created. User dropped. When the application is executed the following error is returned: ERROR at line 1: ORA-00376: file 4 cannot be read at this time ORA-01110: data file 4: '+DATADGNR/sati11/datafile/users.ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash. Restore and Recovery Scenarios User datafile loss On this scenario the database does not crash. Grant succeeded. 31 rows updated. User created.678706171' The scenario is run using this script : /home/oracle/CRASH-AND-RECOVERY-SCRIPTS/2-user-datafile-loss [oracle@asmxpt ~/CRASH-AND-RECOVERY-SCRIPTS]$ . we will set the users tablespace offline to be able to remove it from ASM. USERNAME -----------------------------CUSTOMER_SYSTEM CUSTOMER_SYS CUSTOMER_MGMT_VIEW 18/67 ../2-user-datafile-loss Preparing User Application . Commit complete.. Restore and recovery can also take place while the database is open.268.

ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash. 19/67 . Restore and Recovery Scenarios CUSTOMER_SYSMAN CUSTOMER_DBSNMP CUSTOMER_APPS CUSTOMER_OUTLN CUSTOMER_WKSYS CUSTOMER_OLAPSYS CUSTOMER_SI_INFORMTN_SCHEMA CUSTOMER_OWBSYS CUSTOMER_FLOWS_030000 CUSTOMER_ORDPLUGINS CUSTOMER_WKPROXY CUSTOMER_XDB CUSTOMER_ANONYMOUS CUSTOMER_CTXSYS CUSTOMER_WK_TEST CUSTOMER_WMSYS CUSTOMER_EXFSYS CUSTOMER_ORDSYS CUSTOMER_MDSYS CUSTOMER_FLOWS_FILES CUSTOMER_SPATIAL_WFS_ADMIN_USR CUSTOMER_SPATIAL_CSW_ADMIN_USR CUSTOMER_APEX_PUBLIC_USER CUSTOMER_DIP CUSTOMER_MDDATA CUSTOMER_XS$NULL CUSTOMER_TSMSYS CUSTOMER_ORACLE_OCM 31 rows selected.

Removing tablespace users datafile .678706169 USERS..268.268.. Setting tablespace users offline .678706169 SYSTEM. Restore and Recovery Scenarios Generating user datafile remove ..260.678706169 SYSTEM..261.261.259.259.678781847 UNDOTBS1. select username from apps.260. State MOUNTED MOUNTED Type NORMAL EXTERN Rebal N N Sector 512 512 Block 4096 4096 AU 1048576 1048576 Total_MB 8188 6141 Free_MB 3970 4374 Req_mir_free_MB 2047 0 Usable_file_MB 961 4374 Offline_disks 0 0 Name DATADGNR/ FRADG/ SYSAUX..678706171' 20/67 ..678706171 SYSAUX..ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash.customers * ERROR at line 1: ORA-00376: file 4 cannot be read at this time ORA-01110: data file 4: '+DATADGNR/sati11/datafile/users.678706169 State MOUNTED MOUNTED Type NORMAL EXTERN Rebal N N Sector 512 512 Block 4096 4096 AU 1048576 1048576 Total_MB 8188 6141 Free_MB 3982 4374 Req_mir_free_MB 2047 0 Usable_file_MB 967 4374 Offline_disks 0 0 Name DATADGNR/ FRADG/ Checking application ..678781847 UNDOTBS1. Tablespace altered.

/2-restore-from-user-datafile-loss Restoring and Recovering Tablespace Users . Restore and Recovery Scenarios Restore and Recover users tablespace To restore and recover the users tablespace it is not necessary to bring the database down.Production on Sat Feb 14 10:52:56 2009 Copyright (c) 1982. Alter tablespace users online This script was used to execute the restore and recovery process: /home/oracle/CRASH-AND-RECOVERY-SCRIPTS/2-restore-from-user-datafile-loss [oracle@asmxpt ~/CRASH-AND-RECOVERY-SCRIPTS]$ . Recovery Manager: Release 11.0 .. connected to target database: SATI11 (DBID=124143874) RMAN> Starting restore at 14-FEB-09 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=128 device type=DISK 21/67 . Oracle.0. Recover tablespace users..1. The commands used in this case from within Rman are: • • • Restore tablespace users. 2007.ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash.7. All rights reserved.

678773603 archived log for thread 1 with sequence 4 is already on disk as file +FRADG/sati11/archivelog/2009_02_14/thread_1_seq_4.678779175 thread=1 sequence=4 archived log file name=+FRADG/sati11/archivelog/2009_02_14/thread_1_seq_5.268.678779567 thread=1 sequence=5 22/67 .260.266.261.256.678773603 thread=1 sequence=3 archived log file name=+FRADG/sati11/archivelog/2009_02_14/thread_1_seq_4.265.678706171 channel ORA_DISK_1: copied datafile copy of datafile 00004 output file name=+DATADGNR/sati11/datafile/users.ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash. Restore and Recovery Scenarios channel ORA_DISK_1: restoring datafile 00004 input datafile copy RECID=1 STAMP=678773321 file name=+FRADG/sati11/datafile/users.268.678779567 archived log for thread 1 with sequence 6 is already on disk as file +FRADG/sati11/archivelog/2009_02_14/thread_1_seq_6.257.678780233 archived log for thread 1 with sequence 7 is already on disk as file +FRADG/sati11/archivelog/2009_02_14/thread_1_seq_7.260.678797585 RECID=0 STAMP=0 Finished restore at 14-FEB-09 RMAN> Starting recover at 14-FEB-09 using channel ORA_DISK_1 starting media recovery archived log for thread 1 with sequence 3 is already on disk as file +FRADG/sati11/archivelog/2009_02_14/thread_1_seq_3.261.266.678773315 destination for restore of datafile 00004: +DATADGNR/sati11/datafile/users.678781955 archived log file name=+FRADG/sati11/archivelog/2009_02_14/thread_1_seq_3.678779175 archived log for thread 1 with sequence 5 is already on disk as file +FRADG/sati11/archivelog/2009_02_14/thread_1_seq_5.

Restore and Recovery Scenarios media recovery complete. USERNAME -----------------------------CUSTOMER_SYSTEM CUSTOMER_SYS CUSTOMER_MGMT_VIEW CUSTOMER_SYSMAN CUSTOMER_DBSNMP CUSTOMER_APPS CUSTOMER_OUTLN CUSTOMER_WKSYS CUSTOMER_OLAPSYS CUSTOMER_SI_INFORMTN_SCHEMA CUSTOMER_OWBSYS CUSTOMER_FLOWS_030000 CUSTOMER_ORDPLUGINS CUSTOMER_WKPROXY CUSTOMER_XDB CUSTOMER_ANONYMOUS CUSTOMER_CTXSYS 23/67 . elapsed time: 00:00:05 Finished recover at 14-FEB-09 RMAN> sql statement: alter tablespace users online RMAN> Recovery Manager complete. Checking application ...ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash.

Restore and Recovery Scenarios CUSTOMER_WK_TEST CUSTOMER_WMSYS CUSTOMER_EXFSYS CUSTOMER_ORDSYS CUSTOMER_MDSYS CUSTOMER_FLOWS_FILES CUSTOMER_SPATIAL_WFS_ADMIN_USR CUSTOMER_SPATIAL_CSW_ADMIN_USR CUSTOMER_APEX_PUBLIC_USER CUSTOMER_DIP CUSTOMER_MDDATA CUSTOMER_XS$NULL CUSTOMER_TSMSYS CUSTOMER_ORACLE_OCM 31 rows selected.ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash. 24/67 .

678706585' This script was used to simulate the online redolog loss: /home/oracle/CRASH-AND-RECOVERY-SCRIPTS/3-online-redolog-loss [oracle@asmxpt ~/CRASH-AND-RECOVERY-SCRIPTS]$ .262.678706577 asmcmd rm +DATADGNR/sati11/onlinelog/group_1. asmcmd rm +DATADGNR/sati11/onlinelog/group_1.269.678706577' ORA-00312: online log 1 thread 1: '+DATADGNR/sati11/onlinelog/group_1. Restore and Recovery Scenarios Online redologs loss In this step we will simulate a database crash that led to loss the online redologs.. when the database is restarted the following errors are displayed: ORA-00313: open failed for members of log group 1 of thread 1 ORA-00312: online log 1 thread 1: '+DATADGNR/sati11/onlinelog/group_1./3-online-redolog-loss Generating database crash .269.262.ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash..678706585 Database log mode Automatic archival Archive destination Oldest online log sequence Next log sequence to archive Current log sequence SEQUENCE# 25/67 Archive Mode Enabled USE_DB_RECOVERY_FILE_DEST 7 9 9 .

.---------.269. ORACLE instance shut down. Restore and Recovery Scenarios ---------8 GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM ---------.262. Database dismounted.------------.---------------. ORACLE instance started... ORA-00313: open failed for members of log group 1 of thread 1 ORA-00312: online log 1 thread 1: '+DATADGNR/sati11/onlinelog/group_1.--. Total System Global Area 351522816 bytes Fixed Size 1313344 bytes Variable Size 272631232 bytes Database Buffers 71303168 bytes Redo Buffers 6275072 bytes Database mounted. Removing online redo log group .--------1 1 7 52428800 2 YES INACTIVE 676896 14-FEB-09 2 1 8 52428800 2 YES INACTIVE 708745 14-FEB-09 3 1 9 52428800 2 NO CURRENT 747092 14-FEB-09 Database closed.. Starting database after the crash .ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash.---------.---------.678706585' 26/67 .---------.678706577' ORA-00312: online log 1 thread 1: '+DATADGNR/sati11/onlinelog/group_1.

.7. connected to target database: SATI11 (DBID=124143874. The script will request the sequence # to recover using the until sequence clause.Production on Sat Feb 14 18:40:08 2009 Copyright (c) 1982. 8 Recovery Manager: Release 11. not open) RMAN> database is already started RMAN> Starting restore at 14-FEB-09 using target database control file instead of recovery catalog 27/67 .log [oracle@asmxpt ~/CRASH-AND-RECOVERY-SCRIPTS]$ ..0 . When a redolog is missing a full database restore must be done.0. Restore and Recovery Scenarios Restore and Recover from Online Redolog loss In this step we perform the restore and recovery of the database when online redologs are missing. This sequence can be obtained from the database alert.1. All rights reserved./3-restore-and-recover-from-online-redo-loss Executing Full Database Restore .. Please check the last archived sequence of the database. 2007..ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash. Oracle. please enter sequence number to restore to .

678773305 destination for restore of datafile 00003: +DATADGNR/sati11/datafile/undotbs1.260.678773303 destination for restore of datafile 00002: +DATADGNR/sati11/datafile/sysaux.ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash.260.261.268.678797585 channel ORA_DISK_1: copied datafile copy of datafile 00004 output file name=+DATADGNR/sati11/datafile/users.678706169 channel ORA_DISK_1: copied datafile copy of datafile 00002 output file name=+DATADGNR/sati11/datafile/sysaux.678773299 destination for restore of datafile 00001: +DATADGNR/sati11/datafile/system.678706169 RECID=0 STAMP=0 channel ORA_DISK_1: restoring datafile 00004 input datafile copy RECID=1 STAMP=678773321 file name=+FRADG/sati11/datafile/users.264.259.678773315 destination for restore of datafile 00004: +DATADGNR/sati11/datafile/users.263.261.678781847 RECID=0 STAMP=0 channel ORA_DISK_1: restoring datafile 00002 input datafile copy RECID=3 STAMP=678773597 file name=+FRADG/sati11/datafile/sysaux.265.262.678706169 channel ORA_DISK_1: copied datafile copy of datafile 00003 output file name=+DATADGNR/sati11/datafile/undotbs1.259.678706169 RECID=0 STAMP=0 channel ORA_DISK_1: restoring datafile 00003 input datafile copy RECID=2 STAMP=678773528 file name=+FRADG/sati11/datafile/undotbs1.268.678781847 channel ORA_DISK_1: copied datafile copy of datafile 00001 output file name=+DATADGNR/sati11/datafile/system. Restore and Recovery Scenarios allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=145 device type=DISK channel ORA_DISK_1: restoring datafile 00001 input datafile copy RECID=4 STAMP=678773597 file name=+FRADG/sati11/datafile/system.678797585 RECID=0 STAMP=0 Finished restore at 14-FEB-09 RMAN> 28/67 .

elapsed time: 00:00:19 Finished recover at 14-FEB-09 RMAN> database opened 29/67 .257.266.678779567 thread=1 sequence=5 archived log file name=+FRADG/sati11/archivelog/2009_02_14/thread_1_seq_6.678779175 archived log for thread 1 with sequence 5 is already on disk as file +FRADG/sati11/archivelog/2009_02_14/thread_1_seq_5.678773603 thread=1 sequence=3 archived log file name=+FRADG/sati11/archivelog/2009_02_14/thread_1_seq_4.ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash.257. Restore and Recovery Scenarios Starting recover at 14-FEB-09 using channel ORA_DISK_1 starting media recovery archived log for thread 1 with sequence 3 is already on disk as file +FRADG/sati11/archivelog/2009_02_14/thread_1_seq_3.678779567 archived log for thread 1 with sequence 6 is already on disk as file +FRADG/sati11/archivelog/2009_02_14/thread_1_seq_6.260.261.678773603 archived log for thread 1 with sequence 4 is already on disk as file +FRADG/sati11/archivelog/2009_02_14/thread_1_seq_4.256.678780233 thread=1 sequence=6 archived log file name=+FRADG/sati11/archivelog/2009_02_14/thread_1_seq_7.256.678780233 archived log for thread 1 with sequence 7 is already on disk as file +FRADG/sati11/archivelog/2009_02_14/thread_1_seq_7.678779175 thread=1 sequence=4 archived log file name=+FRADG/sati11/archivelog/2009_02_14/thread_1_seq_5.266.678781955 thread=1 sequence=7 media recovery complete.260.678781955 archived log file name=+FRADG/sati11/archivelog/2009_02_14/thread_1_seq_3.261.

Data Mining and Real Application Testing options SQL> SQL> SQL> GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC ---------. Restore and Recovery Scenarios RMAN> Recovery Manager complete. All rights reserved. Checking Database after online redolog loss and database restore and recover SQL*Plus: Release 11.0.------------.Production on Sat Feb 14 18:46:31 2009 Copyright (c) 1982.7.0.678825917 +DATADGNR/sati11/onlinelog/group_2.---------.262. Connected to: Oracle Database 11g Enterprise Edition Release 11. 2008.1. Oracle.--------CURRENT 708746 14-FEB-09 UNUSED 0 UNUSED 0 SQL> MEMBER -----------------------------------------------+DATADGNR/sati11/onlinelog/group_1.678825931 +DATADGNR/sati11/onlinelog/group_3.263.678825925 +DATADGNR/sati11/onlinelog/group_2.--1 1 1 52428800 2 NO 2 1 0 52428800 2 YES 3 1 0 52428800 2 YES STATUS FIRST_CHANGE# FIRST_TIM ---------------.269.264.---------.266.7.0 .265.0 .678825939 +DATADGNR/sati11/onlinelog/group_3.678825943 6 rows selected.ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash.Production With the Partitioning. 30/67 . OLAP.1.---------.---------.678825909 +DATADGNR/sati11/onlinelog/group_1.

7. 31/67 .rmn RMAN> # backup-incr-lev0-plus-recover.0. 12> ALLOCATE CHANNEL disk3 DEVICE TYPE DISK .1. OLAP.1.0 Production With the Partitioning. Data Mining and Real Application Testing options Before starting the new scenario we will make a full backup [oracle@asmxpt ~/RMAN-SCRIPTS]$ rman target / Recovery Manager: Release 11.0 . 13> ALLOCATE CHANNEL disk4 DEVICE TYPE DISK . 14> RECOVER COPY OF DATABASE 15> WITH TAG 'INCREMENTAL_DAILY_UPDATED' .rmn 2> # --------------------------------3> # This script on the first run makes a level 0 backup if no one exists 4> # In the second run run makes an incremental level 1 5> # On every subsequent run: 6> # 1) Applies the previous level 1 to the backupset and 7> # 2) Creates a new level 1 backup 8> RUN 9> { 10> ALLOCATE CHANNEL disk1 DEVICE TYPE DISK .ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash. Oracle. All rights reserved. connected to target database: SATI11 (DBID=124143874) RMAN> @backup-incr-lev0-plus-recover. 2007.0. 11> ALLOCATE CHANNEL disk2 DEVICE TYPE DISK .7.Production on Sat Feb 14 18:53:36 2009 Copyright (c) 1982. Restore and Recovery Scenarios SQL> Disconnected from Oracle Database 11g Enterprise Edition Release 11.

Restore and Recovery Scenarios 16> BACKUP INCREMENTAL LEVEL 1 17> FOR RECOVER OF COPY WITH TAG 'INCREMENTAL_DAILY_UPDATED' 18> DATABASE PLUS ARCHIVELOG .ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash. 19> } using target database control file instead of recovery catalog allocated channel: disk1 channel disk1: SID=126 device type=DISK allocated channel: disk2 channel disk2: SID=132 device type=DISK allocated channel: disk3 channel disk3: SID=127 device type=DISK allocated channel: disk4 channel disk4: SID=133 device type=DISK Starting recover at 14-FEB-09 Finished recover at 14-FEB-09 Starting backup at 14-FEB-09 current log archived channel disk1: starting archived log backup set channel disk1: specifying archived log(s) in backup set input archived log thread=1 sequence=8 RECID=8 STAMP=678818997 channel disk1: starting piece 1 at 14-FEB-09 channel disk2: starting archived log backup set channel disk2: specifying archived log(s) in backup set input archived log thread=1 sequence=7 RECID=7 STAMP=678781959 channel disk2: starting piece 1 at 14-FEB-09 32/67 .

elapsed time: 00:00:11 channel disk2: starting archived log backup set channel disk2: specifying archived log(s) in backup set input archived log thread=1 sequence=9 RECID=9 STAMP=678825907 channel disk2: starting piece 1 at 14-FEB-09 channel disk3: finished piece 1 at 14-FEB-09 piece handle=+FRADG/sati11/backupset/2009_02_14/annnf0_tag20090214t185354_0. Restore and Recovery Scenarios channel disk3: starting archived log backup set channel disk3: specifying archived log(s) in backup set input archived log thread=1 sequence=3 RECID=3 STAMP=678773603 input archived log thread=1 sequence=4 RECID=4 STAMP=678779177 channel disk3: starting piece 1 at 14-FEB-09 channel disk4: starting archived log backup set channel disk4: specifying archived log(s) in backup set input archived log thread=1 sequence=1 RECID=10 STAMP=678826433 channel disk4: starting piece 1 at 14-FEB-09 channel disk1: finished piece 1 at 14-FEB-09 piece handle=+FRADG/sati11/backupset/2009_02_14/annnf0_tag20090214t185354_0. elapsed time: 00:00:11 channel disk1: starting archived log backup set channel disk1: specifying archived log(s) in backup set input archived log thread=1 sequence=5 RECID=5 STAMP=678779566 input archived log thread=1 sequence=6 RECID=6 STAMP=678780233 channel disk1: starting piece 1 at 14-FEB-09 channel disk2: finished piece 1 at 14-FEB-09 piece handle=+FRADG/sati11/backupset/2009_02_14/annnf0_tag20090214t185354_0.274.678826435 tag=TAG20090214T185354 comment=NONE channel disk1: backup set complete.678826437 tag=TAG20090214T185354 comment=NONE channel disk2: backup set complete.678826441 tag=TAG20090214T185354 comment=NONE channel disk3: backup set complete.ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash.275.276. elapsed time: 00:00:08 channel disk4: finished piece 1 at 14-FEB-09 33/67 .

678781847 channel disk1: starting piece 1 at 14-FEB-09 channel disk2: starting incremental level 1 datafile backup set channel disk2: specifying datafile(s) in backup set input datafile file number=00002 name=+DATADGNR/sati11/datafile/sysaux.279.678826449 tag=TAG20090214T185354 comment=NONE channel disk2: backup set complete.277.678826447 tag=TAG20090214T185354 comment=NONE channel disk1: backup set complete.678826443 tag=TAG20090214T185354 comment=NONE channel disk4: backup set complete.259.678797585 channel disk4: starting piece 1 at 14-FEB-09 channel disk4: finished piece 1 at 14-FEB-09 34/67 . elapsed time: 00:00:07 channel disk1: finished piece 1 at 14-FEB-09 piece handle=+FRADG/sati11/backupset/2009_02_14/annnf0_tag20090214t185354_0. Restore and Recovery Scenarios piece handle=+FRADG/sati11/backupset/2009_02_14/annnf0_tag20090214t185354_0. elapsed time: 00:00:01 channel disk2: finished piece 1 at 14-FEB-09 piece handle=+FRADG/sati11/backupset/2009_02_14/annnf0_tag20090214t185354_0.ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash. elapsed time: 00:00:02 Finished backup at 14-FEB-09 Starting backup at 14-FEB-09 channel disk1: starting incremental level 1 datafile backup set channel disk1: specifying datafile(s) in backup set input datafile file number=00001 name=+DATADGNR/sati11/datafile/system.278.261.678706169 channel disk3: starting piece 1 at 14-FEB-09 channel disk4: starting incremental level 1 datafile backup set channel disk4: specifying datafile(s) in backup set input datafile file number=00004 name=+DATADGNR/sati11/datafile/users.678706169 channel disk2: starting piece 1 at 14-FEB-09 channel disk3: starting incremental level 1 datafile backup set channel disk3: specifying datafile(s) in backup set input datafile file number=00003 name=+DATADGNR/sati11/datafile/undotbs1.260.268.

282. elapsed time: 00:02:20 channel disk2: finished piece 1 at 14-FEB-09 piece handle=+FRADG/sati11/backupset/2009_02_14/nnndn1_tag20090214t185410_0.ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash.678826597 comment=NONE 35/67 .678826459 tag=TAG20090214T185410 comment=NONE channel disk2: backup set complete.285.283.281.678826453 tag=TAG20090214T185410 comment=NONE channel disk1: backup set complete. elapsed time: 00:02:20 Finished backup at 14-FEB-09 Starting backup at 14-FEB-09 current log archived channel disk1: starting archived log backup set channel disk1: specifying archived log(s) in backup set input archived log thread=1 sequence=2 RECID=11 STAMP=678826592 channel disk1: starting piece 1 at 14-FEB-09 channel disk1: finished piece 1 at 14-FEB-09 piece handle=+FRADG/sati11/backupset/2009_02_14/annnf0_tag20090214t185632_0.280. elapsed time: 00:02:10 channel disk1: finished piece 1 at 14-FEB-09 piece handle=+FRADG/sati11/backupset/2009_02_14/nnndn1_tag20090214t185410_0.286.678826473 tag=TAG20090214T185410 comment=NONE channel disk3: backup set complete. Restore and Recovery Scenarios piece handle=+FRADG/sati11/backupset/2009_02_14/nnndn1_tag20090214t185410_0.678826593 tag=TAG20090214T185632 comment=NONE channel disk1: backup set complete. elapsed time: 00:01:05 channel disk3: finished piece 1 at 14-FEB-09 piece handle=+FRADG/sati11/backupset/2009_02_14/nnndn1_tag20090214t185410_0.678826477 tag=TAG20090214T185410 comment=NONE channel disk4: backup set complete. elapsed time: 00:00:01 Finished backup at 14-FEB-09 Starting Control File and SPFILE Autobackup at 14-FEB-09 piece handle=+FRADG/sati11/autobackup/2009_02_14/s_678826594.

rmn 3> **end-of-file** 36/67 .ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash. Restore and Recovery Scenarios Finished released released released released Control File and SPFILE Autobackup at 14-FEB-09 channel: disk1 channel: disk2 channel: disk3 channel: disk4 RMAN> # ------------------------------------2> # eof backup-incr-lev0-plus-recover.

ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash.678705845 Database closed.. oracle 4146 1 0 11:35 ? Removing controlfiles . Checking databases up . when the database is restarted the following error is displayed: ORA-00205: error in identifying control file.. Total System Global Area 37/67 351522816 bytes 00:00:00 asm_smon_+ASM .. asmcmd rm +DATADGNR/sati11/controlfile/current.678705843 asmcmd rm +DATADGNR/sati11/controlfile/current. Restore and Recovery Scenarios Controlfile loss This scenario simulates a database crash that lead to a missing controlfile... check alert log for more info The script that generates this scenario is this: /home/oracle/CRASH-AND-RECOVERY-SCRIPTS/4-controlfile-loss [oracle@asmxpt ~/CRASH-AND-RECOVERY-SCRIPTS]$ . ORACLE instance shut down.. ORACLE instance started. Database dismounted.257... Starting databases after the crash ./4-controlfile-loss Generating database crash .258.

2007.0 .lst. Restore and Recovery Scenarios Fixed Size 1313344 bytes Variable Size 272631232 bytes Database Buffers 71303168 bytes Redo Buffers 6275072 bytes ORA-00205: error in identifying control file. connected to target database: SATI11 (not mounted) 38/67 . check alert log for more info Restore And Recover From Controlfile Loss To restore the controlfile we will need to set the DBID on rman./4-restore-and-recover-from-controlfileloss Executing Controlfile Restore Please check the DBID on this file: -rw-r--r-.lst. You can check the DBID of the database on the backup directory we used to build this database: /u01/app/oracle/BACKUP/sati11/dbid_124143874.Production on Sat Feb 14 20:27:53 2009 Copyright (c) 1982.ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash.gz [oracle@asmxpt ~/CRASH-AND-RECOVERY-SCRIPTS]$ . Oracle. All rights reserved.gz please enter DBID number of the database to restore the controlfile 124143874 Recovery Manager: Release 11.1 oracle dba 104 Feb 12 18:08 /u01/app/oracle/BACKUP/sati11/dbid_124143874.7.1.0.

Restore and Recovery Scenarios RMAN> executing command: SET DBID RMAN> database is already started RMAN> Starting restore at 14-FEB-09 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=156 device type=DISK recovery area destination: +FRADG database name (or database unique name) used for search: SATI11 channel ORA_DISK_1: AUTOBACKUP +fradg/SATI11/AUTOBACKUP/2009_02_14/s_678826594.258.286.678826597 channel ORA_DISK_1: control file restore from AUTOBACKUP complete output file name=+DATADGNR/sati11/controlfile/current.257.ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash.678826597 found in the recovery area channel ORA_DISK_1: looking for AUTOBACKUP on day: 20090214 channel ORA_DISK_1: restoring control file from AUTOBACKUP +fradg/SATI11/AUTOBACKUP/2009_02_14/s_678826594.678832085 Finished restore at 14-FEB-09 RMAN> database mounted released channel: ORA_DISK_1 RMAN> Starting recover at 14-FEB-09 Starting implicit crosscheck backup at 14-FEB-09 39/67 .286.678832083 output file name=+DATADGNR/sati11/controlfile/current.

Restore and Recovery Scenarios allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=156 device type=DISK Crosschecked 16 objects Finished implicit crosscheck backup at 14-FEB-09 Starting implicit crosscheck copy at 14-FEB-09 using channel ORA_DISK_1 Crosschecked 4 objects Finished implicit crosscheck copy at 14-FEB-09 searching for all files in the recovery area cataloging files.678825909 thread=1 sequence=4 40/67 .287.. cataloging done List of Cataloged Files ======================= File Name: +fradg/SATI11/ARCHIVELOG/2009_02_14/thread_1_seq_3.678825909 archived log file name=+FRADG/sati11/archivelog/2009_02_14/thread_1_seq_3.678828379 archived log for thread 1 with sequence 4 is already on disk as file +DATADGNR/sati11/onlinelog/group_1..287.262.ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash.678828379 File Name: +fradg/SATI11/AUTOBACKUP/2009_02_14/s_678826594.678828379 thread=1 sequence=3 archived log file name=+DATADGNR/sati11/onlinelog/group_1.287.678826597 using channel ORA_DISK_1 starting media recovery archived log for thread 1 with sequence 3 is already on disk as file +FRADG/sati11/archivelog/2009_02_14/thread_1_seq_3.286.262.

678832083 +DATADGNR/sati11/controlfile/current.257. Checking Database after controlfile loss and restore SQL> select name from v$controlfile. Restore and Recovery Scenarios media recovery complete.ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash. NAME -------------------------------------------------------------------------------+DATADGNR/sati11/controlfile/current.258.678832085 41/67 . elapsed time: 00:00:01 Finished recover at 14-FEB-09 RMAN> database opened RMAN> Recovery Manager complete.

ora ORA-15056: additional error message ORA-17503: ksfdopn:DGOpenFile05 Failed to open file +DATADGNR/sati11/spfilesati11.ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash. DBID and last archived sequences.678882005 Piece Name: +FRADG/sati11/autobackup/2009_02_15/s_678884598. Keep this information at hand to be used during the restore steps.ora ORA-17503: ksfdopn:2 Failed to open file +DATADGNR/sati11/spfilesati11.. controlfiles. all online logs. This information includes controlfile and spfile backupset pieces. that is required to recover the database. Before the crash is simulated a complete set of information.261.271. Restore and Recovery Scenarios Total Database Loss This scenario simulates a crash that lead to the complete loss of the database.ora' ORA-17503: ksfdopn:2 Failed to open file +DATADGNR/sati11/spfilesati11./5-total-database-loss Generating database crash . is displayed on the screen. the whole database directory is removed the ASM diskgroup DATADG.ora ORA-15173: entry 'sati11' does not exist in directory '/' ORA-06512: at line 4 This is the script that executes this scenario: /home/oracle/CRASH-AND-RECOVERY-SCRIPTS/5-total-database-loss [oracle@asmxpt ~/CRASH-AND-RECOVERY-SCRIPTS]$ .. spfile and datafiles are lost.678884601 42/67 . After the crash when trying to open the database the following errors are returned: ORA-01078: failure in processing system parameters ORA-01565: error in identifying file '+DATADGNR/sati11/spfilesati11. Piece Name: +FRADG/sati11/autobackup/2009_02_15/s_678882001.

ORACLE instance shut down. Restore and Recovery Scenarios Database log mode Automatic archival Archive destination Oldest online log sequence Next log sequence to archive Current log sequence NAME DBID --------...--.---------. Database dismounted.---------SATI11 124143874 SEQUENCE# ---------4 GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM ---------.---------------. 43/67 .---------.------------.--------1 1 4 52428800 2 YES INACTIVE 774566 15-FEB-09 2 1 5 52428800 2 NO CURRENT 774613 15-FEB-09 3 1 3 52428800 2 YES INACTIVE 772993 15-FEB-09 Archive Mode Enabled USE_DB_RECOVERY_FILE_DEST 3 5 5 asmcmd rm -rf +DATADGNR/SATI11 Database closed. Preparing to crash and burn database .ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash.---------.---------.

Restore and Recovery Scenarios Starting database after the crash .. Listing directories on ASM Data diskgroup Listing directories on ASM Flash Recovery Area diskgroup ARCHIVELOG/ AUTOBACKUP/ BACKUPSET/ CHANGETRACKING/ DATAFILE/ Restore And Recover From Total Loss On this step we will restore the database after a total loss.ora ksfdopn:2 Failed to open file +DATADGNR/sati11/spfilesati11. 44/67 ....ora' ksfdopn:2 Failed to open file +DATADGNR/sati11/spfilesati11.ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash. ORA-01078: ORA-01565: ORA-17503: ORA-15056: ORA-17503: ORA-17503: ORA-15173: ORA-06512: failure in processing system parameters error in identifying file '+DATADGNR/sati11/spfilesati11.ora entry 'sati11' does not exist in directory '/' at line 4 Evaluating damage .ora additional error message ksfdopn:DGOpenFile05 Failed to open file +DATADGNR/sati11/spfilesati11.

271. once the spfile is restored the instance is restarted in nomount mode using the spfile. In this case we will restore only the metadata for diskgroup DATADGNR. Once the controlfile is successfully restored the database can be restored. recovered and opened with the resetlogs option.. This is the script that implement the restore and recovery steps: /home/oracle/CRASH-AND-RECOVERY-SCRIPTS/5-restore-and-recover-from-total-database-loss [oracle@asmxpt ~/CRASH-AND-RECOVERY-SCRIPTS]$ . 4 Please enter the full path to the controlfile and spfile backup to restore them +FRADG/sati11/autobackup/2009_02_15/s_678884598. The instance is initially started by rman with dummy parameters..678884601 Rebuilding Database Directory on Data Diskgroup 45/67 . please enter sequence number to restore to . Restore and Recovery Scenarios In first term we will recreate the database metadata using the backup we used before to build the database.ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash. this is necessary to be able to restore the spfile and controlfile on the first stages of the restore procedure./5-restore-and-recover-from-total-database-loss Executing Controlfile Restore please enter DBID number of the database to restore the controlfile 124143874 Please check the last archived sequence of the database.

Restore and Recovery Scenarios Current Diskgroup being restored: DATADGNR System template TEMPFILE modified! System template DUMPSET modified! System template XTRANSPORT modified! System template DATAFILE modified! System template ARCHIVELOG modified! System template ASM_STALE modified! System template CHANGETRACKING modified! System template ONLINELOG modified! System template FLASHBACK modified! System template AUTOBACKUP modified! System template DATAGUARDCONFIG modified! System template PARAMETERFILE modified! System template CONTROLFILE modified! System template BACKUPSET modified! Directory +DATADGNR/SATI11 re-created! Directory +DATADGNR/SATI11/CONTROLFILE re-created! Directory +DATADGNR/SATI11/ONLINELOG re-created! Directory +DATADGNR/SATI11/DATAFILE re-created! Directory +DATADGNR/SATI11/TEMPFILE re-created! Directory +DATADGNR/SATI11/PARAMETERFILE re-created! SATI11/ Executing Rman Restore and Recovery Steps Recovery Manager: Release 11.Production on Sun Feb 15 11:19:08 2009 Copyright (c) 1982. Oracle.ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash. All rights reserved.1. 46/67 .0.0 .7. 2007.

ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash. Restore and Recovery Scenarios connected to target database (not started) RMAN> executing command: SET DBID RMAN> startup failed: ORA-01078: failure in processing system parameters ORA-01565: error in identifying file '+DATADGNR/sati11/spfilesati11.ora ORA-15056: additional error message ORA-17503: ksfdopn:DGOpenFile05 Failed to open file +DATADGNR/sati11/spfilesati11.ora ORA-17503: ksfdopn:2 Failed to open file +DATADGNR/sati11/spfilesati11.ora' ORA-17503: ksfdopn:2 Failed to open file +DATADGNR/sati11/spfilesati11.ora ORA-15173: entry 'spfilesati11.ora' does not exist in directory 'sati11' ORA-06512: at line 4 starting Oracle instance without parameter file for retrieval of spfile Oracle instance started Total System Global Area Fixed Size Variable Size Database Buffers Redo Buffers 159019008 bytes 1312052 67111628 88080384 2514944 bytes bytes bytes bytes RMAN> Starting restore at 15-FEB-09 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=98 device type=DISK 47/67 .

678884601 channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete Finished restore at 15-FEB-09 RMAN> Oracle instance started Total System Global Area Fixed Size Variable Size Database Buffers Redo Buffers 351522816 bytes 1313344 272631232 71303168 6275072 bytes bytes bytes bytes RMAN> Starting restore at 15-FEB-09 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=152 device type=DISK channel ORA_DISK_1: restoring control file channel ORA_DISK_1: restore complete. Restore and Recovery Scenarios channel ORA_DISK_1: restoring spfile from AUTOBACKUP +FRADG/sati11/autobackup/2009_02_15/s_678884598.257.265.271.ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash.678885579 output file name=+DATADGNR/sati11/controlfile/current. elapsed time: 00:00:09 output file name=+DATADGNR/sati11/controlfile/current.678885581 Finished restore at 15-FEB-09 RMAN> database mounted released channel: ORA_DISK_1 RMAN> 2> 3> 4> 5> 48/67 .

260..ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash.678884601 using channel ORA_DISK_1 channel ORA_DISK_1: restoring datafile 00001 input datafile copy RECID=19 STAMP=678881962 file name=+FRADG/sati11/datafile/system.678773299 destination for restore of datafile 00001: +DATADGNR/sati11/datafile/system.271. cataloging done List of Cataloged Files ======================= File Name: +fradg/SATI11/AUTOBACKUP/2009_02_15/s_678884598.262.259.678885603 RECID=0 STAMP=0 channel ORA_DISK_1: restoring datafile 00002 49/67 .678880089 channel ORA_DISK_1: copied datafile copy of datafile 00001 output file name=+DATADGNR/sati11/datafile/system.. Restore and Recovery Scenarios executing command: SET until clause Starting restore at 15-FEB-09 Starting implicit crosscheck backup at 15-FEB-09 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=152 device type=DISK Crosschecked 10 objects Finished implicit crosscheck backup at 15-FEB-09 Starting implicit crosscheck copy at 15-FEB-09 using channel ORA_DISK_1 Crosschecked 4 objects Finished implicit crosscheck copy at 15-FEB-09 searching for all files in the recovery area cataloging files.

678773305 destination for restore of datafile 00003: +DATADGNR/sati11/datafile/undotbs1.261.265.263.264.678880295 channel ORA_DISK_1: copied datafile copy of datafile 00004 output file name=+DATADGNR/sati11/datafile/users.279.261.678881853 archived log for thread 1 with sequence 3 is already on disk as file +FRADG/sati11/archivelog/2009_02_15/thread_1_seq_3.678773303 destination for restore of datafile 00002: +DATADGNR/sati11/datafile/sysaux.678880175 channel ORA_DISK_1: copied datafile copy of datafile 00002 output file name=+DATADGNR/sati11/datafile/sysaux.258. Restore and Recovery Scenarios input datafile copy RECID=20 STAMP=678881962 file name=+FRADG/sati11/datafile/sysaux.678881853 thread=1 sequence=2 50/67 .678885763 RECID=0 STAMP=0 channel ORA_DISK_1: restoring datafile 00004 input datafile copy RECID=17 STAMP=678881962 file name=+FRADG/sati11/datafile/users.678885807 RECID=0 STAMP=0 Finished restore at 15-FEB-09 Starting recover at 15-FEB-09 using channel ORA_DISK_1 starting media recovery archived log for thread 1 with sequence 2 is already on disk as file +FRADG/sati11/archivelog/2009_02_15/thread_1_seq_2.279.260.259.265.678881967 archived log file name=+FRADG/sati11/archivelog/2009_02_15/thread_1_seq_2.ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash.678880249 channel ORA_DISK_1: copied datafile copy of datafile 00003 output file name=+DATADGNR/sati11/datafile/undotbs1.678885687 RECID=0 STAMP=0 channel ORA_DISK_1: restoring datafile 00003 input datafile copy RECID=18 STAMP=678881962 file name=+FRADG/sati11/datafile/undotbs1.678773315 destination for restore of datafile 00004: +DATADGNR/sati11/datafile/users.276.

1.7.--1 1 1 52428800 2 NO 2 1 0 52428800 2 YES 3 1 0 52428800 2 YES STATUS FIRST_CHANGE# FIRST_TIM ---------------. 2008. Checking Database after total database loss.ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash.1.0 .276. Data Mining and Real Application Testing options SQL> SQL> GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC ---------.7. Connected to: Oracle Database 11g Enterprise Edition Release 11.0.--------CURRENT 774567 15-FEB-09 UNUSED 0 UNUSED 0 51/67 .0.------------.Production on Sun Feb 15 11:26:37 2009 Copyright (c) 1982.678881967 thread=1 sequence=3 media recovery complete. OLAP.---------.---------. restore and recover SQL*Plus: Release 11. All rights reserved. elapsed time: 00:00:08 Finished recover at 15-FEB-09 RMAN> database opened RMAN> Recovery Manager complete.Production With the Partitioning. Restore and Recovery Scenarios archived log file name=+FRADG/sati11/archivelog/2009_02_15/thread_1_seq_3. Oracle.---------.0 .---------.

Data Mining and Real Application Testing options Scripts backup-incr-lev0-plus-recover.7.0 Production With the Partitioning.ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash.678885829 +DATADGNR/sati11/onlinelog/group_2.678885917 +DATADGNR/sati11/onlinelog/group_3.678885845 +DATADGNR/sati11/onlinelog/group_3.262.678885823 +DATADGNR/sati11/onlinelog/group_1.263.268.264. OLAP.266.rmn # # # # # # backup-incr-lev0-plus-recover.rmn --------------------------------This script on the first run makes a level 0 backup if no one exists In the second run run makes an incremental level 1 On every subsequent run: 1) Applies the previous level 1 to the backupset and 52/67 .1. Restore and Recovery Scenarios MEMBER -------------------------------------------------------------------------------+DATADGNR/sati11/onlinelog/group_1.269.0.678885927 NAME --------SATI11 SQL> Disconnected from Oracle Database 11g Enterprise Edition Release 11.678885837 +DATADGNR/sati11/onlinelog/group_2.

rmn 53/67 . ALLOCATE CHANNEL disk2 DEVICE TYPE DISK . BACKUP INCREMENTAL LEVEL 1 FOR RECOVER OF COPY WITH TAG 'INCREMENTAL_DAILY_UPDATED' DATABASE PLUS ARCHIVELOG . ALLOCATE CHANNEL disk3 DEVICE TYPE DISK . RECOVER COPY OF DATABASE WITH TAG 'INCREMENTAL_DAILY_UPDATED' .ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash. } # ------------------------------------# eof backup-incr-lev0-plus-recover. ALLOCATE CHANNEL disk4 DEVICE TYPE DISK . Restore and Recovery Scenarios # 2) Creates a new level 1 backup RUN { ALLOCATE CHANNEL disk1 DEVICE TYPE DISK .

echo set v_rmf=`echo 'select file_name from dba_data_files where file_id=1.. eof sqlplus -s $dbauser/$dbapwd as sysdba <<eof startup eof echo echo Generating system tablespace loss .ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash. echo asmcmd lsdg echo asmcmd ls +datadgnr/sati11/datafile echo asmcmd rm -rf $v_rmf echo asmcmd lsdg echo 54/67 ./set-environment echo Generating database crash .. Restore and Recovery Scenarios 1-system-tablespace-loss #!/bin/tcsh # 1-system-tablespace-loss # -----------------------# This script crash the database and removes the system tablespace # ---------------------------------------------------------------source ...' | sqlplus -s / as sysdba | grep system` setenv ORACLE_SID +ASM sqlplus -s $dbauser/$dbapwd as sysdba <<eof shutdown abort.

. recover datafile 1. alter database open.. Restore and Recovery Scenarios asmcmd ls +datadgnr/sati11/datafile echo echo Trying to restart the database after the crash . eof sqlplus $dbauser/$dbapwd@$datadb as sysdba <<eof 55/67 ./set-environment echo echo Executing Command : RESTORE and RECOVER SYSTEM DATAFILE echo setenv ORACLE_SID $datadb rman TARGET / <<eof restore datafile 1.ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash. echo sqlplus -s $dbauser/$dbapwd@$datadb as sysdba <<eof startup eof exit # ---------------------------------------------------------------# eof 1-system-tablespace-loss 1-restore-from-system-tablespace-loss #!/bin/tcsh # 1-restore-from-system-tablespace-loss # -----------------------# This script restore the system tablespace after a crash that removed the system tablespace # ------------------------------------------------------------------------------source .

56/67 ... select from it # to simulate an application running # ----------------------------------------------------------------------------sqlplus -s $dbauser/$dbapwd@$datadb as sysdba <<eof drop user apps cascade.ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash. echo # connect to the database. grant dba to apps. create user a apps and a dummy table. update customers set username='CUSTOMER_'||USERNAME. Restore and Recovery Scenarios select file_name from dba_data_files./set-environment setenv ORACLE_SID $datadb clear echo echo Preparing User Application . create user apps identified by apps default tablespace users temporary tablespace temp. exit eof exit # ---------------------------------------------------------------# eof 1-restore-from-system-tablespace-loss 2-user-datafile-loss #!/bin/tcsh # 2-user-datafile-loss # -----------------------# This script create an application user then removes the user tablespace datafile # -------------------------------------------------------------------------------source . connect apps/apps@$datadb create table customers as select * from dba_users.

. echo setenv ORACLE_SID +ASM asmcmd lsdg echo asmcmd ls +datadgnr/$datadb/datafile echo asmcmd rm -rf $v_rmf echo asmcmd ls +datadgnr/$datadb/datafile 57/67 . echo sqlplus -s $dbauser/$dbapwd@$datadb as sysdba <<eof alter tablespace users offline. Restore and Recovery Scenarios commit. exit eof # generate the command to remove user's tablespace datafile from ASM # the tablespace is set offline to be able to remove it # ------------------------------------------------------------------echo echo Generating user datafile remove ." | sqlplus -s / as sysdba | grep users` echo echo Setting tablespace users offline ..... eof # removing the users tablespace datafile from ASM # ----------------------------------------------echo echo Removing tablespace users datafile . select username from customers. echo set v_rmf=`echo "select file_name from dba_data_files where tablespace_name='USERS'..ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash.

.. echo setenv ORACLE_SID $datadb rman TARGET / <<eof restore tablespace users.. 58/67 .. sql 'alter tablespace users online' . exit eof # ---------------------------------------------------------------# eof 2-user-datafile-loss 2-restore-from-user-datafile-loss #!/bin/tcsh # 2-restore-from-user-datafile-loss # -----------------------# This script restore the users tablespace while the database is still running # ---------------------------------------------------------------------------source .customers./set-environment echo Restoring and Recovering Tablespace Users .ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash.. recover tablespace users. eof echo echo Checking application .. echo sqlplus -s $dbauser/$dbapwd@$datadb as sysdba <<eof select username from apps. Restore and Recovery Scenarios echo asmcmd lsdg echo echo Checking application .

. Restore and Recovery Scenarios echo sqlplus -s $dbauser/$dbapwd@$datadb as sysdba <<eof select username from apps./set-environment echo Generating database crash .customers.ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash. echo set v_logf=v\$logfile set v_logs=v\$log set v_logh=v\$log_history setenv ORACLE_SID $datadb # Create a script to remove online redologs # ----------------------------------------sqlplus -s / as sysdba <<eof set pages 50000 lines 120 echo off head off veri off flush off ti off spool rmonlnlog.. exit eof exit # ---------------------------------------------------------------# eof 2-restore-from-user-datafile-loss 3-online-redolog-loss #!/bin/tcsh # 3-online-redolog-loss # --------------------# This script simulates a database crash followed by the loss of all # online redologs # -----------------------------------------------------------------source .sh select 'asmcmd rm '||member||'' from $v_logf where group#=1. 59/67 .

sh rm .. echo setenv ORACLE_SID $datadb sqlplus -s / as sysdba <<eof STARTUP eof # ------------------------# eof 3-online-redolog-loss 60/67 .sh ../rmonlnlog.log archive log list. spool off SHUTDOWN IMMEDIATE.ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash. Restore and Recovery Scenarios spool off set echo on head on veri on set pages 50000 lines 120 spool redolog_miss_status-before_crash./rmonlnlog. eof echo # Remove online redologs # ---------------------echo Removing online redo log group . select SEQUENCE# from $v_logh where FIRST_TIME=(select max(FIRST_TIME) from $v_logh).sh # Restart the database after the simulated crash and check the error # -----------------------------------------------------------------echo echo Starting database after the crash ./rmonlnlog.. select * from $v_logs.. echo setenv ORACLE_SID +ASM chmod 700 .

echo echo Please check the last archived sequence of the database. RESTORE DATABASE... 61/67 .. select member from $v_logf. echo please enter sequence number to restore to . set v_seq = $< echo setenv ORACLE_SID $datadb rman TARGET / <<eof STARTUP MOUNT.. Restore and Recovery Scenarios 3-restore-and-recover-from-online-redo-loss #!/bin/tcsh # 3-restore-and-recover-from-online-redo-loss # ------------------------------------------# this script executes the procedure to restore and recover the database # after the loss of all online logs # ---------------------------------------------------------------------source . ALTER DATABASE OPEN RESETLOGS./set-environment set v_logf=v\$logfile set v_log=v\$log echo Executing Full Database Restore . RECOVER DATABASE UNTIL SEQUENCE $v_seq THREAD 1.ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash. eof echo Checking Database after online redolog loss and database restore and recover echo sqlplus / as sysdba <<eof set pages 50000 lines 200 col member for a55 select * from $v_log.

ALTER DATABASE OPEN RESETLOGS. ALTER DATABASE MOUNT.lst. RESTORE CONTROLFILE FROM AUTOBACKUP. RECOVER DATABASE.ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash./set-environment echo Executing Controlfile Restore echo echo Please check the DBID on this file: echo ls -l /u01/app/oracle/BACKUP/sati11/dbid_124143874.gz echo echo please enter DBID number of the database to restore the controlfile set v_dbid = $< echo # -----------------------------------------------# Restore the controlfile and recover the database # -----------------------------------------------setenv ORACLE_SID $datadb rman TARGET / <<eof SET DBID $v_dbid. 62/67 . STARTUP NOMOUNT. Restore and Recovery Scenarios exit eof # ----------------------------------------------# eof 3-restore-and-recover-from-online-redo-loss 4-restore-and-recover-from-controlfile-loss #!/bin/tcsh # 4-restore-and-recover-from-controlfile-loss # ------------------------------------------source .

/set-environment echo Generating database crash .ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash.. Restore and Recovery Scenarios eof set v_ctlf=v\$controlfile echo Checking Database after controlfile loss and restore echo sqlplus / as sysdba <<eof set pages 50000 lines 120 select name from $v_ctlf . echo set v_par=v\$parameter set v_dba=v\$database set v_logs=v\$log set v_logh=v\$log_history setenv ORACLE_SID $datadb # -----------------------------------------------# Get backup to restore controlfile and spfile # -----------------------------------------------echo rman target / @listbk | grep autobackup echo 63/67 . exit eof # ----------------------------------------------# eof 4-restore-and-recover-from-controlfile-loss 5-total-database-loss #!/bin/tcsh # 5-total-database-loss # --------------------source ..

select SEQUENCE# from $v_logh where FIRST_TIME=(select max(FIRST_TIME) from $v_logh). 64/67 .sh select 'asmcmd rm -rf '||a.. select * from $v_logs.log archive log list.name from $v_par a.ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash. spool off set pages 50000 lines 120 echo off head off veri off flush off ti off spool rmdbs.value||'/'||b. Restore and Recovery Scenarios # -----------------------------------------------# Get actual sequence before crashing the database # -----------------------------------------------sqlplus -s / as sysdba <<eof set echo on head on veri on pages 50000 lines 120 spool redolog_miss_status-before_crash../rmdbs.sh rm rmdbs.sh . spool off SHUTDOWN IMMEDIATE eof # -----------------------------------------------# Remove all database files # -----------------------------------------------echo echo Preparing to crash and burn database . echo setenv ORACLE_SID +ASM chmod 700 .. select name./rmdbs. $v_dba b where a.dbid from $v_dba.sh echo echo Starting database after the crash ..name='db_create_file_dest'.

/set-environment 65/67 .. Restore and Recovery Scenarios echo setenv ORACLE_SID $datadb sqlplus -s / as sysdba <<eof STARTUP eof # -----------------------------------------------# Evaluate damage # -----------------------------------------------echo echo Evaluating damage . echo echo Listing directories on ASM Data diskgroup echo setenv ORACLE_SID +ASM asmcmd ls +datadgnr echo echo Listing directories on ASM Flash Recovery Area diskgroup echo asmcmd ls +fradg/$datadb echo # ------------------------# eof 5-total-database-loss 5-restore-and-recover-from-total-database-loss #!/bin/tcsh # -------------------------------------------------# 5-restore-and-recover-from-total-database-loss # -------------------------------------------------source ..ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash.

set v_seq = $< echo echo Please enter the full path to the controlfile and spfile backup to restore them echo set v_bkp = $< echo # ----------------------------------# Rebuild database diskgroup metadata # ----------------------------------echo Rebuilding Database Directory on Data Diskgroup echo setenv ORACLE_SID +ASM asmcmd md_restore -b /u01/app/oracle/BACKUP/sati11/asm_md_backup -t nodg -g DATADGNR asmcmd ls +DATADGNR echo echo Executing Rman Restore and Recovery Steps echo # ----------------------------------# Restore the database # ----------------------------------setenv ORACLE_SID $datadb rman TARGET / <<eof SET DBID $v_dbid. echo please enter sequence number to restore to .ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash. Restore and Recovery Scenarios echo Executing Controlfile Restore echo echo please enter DBID number of the database to restore the controlfile set v_dbid = $< echo echo Please check the last archived sequence of the database. STARTUP NOMOUNT. 66/67 ...

eof set v_log=v\$log set v_logf=v\$logfile set v_dbs=v\$database echo Checking Database after total database loss. recover database.ASM HANDS-ON TRAINING Lab 13 ASM and Rman Crash. } ALTER DATABASE OPEN RESETLOGS. Restore and Recovery Scenarios RESTORE SPFILE FROM '$v_bkp'. restore database. elect member from $v_logf. run { set until sequence $v_seq thread 1. ALTER DATABASE MOUNT. RESTORE CONTROLFILE FROM '$v_bkp'. select name from $v_dbs. exit eof # -------------------------------------------------# eof 5-restore-and-recover-from-total-database-loss End of Lab 13 67/67 . restore and recover echo # -------------------------------------------# Check the database after restore and recover # -------------------------------------------sqlplus $dbauser/$dbapwd@$datadb as sysdba <<eof set pages 50000 lines 120 select * from $v_log. STARTUP FORCE NOMOUNT.

Sign up to vote on this title
UsefulNot useful

Master Your Semester with Scribd & The New York Times

Special offer: Get 4 months of Scribd and The New York Times for just $1.87 per week!

Master Your Semester with a Special Offer from Scribd & The New York Times