The title is as follows:
How to back up control files in Oracle? What are the ways to back up control files?
The answer is as follows:
Answer: 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;
③ To set 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, when 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 automatic file backup and delayed creation 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 the change of database structure, but not the information about the 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 the change of database structure many times in one script. For example, create tablespace, DROP LOGFILE, add logfile, etc., Oracle 11g will only back up 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'
④ 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 file control. The snapshot control file is a copy of the current control file generated by RMAN at the specified location in 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, it will refresh the snapshot control file. RMAN requires snapshot control files in the following cases: 1 When synchronizing the recovery directory 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 backup control file, you can:
RMAN> LIST BACKUP OF CONTROLFILE;
For more information about control file backup, please refer to my BLOG: http://blog.itpub.net/26736162/viewspace-2152115/
DB written interview history connection
About Me: Wheat Seedling
● the author of this paper: wheat seedling, only focusing on the technology of database, paying more attention to the application of technology
● author blog address: http://blog.itpub.net/26736162/abstract/1/
● this series of topics comes from the author's study notes, and some of them are sorted out from the Internet. Please understand if there is infringement or misconduct
● all rights reserved. Welcome to share this article. Please keep the source for reprint
● if there is anything wrong with the answer to the question, I hope all friends can criticize and correct it and make common progress