Tuesday, April 17, 2012

Disaster recovery using RMAN(losing both spfile & control file)

Hi ,
Here i had simulated a situation by manually deleting the spfile & control files from ASM location(we need to shutdown database in order to be able to delete control files)

Before this we need to check for the RMAN backup details.(backup sets)

The steps i followed are as below
========================


[oracle@localhost ~]$ ps -fe|grep pmon
grid      4157     1  0 16:18 ?        00:00:00 asm_pmon_+ASM
oracle    4405     1  0 16:25 ?        00:00:01 ora_pmon_LABDBSBY
oracle   13004 12464  0 20:46 pts/5    00:00:00 grep pmon
[oracle@localhost ~]$ export ORACLE_SID=labdb
[oracle@localhost ~]$ rman target /

Recovery Manager: Release 11.2.0.1.0 - Production on Mon Apr 16 20:51:16 2012

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database (not started)

RMAN> set dbid=1788478824

executing command: SET DBID

RMAN> startup force nomount

startup failed: ORA-01078: failure in processing system parameters
ORA-01565: error in identifying file '+DATA/labdb/spfilelabdb.ora'
ORA-17503: ksfdopn:2 Failed to open file +DATA/labdb/spfilelabdb.ora
ORA-15056: additional error message
ORA-17503: ksfdopn:DGOpenFile05 Failed to open file +DATA/labdb/spfilelabdb.ora
ORA-17503: ksfdopn:2 Failed to open file +DATA/labdb/spfilelabdb.ora
ORA-15173: entry 'spfilelabdb.ora' does not exist in directory 'labdb'
ORA-06512: at line 4

starting Oracle instance without parameter file for retrieval of spfile
Oracle instance started

Total System Global Area     159019008 bytes

Fixed Size                     1335192 bytes
Variable Size                 75497576 bytes
Database Buffers              79691776 bytes
Redo Buffers                   2494464 bytes

RMAN> restore spfile from autobackup;

Starting restore at 16-APR-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=18 device type=DISK

channel ORA_DISK_1: looking for AUTOBACKUP on day: 20120416
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20120415
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20120414
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20120413
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20120412
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20120411
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20120410
channel ORA_DISK_1: no AUTOBACKUP in 7 days found
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 04/16/2012 21:11:30
RMAN-06172: no AUTOBACKUP found or specified handle is not a valid copy or piece

RMAN> restore spfile to '+DATA/LABDB/spfilelabdb.ora' from '+DATA/labdb/autobackup/2012_04_16/s_780771691.600.780771707';

Starting restore at 16-APR-12
using channel ORA_DISK_1

channel ORA_DISK_1: restoring spfile from AUTOBACKUP +DATA/labdb/autobackup/2012_04_16/s_780771691.600.780771707
channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete
Finished restore at 16-APR-12

RMAN> shutdown immediate

Oracle instance shut down

RMAN> startup force nomount;

Oracle instance started

Total System Global Area     803500032 bytes

Fixed Size                     1339516 bytes
Variable Size                222302084 bytes
Database Buffers             574619648 bytes
Redo Buffers                   5238784 bytes

RMAN> restore controlfile from autobackup;

Starting restore at 16-APR-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=24 device type=DISK

recovery area destination: +DATA
database name (or database unique name) used for search: LABDB
channel ORA_DISK_1: AUTOBACKUP +data/LABDB/AUTOBACKUP/2012_04_16/s_780771691.600.780771707 found in the recovery area
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20120416
channel ORA_DISK_1: restoring control file from AUTOBACKUP +data/LABDB/AUTOBACKUP/2012_04_16/s_780771691.600.780771707
channel ORA_DISK_1: control file restore from AUTOBACKUP complete
output file name=+DATA/labdb/controlfile/current.260.780787841
Finished restore at 16-APR-12

RMAN> alter database mount;

database mounted
released channel: ORA_DISK_1

RMAN> restore database;

Starting restore at 16-APR-12
Starting implicit crosscheck backup at 16-APR-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=29 device type=DISK
Crosschecked 4 objects
Finished implicit crosscheck backup at 16-APR-12

Starting implicit crosscheck copy at 16-APR-12
using channel ORA_DISK_1
Finished implicit crosscheck copy at 16-APR-12

