The control file is one of the primary files that make up Oracle database, documenting the binary files of the physical structure of the Oracle databases, mainly including the following:
Database name
Data files and redo log file location information
Database creation Time
Database Current log Sequence number
Checkpoint Information
Oracle server and having read and write permissions on the control file in the database close state, you need to use control file when the database is Mount
How to name Controlfile:
If you do not use OMF, the system will name the control file according to the Control_files parameter in the init file when creating the database
When using Omf,oracle database to automatically name control file names
When using ASM management, only two parameters of db_create_file_dest and db_recover_file_dest are required, and the Oracle ASM system automatically names the Controlfile
Control files are equivalent to the heart of the database, if you do not use ASM to store data files, in order to ensure that the database normal operation will retain at least 2 copies of Controlfile at different storage addresses, when there is a control file corruption, there can be a redundancy to ensure that the database can continue to run.
Controfile records the physical structure of the database, when the physical structure of the database changes, to timely controlfile backup of the database, the backup situation is as follows:
Add, delete, change data files, tablespace, redo log files
How to back up your control files:
1. Backup Controlfile to binary file
alter database backup controlfile to ‘file_name‘;
2.备份controlfile到trace file
alter database backup controlfile to trace;
trace file在alert log中记录也可在ORACLE_BASE/diag/rdbms/sid/sid/trace中查找 3.在RMAN中配置controlfile自动备份
Rman> Show All; RMANConfigurationParameters forDatabase withDb_unique_name OEM are:configure RETENTION POLICY toRedundancy1; #defaultCONFIGURE BACKUP optimization OFF; #defaultCONFIGUREDEFAULTDEVICETYPE toDISK; #defaultCONFIGURE controlfile autobackup OFF; #defaultCONFIGURE Controlfile autobackup FORMAT forDEVICETYPEDISK to'%F '; #defaultCONFIGURE DEVICETYPEDISK PARALLELISM1BACKUPTYPE toBACKUPSET; #defaultCONFIGURE datafile BACKUP COPIES forDEVICETYPEDISK to 1; #defaultCONFIGURE ARCHIVELOG BACKUP COPIES forDEVICETYPEDISK to 1; #defaultCONFIGURE maxsetsize toUNLIMITED; #defaultCONFIGURE encryption forDATABASE OFF; #defaultCONFIGURE Encryption algorithm' AES128‘; #defaultCONFIGURE COMPRESSION algorithm' BASIC' As of RELEASE ' DEFAULT' OPTIMIZE forLOAD TRUE; #defaultCONFIGURE ARCHIVELOG Deletion POLICY toNONE; #defaultCONFIGURE SNAPSHOT Controlfile NAME to'/u01/app/oracle/product/11.2. 0/DB_1/DBS/SNAPCF_OEM.F '; #defaultRman> Configure Controlfile Autobackup on;NewRMANConfigurationParameters:configure Controlfile Autobackup on;NewRMANConfigurationParameters is successfully storedrman> show All; RMANConfigurationParameters forDatabase withDb_unique_name OEM are:configure RETENTION POLICY toRedundancy1; #defaultCONFIGURE BACKUP optimization OFF; #defaultCONFIGUREDEFAULTDEVICETYPE toDISK; #defaultCONFIGURE Controlfile Autobackup on; CONFIGURE Controlfile autobackup FORMAT forDEVICETYPEDISK to'%F '; #defaultCONFIGURE DEVICETYPEDISK PARALLELISM1BACKUPTYPE toBACKUPSET; #defaultCONFIGURE datafile BACKUP COPIES forDEVICETYPEDISK to 1; #defaultCONFIGURE ARCHIVELOG BACKUP COPIES forDEVICETYPEDISK to 1; #defaultCONFIGURE maxsetsize toUNLIMITED; #defaultCONFIGURE encryption forDATABASE OFF; #defaultCONFIGURE Encryption algorithm' AES128‘; #defaultCONFIGURE COMPRESSION algorithm' BASIC' As of RELEASE ' DEFAULT' OPTIMIZE forLOAD TRUE; #defaultCONFIGURE ARCHIVELOG Deletion POLICY toNONE; #defaultCONFIGURE SNAPSHOT Controlfile NAME to'/u01/app/oracle/product/11.2. 0/DB_1/DBS/SNAPCF_OEM.F '; #defaultRman>
To create a control file by backing up the control files into the race file, the following commands are created:
CREATEControlfile ReuseDATABASE "OEM"Resetlogs ARCHIVELOG Maxlogfiles -Maxlogmembers3Maxdatafiles -Maxinstances8Maxloghistory292LOGFILEGROUP 1 '/u01/app/oracle/oradata/oem/redo01.log ' SIZE +M BLOCKSIZE +,GROUP 2 '/u01/app/oracle/oradata/oem/redo02.log ' SIZE +M BLOCKSIZE +,GROUP 3 '/u01/app/oracle/oradata/oem/redo03.log ' SIZE +M BLOCKSIZE +--STANDBY Logfiledatafile'/u01/app/oracle/oradata/oem/system01.dbf ','/u01/app/oracle/oradata/oem/sysaux01.dbf ','/u01/app/oracle/oradata/oem/undotbs01.dbf ','/u01/app/oracle/oradata/oem/users01.dbf ','/u01/app/oracle/oradata/oem/mgmt_ecm_depot1.dbf ','/u01/app/oracle/oradata/oem/mgmt.dbf ','/u01/app/oracle/oradata/oem/mgmt_deepdive.dbf ','/u01/app/oracle/oradata/oem/test0101.dbf 'CHARACTER SETAl32utf8;
When the control file is corrupted, it can be recovered by the backed up control file.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Oracle Control files