The control file records important information about the DATABASE, including the DATABASE identifier (the DB_NAME parameter or the name used when the create database statement is used) name and location of data files and redo log files, timestamp of database creation, addition or deletion of table space information, checkpoint information, archive information, backup information, etc, if no control file is opened, it will fail. If the control file is abnormal during running, the database will crash immediately. This shows how important the control file is, the control file can only be read and written by an Oracle Server. Multiple copies and backups are recommended for control files. The dynamic performance view V $ CONTROLFILE_RECORD_SECTION records the content and information contained in the control file. Other performance views such as V $ DATAFILE and V $ LOG will obtain necessary information from this view.
0. How to add a control file
Sys @ www.bkjia.com> column name format a50
Sys @ www.bkjia.com> show parameter control
NAME TYPE VALUE
--------------------------------------------------------------------------
Control_file_record_keep_time integer 7
Control_files string/u01/oracle/9i/oradata/gt9i/co
Ntrol01.ctl,/u01/oracle/9i/or
Adata/gt9i/control02.ctl,/u01
/Oracle/9i/oradata/gt9i/contro
L03.ctl
Sys @ www.bkjia.com> select * from v $ controlfile;
STATUS NAME
---------------------------------------------------------
/U01/oracle/9i/oradata/gt9i/control01.ctl
/U01/oracle/9i/oradata/gt9i/control02.ctl
/U01/oracle/9i/oradata/gt9i/control03.ctl
Sys @ www.bkjia.com> create pfile = '/u01/oracle/gt9i. ora' from spfile;
File created.
Sys @ www.bkjia.com> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
Then copy an existing control file through the operating system command and modify pfile to add a new control file location:
[Oracle @ www.bkjia.com gt9i] $ ll control *
-Rw-r ----- 1 oracle oinstall 2023424 April 11 15:06 control01.ctl
-Rw-r ----- 1 oracle oinstall 2023424 April 11 15:06 control02.ctl
-Rw-r ----- 1 oracle oinstall 2023424 April 11 15:06 control03.ctl
[Oracle @ www.bkjia.com gt9i] $ cp control01.ctl controlTEST. ctl
[Oracle @ www.bkjia.com gt9i] $ ll control *
-Rw-r ----- 1 oracle oinstall 2023424 April 11 15:06 control01.ctl
-Rw-r ----- 1 oracle oinstall 2023424 April 11 15:06 control02.ctl
-Rw-r ----- 1 oracle oinstall 2023424 April 11 15:06 control03.ctl
-Rw-r ----- 1 oracle oinstall 2023424 15:23 controlTEST. ctl
Vi/u01/oracle/gt91.ora
Modify the control file as follows:
*. Control_files = '/u01/oracle/9i/oradata/gt9i/controlTEST. ctl ','/u01/oracle/9i/oradata/gt9i/control01.ctl ','/u01/oracle/9i/oradata/gt9i/control02.ctl ', '/u01/oracle/9i/oradata/gt9i/control03.ctl'
The above 1st are the control files we just added. Now we can use pfile to open the database.
Sys @ www.bkjia.com> startup pfile = '/u01/oracle/gt9i. ora'
ORACLE instance started.
Total System Global Area 286752136 bytes
Fixed Size 740744 bytes
Variable Size 150994944 bytes
Database Buffers 134217728 bytes
Redo Buffers 798720 bytes
Database mounted.
Database opened.
Sys @ www.bkjia.com> show parameter control
NAME TYPE VALUE
--------------------------------------------------------------------------
Control_file_record_keep_time integer 7
Control_files string/u01/oracle/9i/oradata/gt9i/co
NtrolTEST. ctl,/u01/oracle/9i/
Oradata/gt9i/control01.ctl,/u
01/oracle/9i/oradata/gt9i/cont
Rol02.ctl,/u01/oracle/9i/orad
Ata/gt9i/control03.ctl
Sys @ www.bkjia.com> select * from v $ controlfile;
STATUS NAME
---------------------------------------------------------
/U01/oracle/9i/oradata/gt9i/controlTEST. ctl
/U01/oracle/9i/oradata/gt9i/control01.ctl
/U01/oracle/9i/oradata/gt9i/control02.ctl
/U01/oracle/9i/oradata/gt9i/control03.ctl
We can see that there are four control files currently in use.
1. How to delete a control file
Add a reverse operation to the control file. .
2. How to back up control files
Backup is a trace text file. You can use a text editor to open the file and edit it directly. Alternatively, backup is a binary file.
Sys @ www.bkjia.com> alter database backup controlfile to trace as '/u01/oracle/gt9icontrol. trc ';
Database altered.
Sys @ www.bkjia.com> alter database backup controlfile to '/u01/oracle/gt9icontrol. ctl ';
Database altered.