searching for all files in the recovery area
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: +data/LABDB/AUTOBACKUP/2012_04_16/s_780771691.600.780771707
File Name: +data/LABDB/ARCHIVELOG/2012_04_16/thread_1_seq_211.602.780771917
File Name: +data/LABDB/ARCHIVELOG/2012_04_16/thread_1_seq_212.603.780772319
File Name: +data/LABDB/ARCHIVELOG/2012_04_16/thread_1_seq_213.606.780772735
File Name: +data/LABDB/ARCHIVELOG/2012_04_16/thread_1_seq_214.610.780773129
File Name: +data/LABDB/ARCHIVELOG/2012_04_16/thread_1_seq_215.612.780774801
File Name: +data/LABDB/ARCHIVELOG/2012_04_16/thread_1_seq_216.613.780774867
File Name: +data/LABDB/ARCHIVELOG/2012_04_16/thread_1_seq_217.616.780775293
File Name: +data/LABDB/ARCHIVELOG/2012_04_16/thread_1_seq_218.617.780775679
File Name: +data/LABDB/ARCHIVELOG/2012_04_16/thread_1_seq_219.620.780776059
File Name: +data/LABDB/ARCHIVELOG/2012_04_16/thread_1_seq_220.622.780776441
File Name: +data/LABDB/ARCHIVELOG/2012_04_16/thread_1_seq_221.623.780776827
File Name: +data/LABDB/ARCHIVELOG/2012_04_16/thread_1_seq_222.625.780777205
File Name: +data/LABDB/ARCHIVELOG/2012_04_16/thread_1_seq_223.628.780777587
File Name: +data/LABDB/ARCHIVELOG/2012_04_16/thread_1_seq_224.630.780777965
File Name: +data/LABDB/ARCHIVELOG/2012_04_16/thread_1_seq_225.631.780778341
File Name: +data/LABDB/ARCHIVELOG/2012_04_16/thread_1_seq_226.634.780778727
File Name: +data/LABDB/ARCHIVELOG/2012_04_16/thread_1_seq_227.635.780779109
File Name: +data/LABDB/ARCHIVELOG/2012_04_16/thread_1_seq_228.638.780779499
File Name: +data/LABDB/ARCHIVELOG/2012_04_16/thread_1_seq_229.640.780779879
File Name: +data/LABDB/ARCHIVELOG/2012_04_16/thread_1_seq_230.641.780780261
File Name: +data/LABDB/ARCHIVELOG/2012_04_16/thread_1_seq_231.643.780780649
File Name: +data/LABDB/ARCHIVELOG/2012_04_16/thread_1_seq_232.646.780781035
File Name: +data/LABDB/ARCHIVELOG/2012_04_16/thread_1_seq_233.647.780781419
File Name: +data/LABDB/ARCHIVELOG/2012_04_16/thread_1_seq_234.650.780781805
File Name: +data/LABDB/ARCHIVELOG/2012_04_16/thread_1_seq_235.652.780782187
File Name: +data/LABDB/ARCHIVELOG/2012_04_16/thread_1_seq_236.653.780782567
File Name: +data/LABDB/ARCHIVELOG/2012_04_16/thread_1_seq_237.655.780782953
File Name: +data/LABDB/ARCHIVELOG/2012_04_16/thread_1_seq_238.658.780783337
File Name: +data/LABDB/ARCHIVELOG/2012_04_16/thread_1_seq_239.659.780783729
File Name: +data/LABDB/ARCHIVELOG/2012_04_16/thread_1_seq_240.662.780784119

using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to +DATA/labdb/datafile/system.256.776203549
channel ORA_DISK_1: restoring datafile 00002 to +DATA/labdb/datafile/sysaux.257.776203551
channel ORA_DISK_1: restoring datafile 00003 to +DATA/labdb/datafile/undotbs1.258.776203551
channel ORA_DISK_1: restoring datafile 00004 to +DATA/labdb/datafile/users.259.776203551
channel ORA_DISK_1: reading from backup piece +DATA/labdb/backupset/2012_04_16/nnndf0_tag20120416t165621_0.597.780771385
channel ORA_DISK_1: piece handle=+DATA/labdb/backupset/2012_04_16/nnndf0_tag20120416t165621_0.597.780771385 tag=TAG20120416T165621
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:02:59
Finished restore at 16-APR-12

RMAN> recover database;

Starting recover at 16-APR-12
using channel ORA_DISK_1

starting media recovery

