Oracle Control File Operations

Source: Internet
Author: User
There can be multiple control files. In the parameter file, you can use the control_files parameter to specify the location. When you want to write data to the control file, the data is synchronized to multiple control files. Read Control

There can be multiple control files. In the parameter file, you can use the control_files parameter to specify the location. When you want to write data to the control file, the data is synchronized to multiple control files. Read Control

The control file is the link connecting the instance and database. The structure information of the database is recorded.
The control file is a binary file. The status of the current database is recorded.
There can be multiple control files. In the parameter file, you can use the control_files parameter to specify the location. When you want to write data to the control file, the data is synchronized to multiple control files. Only the first control file is read. If any of the control files is corrupted, the instance will be abort.
The control file can only be associated with one database.
The control file is created when the database is created. You can also re-create it when it is started to the nomount status.

Related reading:

Oracle control file recovery

Oracle uses the old control file to back up and restore the new data file

Oracle Tutorial: User-managed backup and recovery-control file backup and recovery

Oracle control file addition, backup, recovery

Oracle uses backup control files to restore Databases

Views related to control file
V $ controlfile: information about all control files in the current instance.
V $ controlfile_record_section: All section information in the control file.

View the information of the current control file:
Select * from v $ controlfile;
Select * from v $ parameter where name like '% control % ';
Show parameter control;
Select * from v $ controlfile_record_section;

Use commands to modify the control file path

Alter system set control_files = '/u01/app/oracle/oradata/saigon/control01.ctl ',
'/U01/app/oracle/oradata/saigon/control02.ctl ',
'/U01/app/oracle/oradata/saigon/control03.ctl' scope = spfile;

Use spfile to increase the number of control files or modify the control file path
(1) Use v $ controlfile to obtain the name and location of the existing control file.
(2) modify the spfile and use
Alter system set control_files =
'D: \ DISK3 \ CONTROL01.CTL ',
'D: \ DISK6 \ CONTROL02.CTL ',
'D: \ DISK9 \ CONTROL03.CTL 'SCOPE = SPFIL;
(3) shut down the database normally (shutdown, shutdown immediate ).
(4) use the copy command of the operating system to copy the existing control file to the specified location.
(5) restart the oracle database (startup)
(6) use the data field v $ controlfile to verify whether the new control file name is correct.
(7) If any error occurs, repeat the above operation: If there is no error, delete the original control file.

Use pfile to increase the number of control files or modify the control file path
1. Close the database cleanly.
2. Copy and rename a new control file on the operating system.
3. Add the previous parameter file to the control_files parameter in initSID. ora.
4. Start the database.

Back up control files during oracle operation
1. alter database backup controlfile to 'd: \ aaa. bak ';
2. alter database backup controlfile to trace; translate the control file into a script for creating the control file. The path is in the directory of the user warning file (you can view it through show parameter user_dump;) with the suffix trc.

Or find the following method:

SELECT d. VALUE
| '/'
| LOWER (RTRIM (I. INSTANCE, CHR (0 )))
| '_ Ora _'
| P. spid
| '. Trc' trace_file_name
FROM (SELECT p. spid
FROM v $ mystat m, v $ session s, v $ process p
WHERE m. statistic # = 1 AND s. SID = m. sid and p. addr = s. paddr) p,
(SELECT t. INSTANCE
FROM v $ thread t, v $ parameter v
WHERE v. NAME = 'thread'
AND (v. VALUE = 0 OR t. thread # = TO_NUMBER (v. VALUE) I,
(SELECT VALUE
FROM v $ parameter
Where name = 'user _ dump_dest ') d
/

3.

Run {
Backup current controlfile format '/backup1/controlfile _ % d _ % s. ctl ';
}

Control file recovery

You can use the resetlog method to open data as long as you have the current log file.
Whether to use resetlogs to open the backup depends on whether the backup control file is used.
If you are using a backup control file, you need to use the resetlogs method to open the database;
If you have the current control file or restore it by recreating the control file, you do not need to open it through resetlogs.

RMAN> restore controlfile to '/tmp/control01.ctl' from 'C-3152029224-20051221-00'

------- Restore control file opened by the user resetlogs

Run {
Startup force nomount;

Set dbid =
Restore controlfile from autobackup;
Alter database mount;
Recover database;
Alter database open resetlogs;
}

------- Restore control file opened in Normal Mode
1. startup nomount;
2. RMAN> restore controlfile from autobackup;
3. alter database mount;
4. SQL> alter database backup controlfile to trace;
5. Find the trace file
SELECT d. VALUE
| '/'
| LOWER (RTRIM (I. INSTANCE, CHR (0 )))
| '_ Ora _'
| P. spid
| '. Trc' trace_file_name
FROM (SELECT p. spid
FROM v $ mystat m, v $ session s, v $ process p
WHERE m. statistic # = 1 AND s. SID = m. sid and p. addr = s. paddr) p,
(SELECT t. INSTANCE
FROM v $ thread t, v $ parameter v
WHERE v. NAME = 'thread'
AND (v. VALUE = 0 OR t. thread # = TO_NUMBER (v. VALUE) I,
(SELECT VALUE
FROM v $ parameter
Where name = 'user _ dump_dest ') d
/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.