Search This Blog

Sunday, 12 July 2020

Control File Restore from RMAN Backup

Note: Renamed Control file to create an issue


Location Of Control FIle:/u01/app/oracle/oradata/TEST/controlfile/o1_mf_hjpbhtdb_.ctl,
/u01/app/oracle/fast_recovery_area/TEST/controlfile/o1_mf_ hjpbhtg8_.ctl


SQL> show parameter control

NAME      TYPE VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time      integer 7
control_files      string /u01/app/oracle/oradata/TEST/controlfile/o1_mf_hjpbhtdb_.ctl, /u01/app/oracle/fast_recovery_area/TEST/controlfile/o1_mf_ hjpbhtg8_.ctl
control_management_pack_access      string DIAGNOSTIC+TUNING

SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options


Control File 1:Renameing to create issue for practice. 

[oracle@musaib ~]$ cd /u01/app/oracle/oradata/TEST/controlfile/
[oracle@musaib controlfile]$ ls -ltr
total 9808
-rw-r-----. 1 oracle oracle 10043392 Jul 12 21:23 o1_mf_hjpbhtdb_.ctl

[oracle@musaib controlfile]$ mv o1_mf_hjpbhtdb_.ctl control_file_bkp.ctl
[oracle@musaib controlfile]$ ls
control_file_bkp.ctl

Control File 2:Renameing to create issue for practice.

[oracle@musaib controlfile]$ cd /u01/app/oracle/fast_recovery_area/TEST/controlfile/
[oracle@musaib controlfile]$ ls
o1_mf_hjpbhtg8_.ctl
[oracle@musaib controlfile]$ mv  o1_mf_hjpbhtg8_.ctl control_file_bkp.ctl
[oracle@musaib controlfile]$ ls
control_file_bkp.ctl

[oracle@musaib controlfile]$ !sql
sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Sun Jul 12 21:24:19 2020

Copyright (c) 1982, 2014, Oracle.  All rights reserved.


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> shut immediate;
ORACLE instance shut down.
SQL> startup nomount;
ORACLE instance started.

Total System Global Area 2516582400 bytes
Fixed Size     2927528 bytes
Variable Size   671089752 bytes
Database Buffers 1828716544 bytes
Redo Buffers    13848576 bytes

SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
[oracle@musaib controlfile]$ rman target /

Recovery Manager: Release 12.1.0.2.0 - Production on Sun Jul 12 21:24:54 2020

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

connected to target database: TEST (not mounted)

RMAN> restore controlfile from '/u01/app/oracle/TEST/TEST_C_20200712_0cv558v3.ctl';

Starting restore at 12-JUL-20
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=22 device type=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/u01/app/oracle/oradata/TEST/controlfile/o1_mf_hjpbhtdb_.ctl
output file name=/u01/app/oracle/fast_recovery_area/TEST/controlfile/o1_mf_hjpbhtg8_.ctl
Finished restore at 12-JUL-20

RMAN> alter database mount;

Statement processed
released channel: ORA_DISK_1


RMAN> recover database;

Starting recover at 12-JUL-20
Starting implicit crosscheck backup at 12-JUL-20
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=22 device type=DISK
Crosschecked 3 objects
Finished implicit crosscheck backup at 12-JUL-20

Starting implicit crosscheck copy at 12-JUL-20
using channel ORA_DISK_1
Finished implicit crosscheck copy at 12-JUL-20

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

List of Cataloged Files
=======================
File Name: /u01/app/oracle/fast_recovery_area/TEST/archivelog/2020_07_12/o1_mf_1_23_hjpddgcq_.arc

using channel ORA_DISK_1

starting media recovery

archived log for thread 1 with sequence 23 is already on disk as file /u01/app/oracle/fast_recovery_area/TEST/archivelog/2020_07_12/o1_mf_1_23_hjpddgcq_.arc
archived log for thread 1 with sequence 24 is already on disk as file /u01/app/oracle/fast_recovery_area/TEST/onlinelog/o1_mf_3_hjpbhw31_.log
archived log file name=/u01/app/oracle/fast_recovery_area/TEST/archivelog/2020_07_12/o1_mf_1_23_hjpddgcq_.arc thread=1 sequence=23
archived log file name=/u01/app/oracle/fast_recovery_area/TEST/onlinelog/o1_mf_3_hjpbhw31_.log thread=1 sequence=24
media recovery complete, elapsed time: 00:00:00
Finished recover at 12-JUL-20

RMAN> alter database open resetlogs;

Statement processed


RMAN> select name,open_mode from v$database;

NAME      OPEN_MODE         
--------- --------------------
TEST      READ WRITE       

RMAN> exit


Recovery Manager complete.

[oracle@musaib controlfile]$ !sql
sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Sun Jul 12 21:29:59 2020

Copyright (c) 1982, 2014, Oracle.  All rights reserved.


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> show parameter control

NAME      TYPE VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time      integer 7
control_files      string /u01/app/oracle/oradata/TEST/c
ontrolfile/o1_mf_hjpbhtdb_.ctl
, /u01/app/oracle/fast_recover
y_area/TEST/controlfile/o1_mf_
hjpbhtg8_.ctl
control_management_pack_access      string DIAGNOSTIC+TUNING
SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
[oracle@musaib controlfile]$ cd /u01/app/oracle/fast_recovery_area/TEST/
[oracle@musaib TEST]$ ls -ltr
total 12
drwxr-x---. 3 oracle oracle 4096 Jul 12 20:47 archivelog
drwxr-x---. 2 oracle oracle 4096 Jul 12 20:49 onlinelog
drwxr-x---. 2 oracle oracle 4096 Jul 12 21:26 controlfile
[oracle@musaib TEST]$ cd controlfile/
[oracle@musaib controlfile]$ ls -ltr
total 19904
-rw-r-----. 1 oracle oracle 10043392 Jul 12 21:24 control_file_bkp.ctl
-rw-rw----. 1 oracle oracle 10338304 Jul 12 21:30 o1_mf_hjpbhtg8_.ctl
[oracle@musaib controlfile]$

No comments:

Post a Comment