archived log for thread 1 with sequence 210 is already on disk as file +DATA/labdb/archivelog/2012_04_16/thread_1_seq_210.598.780771501
archived log for thread 1 with sequence 211 is already on disk as file +DATA/labdb/archivelog/2012_04_16/thread_1_seq_211.602.780771917
archived log for thread 1 with sequence 212 is already on disk as file +DATA/labdb/archivelog/2012_04_16/thread_1_seq_212.603.780772319
archived log for thread 1 with sequence 213 is already on disk as file +DATA/labdb/archivelog/2012_04_16/thread_1_seq_213.606.780772735
archived log for thread 1 with sequence 214 is already on disk as file +DATA/labdb/archivelog/2012_04_16/thread_1_seq_214.610.780773129
archived log for thread 1 with sequence 215 is already on disk as file +DATA/labdb/archivelog/2012_04_16/thread_1_seq_215.612.780774801
archived log for thread 1 with sequence 216 is already on disk as file +DATA/labdb/archivelog/2012_04_16/thread_1_seq_216.613.780774867
archived log for thread 1 with sequence 217 is already on disk as file +DATA/labdb/archivelog/2012_04_16/thread_1_seq_217.616.780775293
archived log for thread 1 with sequence 218 is already on disk as file +DATA/labdb/archivelog/2012_04_16/thread_1_seq_218.617.780775679
archived log for thread 1 with sequence 219 is already on disk as file +DATA/labdb/archivelog/2012_04_16/thread_1_seq_219.620.780776059
archived log for thread 1 with sequence 220 is already on disk as file +DATA/labdb/archivelog/2012_04_16/thread_1_seq_220.622.780776441
archived log for thread 1 with sequence 221 is already on disk as file +DATA/labdb/archivelog/2012_04_16/thread_1_seq_221.623.780776827
archived log for thread 1 with sequence 222 is already on disk as file +DATA/labdb/archivelog/2012_04_16/thread_1_seq_222.625.780777205
archived log for thread 1 with sequence 223 is already on disk as file +DATA/labdb/archivelog/2012_04_16/thread_1_seq_223.628.780777587
archived log for thread 1 with sequence 224 is already on disk as file +DATA/labdb/archivelog/2012_04_16/thread_1_seq_224.630.780777965
archived log for thread 1 with sequence 225 is already on disk as file +DATA/labdb/archivelog/2012_04_16/thread_1_seq_225.631.780778341
archived log for thread 1 with sequence 226 is already on disk as file +DATA/labdb/archivelog/2012_04_16/thread_1_seq_226.634.780778727
archived log for thread 1 with sequence 227 is already on disk as file +DATA/labdb/archivelog/2012_04_16/thread_1_seq_227.635.780779109
archived log for thread 1 with sequence 228 is already on disk as file +DATA/labdb/archivelog/2012_04_16/thread_1_seq_228.638.780779499
archived log for thread 1 with sequence 229 is already on disk as file +DATA/labdb/archivelog/2012_04_16/thread_1_seq_229.640.780779879
archived log for thread 1 with sequence 230 is already on disk as file +DATA/labdb/archivelog/2012_04_16/thread_1_seq_230.641.780780261
archived log for thread 1 with sequence 231 is already on disk as file +DATA/labdb/archivelog/2012_04_16/thread_1_seq_231.643.780780649
archived log for thread 1 with sequence 232 is already on disk as file +DATA/labdb/archivelog/2012_04_16/thread_1_seq_232.646.780781035
archived log for thread 1 with sequence 233 is already on disk as file +DATA/labdb/archivelog/2012_04_16/thread_1_seq_233.647.780781419
archived log for thread 1 with sequence 234 is already on disk as file +DATA/labdb/archivelog/2012_04_16/thread_1_seq_234.650.780781805
archived log for thread 1 with sequence 235 is already on disk as file +DATA/labdb/archivelog/2012_04_16/thread_1_seq_235.652.780782187
archived log for thread 1 with sequence 236 is already on disk as file +DATA/labdb/archivelog/2012_04_16/thread_1_seq_236.653.780782567
archived log for thread 1 with sequence 237 is already on disk as file +DATA/labdb/archivelog/2012_04_16/thread_1_seq_237.655.780782953
archived log for thread 1 with sequence 238 is already on disk as file +DATA/labdb/archivelog/2012_04_16/thread_1_seq_238.658.780783337
archived log for thread 1 with sequence 239 is already on disk as file +DATA/labdb/archivelog/2012_04_16/thread_1_seq_239.659.780783729
archived log for thread 1 with sequence 240 is already on disk as file +DATA/labdb/archivelog/2012_04_16/thread_1_seq_240.662.780784119
archived log for thread 1 with sequence 241 is already on disk as file +DATA/labdb/onlinelog/group_3.261.779847493
archived log file name=+DATA/labdb/archivelog/2012_04_16/thread_1_seq_210.598.780771501 thread=1 sequence=210
archived log file name=+DATA/labdb/archivelog/2012_04_16/thread_1_seq_211.602.780771917 thread=1 sequence=211
archived log file name=+DATA/labdb/archivelog/2012_04_16/thread_1_seq_212.603.780772319 thread=1 sequence=212
archived log file name=+DATA/labdb/archivelog/2012_04_16/thread_1_seq_213.606.780772735 thread=1 sequence=213
archived log file name=+DATA/labdb/archivelog/2012_04_16/thread_1_seq_214.610.780773129 thread=1 sequence=214
archived log file name=+DATA/labdb/archivelog/2012_04_16/thread_1_seq_215.612.780774801 thread=1 sequence=215
archived log file name=+DATA/labdb/archivelog/2012_04_16/thread_1_seq_216.613.780774867 thread=1 sequence=216
archived log file name=+DATA/labdb/archivelog/2012_04_16/thread_1_seq_217.616.780775293 thread=1 sequence=217
archived log file name=+DATA/labdb/archivelog/2012_04_16/thread_1_seq_218.617.780775679 thread=1 sequence=218
archived log file name=+DATA/labdb/archivelog/2012_04_16/thread_1_seq_219.620.780776059 thread=1 sequence=219
archived log file name=+DATA/labdb/archivelog/2012_04_16/thread_1_seq_220.622.780776441 thread=1 sequence=220
archived log file name=+DATA/labdb/archivelog/2012_04_16/thread_1_seq_221.623.780776827 thread=1 sequence=221
archived log file name=+DATA/labdb/archivelog/2012_04_16/thread_1_seq_222.625.780777205 thread=1 sequence=222
archived log file name=+DATA/labdb/archivelog/2012_04_16/thread_1_seq_223.628.780777587 thread=1 sequence=223
archived log file name=+DATA/labdb/archivelog/2012_04_16/thread_1_seq_224.630.780777965 thread=1 sequence=224
archived log file name=+DATA/labdb/archivelog/2012_04_16/thread_1_seq_225.631.780778341 thread=1 sequence=225
archived log file name=+DATA/labdb/archivelog/2012_04_16/thread_1_seq_226.634.780778727 thread=1 sequence=226
archived log file name=+DATA/labdb/archivelog/2012_04_16/thread_1_seq_227.635.780779109 thread=1 sequence=227
archived log file name=+DATA/labdb/archivelog/2012_04_16/thread_1_seq_228.638.780779499 thread=1 sequence=228
archived log file name=+DATA/labdb/archivelog/2012_04_16/thread_1_seq_229.640.780779879 thread=1 sequence=229
archived log file name=+DATA/labdb/archivelog/2012_04_16/thread_1_seq_230.641.780780261 thread=1 sequence=230
archived log file name=+DATA/labdb/archivelog/2012_04_16/thread_1_seq_231.643.780780649 thread=1 sequence=231
archived log file name=+DATA/labdb/archivelog/2012_04_16/thread_1_seq_232.646.780781035 thread=1 sequence=232
archived log file name=+DATA/labdb/archivelog/2012_04_16/thread_1_seq_233.647.780781419 thread=1 sequence=233
archived log file name=+DATA/labdb/archivelog/2012_04_16/thread_1_seq_234.650.780781805 thread=1 sequence=234
archived log file name=+DATA/labdb/archivelog/2012_04_16/thread_1_seq_235.652.780782187 thread=1 sequence=235
archived log file name=+DATA/labdb/archivelog/2012_04_16/thread_1_seq_236.653.780782567 thread=1 sequence=236
archived log file name=+DATA/labdb/archivelog/2012_04_16/thread_1_seq_237.655.780782953 thread=1 sequence=237
archived log file name=+DATA/labdb/archivelog/2012_04_16/thread_1_seq_238.658.780783337 thread=1 sequence=238
archived log file name=+DATA/labdb/archivelog/2012_04_16/thread_1_seq_239.659.780783729 thread=1 sequence=239
archived log file name=+DATA/labdb/archivelog/2012_04_16/thread_1_seq_240.662.780784119 thread=1 sequence=240
archived log file name=+DATA/labdb/onlinelog/group_3.261.779847493 thread=1 sequence=241
media recovery complete, elapsed time: 00:00:32
Finished recover at 16-APR-12

RMAN> alter database open;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of alter db command at 04/16/2012 21:54:02
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open

RMAN> alter database open resetlogs;

database opened

RMAN>

No comments:

Post a Comment