RESTORE CONTROL FILE USING RMAN

 

Check the RMAN configuration and controlfile Auto backup Feature

[oratest@oracle ~]$ export ORACLE_SID=orcl
[oratest@oracle ~]$ rman target /
Recovery Manager: Release 19.0.0.0.0 - Production on Fri Sep 3 04:14:07 2021
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORCL (DBID=1608118455)

RMAN> show all;

RMAN configuration parameters for database with db_unique_name ORCL
are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK
TO '/u01/app/oracle/oradata/ORCL/backup/%F';
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO
BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; #
default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; #
default
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT
'/u01/app/oracle/oradata/ORCL/backup/%U' MAXPIECESIZE 8 G;
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT'
OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE RMAN OUTPUT TO KEEP FOR 7 DAYS; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO
'/u01/app/oracle/product/19.0.0/dbhome_1/dbs/snapcf_orcl.f'; # default

 Simulate a failure when the Database is Running

[oratest@oracle ~]$ export ORACLE_SID=orcl

[oratest@oracle ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Fri Sep 3 04:21:36 2021
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> select open_mode,name from v$database;
OPEN_MODE     NAME
---------   ---------
READ WRITE    ORCL

SQL> select name from v$controlfile;
NAME
-------------------------------------------------------
/u01/app/oracle/oradata/ORCL/control01.ctl
/u01/app/oracle/oradata/ORCL/control02.ctl

DELECT CONTROLFILE MANUALY

[oratest@oracle ~]$ cd /u01/app/oracle/oradata/ORCL/

[oratest@oracle ORCL]$ ls

backup control01.ctl control02.ctl redo01.log redo02.log redo03.log
sysaux01.dbf system01.dbf temp01.dbf undotbs01.dbf users01.dbf

[oratest@oracle ORCL]$ rm -fr control01.ctl

[oratest@oracle ORCL]$ rm -fr control02.ctl

[oratest@oracle ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Fri Sep 3 04:27:01 2021
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
SQL> alter tablespace data add datafile
'/u01/app/oracle/oradata/ORCL/test03.dbf' size 100m;
alter tablespace data add datafile '/u01/app/oracle/oradata/ORCL/test03.dbf'
size 100m
*
ERROR at line 1:
ORA-00210: cannot open the specified control file
ORA-00202: control file: '/u01/app/oracle/oradata/ORCL/control01.ctl'
ORA-27041: unable to open file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
SQL> select status from v$instance;
STATUS
------------
OPEN

SQL> shut immediate
ORA-00210: cannot open the specified control file
ORA-00202: control file: '/u01/app/oracle/oradata/ORCL/control01.ctl'
ORA-27041: unable to open file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3

SQL> shut abort
ORACLE instance shut down.

Keep the Database in NOMOUNT Stage and Restore the control file

SQL> startup nomount;
ORACLE instance started.
Total System Global Area 281017392 bytes
Fixed Size 8895536 bytes
Variable Size 218103808 bytes
Database Buffers 50331648 bytes
Redo Buffers 3686400 bytes

 Since we are not using an RMAN catalog we need to set the DBID

[oratest@oracle ~]$ rman target /
Recovery Manager: Release 19.0.0.0.0 - Production on Fri Sep 3 04:32:06 2021
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORCL (not mounted)

RMAN> set dbid=1608118455;
executing command: SET DBID
RMAN> restore controlfile from
"/u01/app/oracle/oradata/ORCL/backup/170840mm_1_1";
Starting restore at 03-SEP-21
using channel ORA_DISK_1
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/ORCL/control01.ctl
output file name=/u01/app/oracle/oradata/ORCL/control02.ctl
Finished restore at 03-SEP-21

Mount and Recover the database

RMAN> alter database mount;
released channel: ORA_DISK_1
Statement processed
RMAN> restore database;
Starting restore at 03-SEP-21
using channel ORA_DISK_1
RMAN-00571:
===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS
===============
RMAN-00571:
===========================================================

starting media Recovery

archived log for thread 1 with sequence 19 is already on disk as file
/u01/app/oracle/oradata/ORCL/redo01.log
archived log file name=/u01/app/oracle/oradata/ORCL/redo01.log thread=1
sequence=19
media recovery complete, elapsed time: 00:00:00
Finished recover at 03-SEP-21
Statement processed
Use RESETLOGS after incomplete recovery (when the entire redo stream
wasn’t applied). RESETLOGS will initialize the logs, reset your log sequence
number, and start a new “incarnation” of the database.
RMAN> alter database open resetlogs;
Statement processed

SQL> select open_mode,name from v$database;
OPEN_MODE          NAME
---------------  ---------
READ WRITE         ORCL

Thank you for giving your valuable time to read the above information.

If you want to be updated with all our articles send us the Invitation or Follow us:

Ramkumar’s LinkedIn: https://www.linkedin.com/in/ramkumardba/
LinkedIn Group: https://www.linkedin.com/in/ramkumar-m-0061a0204/
Facebook Page: https://www.facebook.com/Oracleagent-344577549964301
Ramkumar’s Twitter: https://twitter.com/ramkuma02877110
Ramkumar’s Telegram: https://t.me/oracleageant
Ramkumar’s Facebook: https://www.facebook.com/ramkumarram8

One thought on “RESTORE CONTROL FILE USING RMAN