Tuesday 19 May 2020

RMAN - Restore the Loss of All Control Files using autobackup

Restore the Loss of All Control Files 

Scenario:
All control files are deleted we have auto backup control file configured. 

SQL> sho parameter control_files

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
control_files                        string      C:\APP\VARUNYADAV\ORADATA\SMRP
                                                 LM\CONTROL01.CTL, C:\APP\VARUN
                                                 YADAV\ORADATA\SMRPLM\CONTROL02
                                                 .CTL
SQL>


  • Remove controlfile at OS level, Check database by running query

SQL> select * from v$datafile;
select * from v$datafile
              *
ERROR at line 1:
ORA-01507: database not mounted


SQL>

  • Alert.log files details 

O/S-Error: (OS 2) The system cannot find the file specified.
2020-05-19T18:05:18.415109+05:30
Errors in file C:\APP\VARUNYADAV\diag\rdbms\smrplm\smrplm\trace\smrplm_m000_23056.trc:
ORA-00202: control file: 'C:\APP\VARUNYADAV\ORADATA\SMRPLM\CONTROL02.CTL'
ORA-27041: unable to open file
OSD-04002: unable to open file
O/S-Error: (OS 2) The system cannot find the file specified.
ORA-00210: cannot open the specified control file
ORA-00202: control file: 'C:\APP\VARUNYADAV\ORADATA\SMRPLM\CONTROL01.CTL'
ORA-27041: unable to open file
OSD-04002: unable to open file
O/S-Error: (OS 2) The system cannot find the file specified.
Checker run found 1 new persistent data failures

  • Recover controlfile using autobackup

C:\Users\varunyadav>rman target /

Recovery Manager: Release 12.2.0.1.0 - Production on Tue May 19 18:30:01 2020

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

connected to target database (not started)

RMAN> SET DBID 1550500176;

executing command: SET DBID

RMAN> STARTUP NOMOUNT;

Oracle instance started

Total System Global Area    5133828096 bytes

Fixed Size                     8757472 bytes
Variable Size               1207963424 bytes
Database Buffers            3909091328 bytes
Redo Buffers                   8015872 bytes

RMAN> RESTORE CONTROLFILE FROM AUTOBACKUP;

Starting restore at 19-MAY-20
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=252 device type=DISK

channel ORA_DISK_1: looking for AUTOBACKUP on day: 20200519
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20200518
channel ORA_DISK_1: AUTOBACKUP found: c-1550500176-20200518-00
channel ORA_DISK_1: restoring control file from AUTOBACKUP c-1550500176-20200518-00
channel ORA_DISK_1: control file restore from AUTOBACKUP complete
output file name=C:\APP\VARUNYADAV\ORADATA\SMRPLM\CONTROL01.CTL
output file name=C:\APP\VARUNYADAV\ORADATA\SMRPLM\CONTROL02.CTL
Finished restore at 19-MAY-20

RMAN> SHUTDOWN ;

Oracle instance shut down

RMAN> STARTUP MOUNT

connected to target database (not started)
Oracle instance started
database mounted

Total System Global Area    5133828096 bytes

Fixed Size                     8757472 bytes
Variable Size               1207963424 bytes
Database Buffers            3909091328 bytes
Redo Buffers                   8015872 bytes

RMAN> RECOVER DATABASE;

Starting recover at 19-MAY-20
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=5 device type=DISK

starting media recovery

archived log for thread 1 with sequence 34 is already on disk as file C:\APP\VARUNYADAV\ORADATA\SMRPLM\REDO01.LOG
archived log for thread 1 with sequence 35 is already on disk as file C:\APP\VARUNYADAV\ORADATA\SMRPLM\REDO02.LOG
archived log file name=C:\APP\VARUNYADAV\ORADATA\SMRPLM\REDO01.LOG thread=1 sequence=34
archived log file name=C:\APP\VARUNYADAV\ORADATA\SMRPLM\REDO02.LOG thread=1 sequence=35
media recovery complete, elapsed time: 00:00:03
Finished recover at 19-MAY-20

  • Open database in resetlogs
RMAN> ALTER DATABASE OPEN RESETLOGS;

Statement processed

RMAN>

No comments:

Post a Comment