Backup control file
There are many ways to back up control files.
Backup of control files can be done online
SQL> ALTER DATABASE BACKUP CONTROLFILE TO '/tmp/control.ctl';--Hot backup control file SQL> ALTER DATABASE BACKUP CONTROLFILE TO TRACE AS '/home/bk/a.ctl';--Get the script for establishing the control file and backup it in text file format SQL> ALTER DATABASE BACKUP CONTROLFILE TO TRACE [RESETLOGS|NORESETLOGS];
RMAN manual backup control file
BACKUP CURRENT CONTROLFILE; BACKUP CURRENT CONTROLFILE FORMAT '/home/oracle/oracle_bk/orclasm/ctl_%d_%T_%s_%p.bak'; BACKUP AS COPY CURRENT CONTROLFILE FORMAT '/home/oracle/ctl.bak'; BACKUP DATABASE INCLUDE CURRENT CONTROLFILE;
Setting up RMAN automatic backup control files
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON; RMAN> CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/home/oracle/ctl_%f.bak';
Then, while doing any backup operation through rman, the control file will be backed up automatically.
When the database is in archive mode and "CONFIGURE CONTROLFILE AUTOBACKUP ON;" is set, if the structure of the database changes (such as adding or deleting tablespaces), the control file will also be backed up automatically. It should be noted that since Oracle 11g, rman has delayed the automatic backup of control files. In Oracle 10g, the automatic backup feature of control files is introduced. If the structure of the database changes, Oracle will automatically back up the control files to the specified directory and record relevant information in the alarm log. The premise is that the database is in archive mode and CONTROLFILE AUTOBACKUP is set to ON. However, starting from Oracle 11gR2, the feature of controlling the delay of automatic file backup is introduced. Even if the automatic backup of the control file is set, the backup of the control file will not be seen immediately when the database structure changes. Instead, the control file will not be seen automatically until 300 seconds (controlled by the implicit parameter "controlfile_autobackup_delay", which is 300 seconds by default) (after experimental test, it is found that it is actually 10 minutes later). Moreover, in the alarm log, you can only see the information about changes in the database structure, but not the information about automatic backup of control files. This is introduced by Oracle to change the performance to prevent users from creating multiple backup of control files due to changes in the database structure multiple times in one script. For example, create tablespace, DROP LOGFILE, add logfile, etc., Oracle 11g will back up only one control file, not multiple; For Oracle 10g, as long as the database structure changes, one will be backed up automatically. The MOS document [ID 1068182.1] describes this problem. In Oracle 11g, the background process of the backup control file is the slave process of MMON. By default, a trace file with the name Sid will be generated__ m000<OS_ PID >. TRC, the trace file records the location and time of automatic backup of control files:
Starting control autobackup
*** 2018-03-22 13:46:39.836
Control autobackup written to DISK device
handle '/u05/app/oracle/flash_recovery_area/ORA11G/autobackup/2018_03_22/o1_mf_s_971444798_fc6jszc5_.bkp'
When the data files of the SYSTEM tablespace are backed up, RMAN will also automatically back up the control files
As long as the data file numbered 1, that is, the data file of the SYSTEM tablespace, is backed up, RMAN will automatically back up the control file.
Snapshot control file
The snapshot control file is a copy of the current control file generated by RMAN at the location specified by the system. When RMAN starts the backup, Oracle will check whether the system control file is consistent with the snapshot control file (if it does not exist, it will extract information from the control file to create it). If it is inconsistent, refresh the snapshot control file. RMAN needs a snapshot control file in the following cases: 1. When restoring the directory synchronously 2. When backing up the current control file. In the RAC environment, the snapshot control file is only required on the node implementing RMAN backup.
View the location of the snapshot control file: RMAN> show snapshot controlfile name; RMAN configuration parameters for database with db_unique_name USBO are: CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/db_1/dbs/snapcf_lhrdb.f'; # default Linux/Unix The platform is: $ORACLE_HOME/dbs/snapcf_$ORACLE_SID.f Windows The platform is:%ORACLE_HOME%\database\snapcf_%$ORACLE_SID%.f If you want to view the backed up control files, you can: RMAN> LIST BACKUP OF CONTROLFILE;