It is necessary, from time to time, to backup the controlfile. This can be done when the database is open or mounted.
Backup controlfile using SQL
If you wish to backup the controlfile using SQLPLUS then you can issue the following to backup the controlfile to a binary file:
SQL> ALTER DATABASE BACKUP CONTROLFILE TO '/oracle/backup/control.bkp';
This create a duplicate of the current controlfile.
However, if you wish to produce SQL statements that can later be used to re-create the controlfile, you can issue the following:
SQL> ALTER DATABASE BACKUP CONTROLFILE TO TRACE;
Backup controlfile using RMAN
RMAN will automatically backup the controlfile and server parameter file after every backup and after structural database changes, if CONFIGURE CONTROLFILE AUTOBACKUP is set to ON. It is set to OFF by default.
The controlfile autobackup contains metadata about the previous backup, which is essential for database recovery.
Manually backup controlfile
RMAN> BACKUP CURRENT CONTROLFILE;
It should be noted that a manual backup of the controlfile cannot be automatically restored. This is because it only contains RMAN repository data for backups within the current RMAN session. However, if controlfile autobackup is set to on, RMAN will manually backup the controlfile then it will create an autobackup of the controlfile and server parameter file after the manual backup has completed so it can record the latest backup information.
If you wish to include the current controlfile in a backup then you can perform something like the following:
RMAN> BACKUP DEVICE TYPE sbt TABLESPACE emp INCLUDE CURRENT CONTROLFILE;
If autobackup is enabled then RMAN performs and autobackup of the controlfile after the backup, so the controlfile backup contains details of the latest backup taken.
Backup controlfile as copy
You can also backup the controlfile as a copy. You can use either of the below commands for creating a backup controlfile copy:
RMAN> BACKUP AS COPY CURRENT CONTROLFILE FORMAT '/tmp/controlfile_copy.ctl';
RMAN> BACKUP DEVICE TYPE sbt CONTROLFILECOPY '/tmp/controlfile_copy.ctl';