We can set CONTROLFILE AUTOBACKUP on to make a backup of control file every time we take backup using RMAN. But today we will see how we can manually make a backup of controlfile.

Step 1: Login to SQL prompt of database

[oracle@localhost ~]$ export ORACLE_SID=demo
[oracle@localhost ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Sun Jan 6 00:59:00 2019

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


Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL>

Step 2: Take a backup using the backup controlfile command

SQL> ALTER DATABASE BACKUP CONTROLFILE TO TRACE AS '/u02/demo_ctl.ctl';

Database altered.

SQL>

Step 3: View controlfile you just backed up

[oracle@localhost ~]$ cat /u02/demo_ctl.ctl
-- The following are current System-scope REDO Log Archival related
-- parameters and can be included in the database initialization file.
--
-- LOG_ARCHIVE_DEST=''
-- LOG_ARCHIVE_DUPLEX_DEST=''
--
-- LOG_ARCHIVE_FORMAT=%t_%s_%r.dbf
--
-- DB_UNIQUE_NAME="demo"
--
-- LOG_ARCHIVE_CONFIG='SEND, RECEIVE, NODG_CONFIG'
-- LOG_ARCHIVE_MAX_PROCESSES=4
-- STANDBY_FILE_MANAGEMENT=MANUAL
-- STANDBY_ARCHIVE_DEST=?#/dbs/arch
-- FAL_CLIENT=''
-- FAL_SERVER=''
--
-- LOG_ARCHIVE_DEST_1='LOCATION=/u02/arc/demo'
-- LOG_ARCHIVE_DEST_1='OPTIONAL REOPEN=300 NODELAY'
-- LOG_ARCHIVE_DEST_1='ARCH NOAFFIRM NOVERIFY SYNC'
-- LOG_ARCHIVE_DEST_1='REGISTER NOALTERNATE NODEPENDENCY'
-- LOG_ARCHIVE_DEST_1='NOMAX_FAILURE NOQUOTA_SIZE NOQUOTA_USED NODB_UNIQUE_NAME'
-- LOG_ARCHIVE_DEST_1='VALID_FOR=(PRIMARY_ROLE,ONLINE_LOGFILES)'
-- LOG_ARCHIVE_DEST_STATE_1=ENABLE

--
-- Below are two sets of SQL statements, each of which creates a new
-- control file and uses it to open the database. The first set opens
-- the database with the NORESETLOGS option and should be used only if
-- the current versions of all online logs are available. The second
-- set opens the database with the RESETLOGS option and should be used
-- if online logs are unavailable.
-- The appropriate set of statements can be copied from the trace into
-- a script file, edited as necessary, and executed when there is a
-- need to re-create the control file.
--
--     Set #1. NORESETLOGS case
--
-- The following commands will create a new control file and use it
-- to open the database.
-- Data used by Recovery Manager will be lost.
-- Additional logs may be required for media recovery of offline
-- Use this only if the current versions of all online logs are
-- available.

-- After mounting the created controlfile, the following SQL
-- statement will place the database in the appropriate
-- protection mode:
--  ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE

STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "DEMO" NORESETLOGS  ARCHIVELOG
    MAXLOGFILES 16
    MAXLOGMEMBERS 3
    MAXDATAFILES 1024
    MAXINSTANCES 8
    MAXLOGHISTORY 292
LOGFILE
  GROUP 1 (
    '/u02/oradata/DEMO/onlinelog/o1_mf_1_g2v3n40x_.log',
    '/u02/fast_recovery_area/demo/DEMO/onlinelog/o1_mf_1_g2v3nbgm_.log'
  ) SIZE 200M BLOCKSIZE 512,
  GROUP 2 (
    '/u02/oradata/DEMO/onlinelog/o1_mf_2_g2v3n42j_.log',
    '/u02/fast_recovery_area/demo/DEMO/onlinelog/o1_mf_2_g2v3nbg0_.log'
  ) SIZE 200M BLOCKSIZE 512,
  GROUP 3 (
    '/u02/oradata/DEMO/onlinelog/o1_mf_3_g2v3nnft_.log',
    '/u02/fast_recovery_area/demo/DEMO/onlinelog/o1_mf_3_g2v3nqn0_.log'
  ) SIZE 200M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE
  '/u02/oradata/DEMO/datafile/o1_mf_system_g2v3h4nx_.dbf',
  '/u02/oradata/DEMO/datafile/o1_mf_sysaux_g2v3kjm5_.dbf',
  '/u02/oradata/DEMO/datafile/o1_mf_undotbs1_g2v3lxr9_.dbf',
  '/u02/oradata/DEMO/datafile/o1_mf_system_g2v3ot3x_.dbf',
  '/u02/oradata/DEMO/datafile/o1_mf_sysaux_g2v3ot3q_.dbf',
  '/u02/oradata/DEMO/datafile/o1_mf_users_g2v3lywc_.dbf',
  '/u02/oradata/DEMO/datafile/o1_mf_undotbs1_g2v3ot45_.dbf',
  '/u02/oradata/DEMO/7E8758AC5ED126B4E055000000000001/datafile/o1_mf_system_g2v4j0j1_.dbf',
  '/u02/oradata/DEMO/7E8758AC5ED126B4E055000000000001/datafile/o1_mf_sysaux_g2v4j0p1_.dbf',
  '/u02/oradata/DEMO/7E8758AC5ED126B4E055000000000001/datafile/o1_mf_undotbs1_g2v4j0p2_.dbf',
  '/u02/oradata/DEMO/7E8758AC5ED126B4E055000000000001/datafile/o1_mf_users_g2v4mrlj_.dbf',
  '/u02/oradata/DEMO/7E8758AC5ED126B4E055000000000001/datafile/o1_mf_tbs_rcat_g2v5zj00_.dbf'
CHARACTER SET AL32UTF8
;

-- Commands to re-create incarnation table
-- Below log names MUST be changed to existing filenames on
-- disk. Any one log file from each branch can be used to
-- re-create incarnation records.
-- ALTER DATABASE REGISTER LOGFILE '/u02/arc/demo/1_1_934293149.dbf';
-- ALTER DATABASE REGISTER LOGFILE '/u02/arc/demo/1_1_996573275.dbf';
-- Recovery is required if any of the datafiles are restored backups,
-- or if the last shutdown was not normal or immediate.
RECOVER DATABASE

-- Block change tracking was enabled, so re-enable it now.
ALTER DATABASE ENABLE BLOCK CHANGE TRACKING
USING FILE '/u02/oradata/DEMO/changetracking/o1_mf_g2vbx89x_.chg' REUSE;

-- All logs need archiving and a log switch is needed.
ALTER SYSTEM ARCHIVE LOG ALL;

-- Database can now be opened normally.
ALTER DATABASE OPEN;

-- Open all the PDBs.
ALTER PLUGGABLE DATABASE ALL OPEN;

-- Commands to add tempfiles to temporary tablespaces.
-- Online tempfiles have complete space information.
-- Other tempfiles may require adjustment.
ALTER TABLESPACE TEMP ADD TEMPFILE '/u02/oradata/DEMO/datafile/o1_mf_temp_g2v3ok6v_.tmp'
     SIZE 34603008  REUSE AUTOEXTEND ON NEXT 655360  MAXSIZE 32767M;
ALTER SESSION SET CONTAINER = PDB$SEED;
ALTER TABLESPACE TEMP ADD TEMPFILE '/u02/oradata/DEMO/datafile/temp012019-01-03_09-56-19-606-AM.dbf'
     SIZE 67108864  REUSE AUTOEXTEND ON NEXT 655360  MAXSIZE 32767M;
ALTER SESSION SET CONTAINER = PDB;
ALTER TABLESPACE TEMP ADD TEMPFILE '/u02/oradata/DEMO/7E8758AC5ED126B4E055000000000001/datafile/o1_mf_temp_g2v4j0p3_.dbf'
     SIZE 67108864  REUSE AUTOEXTEND ON NEXT 655360  MAXSIZE 32767M;
ALTER SESSION SET CONTAINER = CDB$ROOT;
-- End of tempfile additions.
--
--     Set #2. RESETLOGS case
--
-- The following commands will create a new control file and use it
-- to open the database.
-- Data used by Recovery Manager will be lost.
-- The contents of online logs will be lost and all backups will
-- be invalidated. Use this only if online logs are damaged.

-- After mounting the created controlfile, the following SQL
-- statement will place the database in the appropriate
-- protection mode:
--  ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE

STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "DEMO" RESETLOGS  ARCHIVELOG
    MAXLOGFILES 16
    MAXLOGMEMBERS 3
    MAXDATAFILES 1024
    MAXINSTANCES 8
    MAXLOGHISTORY 292
LOGFILE
  GROUP 1 (
    '/u02/oradata/DEMO/onlinelog/o1_mf_1_g2v3n40x_.log',
    '/u02/fast_recovery_area/demo/DEMO/onlinelog/o1_mf_1_g2v3nbgm_.log'
  ) SIZE 200M BLOCKSIZE 512,
  GROUP 2 (
    '/u02/oradata/DEMO/onlinelog/o1_mf_2_g2v3n42j_.log',
    '/u02/fast_recovery_area/demo/DEMO/onlinelog/o1_mf_2_g2v3nbg0_.log'
  ) SIZE 200M BLOCKSIZE 512,
  GROUP 3 (
    '/u02/oradata/DEMO/onlinelog/o1_mf_3_g2v3nnft_.log',
    '/u02/fast_recovery_area/demo/DEMO/onlinelog/o1_mf_3_g2v3nqn0_.log'
  ) SIZE 200M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE
  '/u02/oradata/DEMO/datafile/o1_mf_system_g2v3h4nx_.dbf',
  '/u02/oradata/DEMO/datafile/o1_mf_sysaux_g2v3kjm5_.dbf',
  '/u02/oradata/DEMO/datafile/o1_mf_undotbs1_g2v3lxr9_.dbf',
  '/u02/oradata/DEMO/datafile/o1_mf_system_g2v3ot3x_.dbf',
  '/u02/oradata/DEMO/datafile/o1_mf_sysaux_g2v3ot3q_.dbf',
  '/u02/oradata/DEMO/datafile/o1_mf_users_g2v3lywc_.dbf',
  '/u02/oradata/DEMO/datafile/o1_mf_undotbs1_g2v3ot45_.dbf',
  '/u02/oradata/DEMO/7E8758AC5ED126B4E055000000000001/datafile/o1_mf_system_g2v4j0j1_.dbf',
  '/u02/oradata/DEMO/7E8758AC5ED126B4E055000000000001/datafile/o1_mf_sysaux_g2v4j0p1_.dbf',
  '/u02/oradata/DEMO/7E8758AC5ED126B4E055000000000001/datafile/o1_mf_undotbs1_g2v4j0p2_.dbf',
  '/u02/oradata/DEMO/7E8758AC5ED126B4E055000000000001/datafile/o1_mf_users_g2v4mrlj_.dbf',
  '/u02/oradata/DEMO/7E8758AC5ED126B4E055000000000001/datafile/o1_mf_tbs_rcat_g2v5zj00_.dbf'
CHARACTER SET AL32UTF8
;

-- Commands to re-create incarnation table
-- Below log names MUST be changed to existing filenames on
-- disk. Any one log file from each branch can be used to
-- re-create incarnation records.
-- ALTER DATABASE REGISTER LOGFILE '/u02/arc/demo/1_1_934293149.dbf';
-- ALTER DATABASE REGISTER LOGFILE '/u02/arc/demo/1_1_996573275.dbf';
-- Recovery is required if any of the datafiles are restored backups,
-- or if the last shutdown was not normal or immediate.
RECOVER DATABASE USING BACKUP CONTROLFILE

-- Block change tracking was enabled, so re-enable it now.
ALTER DATABASE ENABLE BLOCK CHANGE TRACKING
USING FILE '/u02/oradata/DEMO/changetracking/o1_mf_g2vbx89x_.chg' REUSE;

-- Database can now be opened zeroing the online logs.
ALTER DATABASE OPEN RESETLOGS;

-- Open all the PDBs.
ALTER PLUGGABLE DATABASE ALL OPEN;

-- Commands to add tempfiles to temporary tablespaces.
-- Online tempfiles have complete space information.
-- Other tempfiles may require adjustment.
ALTER TABLESPACE TEMP ADD TEMPFILE '/u02/oradata/DEMO/datafile/o1_mf_temp_g2v3ok6v_.tmp'
     SIZE 34603008  REUSE AUTOEXTEND ON NEXT 655360  MAXSIZE 32767M;
ALTER SESSION SET CONTAINER = PDB$SEED;
ALTER TABLESPACE TEMP ADD TEMPFILE '/u02/oradata/DEMO/datafile/temp012019-01-03_09-56-19-606-AM.dbf'
     SIZE 67108864  REUSE AUTOEXTEND ON NEXT 655360  MAXSIZE 32767M;
ALTER SESSION SET CONTAINER = PDB;
ALTER TABLESPACE TEMP ADD TEMPFILE '/u02/oradata/DEMO/7E8758AC5ED126B4E055000000000001/datafile/o1_mf_temp_g2v4j0p3_.dbf'
     SIZE 67108864  REUSE AUTOEXTEND ON NEXT 655360  MAXSIZE 32767M;
ALTER SESSION SET CONTAINER = CDB$ROOT;
-- End of tempfile additions.
--
[oracle@localhost ~]$

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:

Telegram Channel: https://t.me/helporacle

Skant Gupta’s LinkedIn: www.linkedin.com/in/skantali/

Joel Perez’s LinkedIn: Joel Perez’s Profile

LinkedIn Group: Oracle Cloud DBAAS

Facebook Page: OracleHelp

About The Author

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.