Oracle control file corruption or full loss recovery methods

Source: Internet
Author: User
The control file is lost and must be processed by the DBA. 1. The size of the control file is incorrect. Abnormal cp. Specify the correct operation. 2. The version of the control file is incorrect.

The control file is lost and must be processed by the DBA. 1. The size of the control file is incorrect. Abnormal cp. Specify the correct operation. 2. The version of the control file is incorrect.

The control file is lost and must be processed by the DBA.
1. The size of the control file is incorrect. Abnormal cp. Specify the correct operation.
2. The version of the control file is incorrect. Remember to back up all the control files in cp
3. If the control file is lost, at least one
4. All control files are lost,
5. Yes, but it's old.

1. The size of the control file is incorrect.
Next we will repair the content of a control file to make the size different.
[Oracle @ huang ~] $ Vim/sof/oracle/oradata/orcl/control01.ctl
SQL> shutdown immediate;
ORA-00227: upt block detected in control file: (block 1, # blocks 1)
ORA-00202: control file: '/sof/oracle/oradata/orcl/control01.ctl'
SQL> shutdown abort;
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area 1090519040 bytes
Fixed Size 1267020 bytes
Variable Size 704645812 bytes
Database Buffers 369098752 bytes
Redo Buffers 15507456 bytes
ORA-00205: error in identifying control file, check alert log for more info
The error message "control file error" is displayed.
SQL> show parameter control_f

NAME TYPE VALUE
-----------------------------------------------------------------------------
Control_file_record_keep_time integer 7
Control_files string/sof/oracle/oradata/orcl/contr
Ol01.ctl,/sof/oracle/oradata/
Orcl/control02.ctl,/sof/oracl
E/oradata/orcl/control03.ctl
SQL> ho ls-l/sof/oracle/oradata/orcl/here we can see that there are two identical sizes in the log file, which indicates that the two are normal.
Total 1536352
-Rw ------- 1 oracle oinstall 7110639 Jan 4 control01.ctl
-Rw ------- 1 oracle oinstall 7389184 Jan 4 control02.ctl
-Rw ------- 1 oracle oinstall 7389184 Jan 4 control03.ctl
SQL> ho cp/sof/oracle/oradata/orcl/control01.ctl/sof/oracle/oradata/orcl/control01.ct. bak

SQL> ho cp/sof/oracle/oradata/orcl/control02.ctl/sof/oracle/oradata/orcl/control01.ctl

SQL> shutdown immediate;
ORA-01507: database not mounted


ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area 1090519040 bytes
Fixed Size 1267020 bytes
Variable Size 704645812 bytes
Database Buffers 369098752 bytes
Redo Buffers 15507456 bytes
Database mounted.
Database opened.
Now the database can run normally.

2. The version of the control file is incorrect.
SQL> startup
ORACLE instance started.

Total System Global Area 1090519040 bytes
Fixed Size 1267020 bytes
Variable Size 704645812 bytes
Database Buffers 369098752 bytes
Redo Buffers 15507456 bytes
Database mounted.
Database opened.
SQL> alter system set control_files = '/sof/oracle/oradata/orcl/control02.ctl' scope = spfile;

System altered.

Database opened.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area 1090519040 bytes
Fixed Size 1267020 bytes
Variable Size 704645812 bytes
Database Buffers 369098752 bytes
Redo Buffers 15507456 bytes
Database mounted.
Database opened.
SQL> show parameter control_f

NAME TYPE VALUE
-----------------------------------------------------------------------------
Control_file_record_keep_time integer 7
Control_files string/sof/oracle/oradata/orcl/contr
Ol02.ctl
SQL> alter system set control_files = '/sof/oracle/oradata/orcl/control02.ctl', '/sof/oracle/oradata/orcl/control01.ctl ', '/sof/oracle/oradata/orcl/control03.ctl' scope = spfile;

System altered.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area 1090519040 bytes
Fixed Size 1267020 bytes
Variable Size 704645812 bytes
Database Buffers 369098752 bytes
Redo Buffers 15507456 bytes
ORA-00214: control file '/sof/oracle/oradata/orcl/control02.ctl' version 1036
Inconsistent with file '/sof/oracle/oradata/orcl/control01.ctl' version 1020
Now we are prompted that the version of the control file is not consistent. Note that the prompt version number is higher.
SQL> ho cp/sof/oracle/oradata/orcl/control01.ctl/sof/oracle/oradata/orcl/control01.ctl. bak

SQL> ho cp/sof/oracle/oradata/orcl/control02.ctl/sof/oracle/oradata/orcl/control01.ctl
SQL> startup
ORA-01081: cannot start already-running ORACLE-shut it down first
SQL> shutdown immediate;
ORA-01507: database not mounted


ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area 1090519040 bytes
Fixed Size 1267020 bytes
Variable Size 704645812 bytes
Database Buffers 369098752 bytes
Redo Buffers 15507456 bytes
ORA-00214: control file '/sof/oracle/oradata/orcl/control02.ctl' version 1036
Inconsistent with file '/sof/oracle/oradata/orcl/control03.ctl' version 1020

SQL> ho cp/sof/oracle/oradata/orcl/control03.ctl/sof/oracle/oradata/orcl/control03.ctl. bak

SQL> ho cp/sof/oracle/oradata/orcl/control02.ctl/sof/oracle/oradata/orcl/control03.ctl

SQL> startup
ORACLE instance started.

Total System Global Area 1090519040 bytes
Fixed Size 1267020 bytes
Variable Size 704645812 bytes
Database Buffers 369098752 bytes
Redo Buffers 15507456 bytes
Database mounted.
Database opened.
It is described above.

4. All control files are lost,
5, yes, but very old

SQL> alter database backup controlfile to trace as '/tmp/luo.txt'
2;

Database altered.
Get the script for creating the log file. We will do it after the database is created.
The following is the reconstruction control file.

Remember the following command.
If all the control files are lost and the version is too old, we need to back up the fault status before recreating the control file.

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
[Oracle @ huang ~] $ Cp/sof/oracle/oradata/orcl // sof/oracle/oradata/orcl. bak-rf
[Oracle @ huang ~] $ Rm/sof/oracle/oradata/orcl/control0 *-rf
[Oracle @ huang ~] $ Ls/sof/oracle/oradata/orcl
Orcl/orcl. bak/
[Oracle @ huang ~] $ Ls/sof/oracle/oradata/orcl
Orcl/orcl. bak/
[Oracle @ huang ~] $ Ls/sof/oracle/oradata/orcl/
Example01.dbf redo02.log sysaux01.dbf temp01.dbf users01.dbf
Redo01.log redo03.log system01.dbf undotbs01.dbf

[Oracle @ huang ~] $ Sqlplus/as sysdba
[Uniread] Loaded history (945 lines)

SQL * Plus: Release 10.2.0.4.0-Production on Mon Jan 4 16:57:00 2010

Copyright (c) 1982,200 7, Oracle. All Rights Reserved.

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area 1090519040 bytes
Fixed Size 1267020 bytes
Variable Size 704645812 bytes
Database Buffers 369098752 bytes
Redo Buffers 15507456 bytes
ORA-00205: error in identifying control file, check alert log for more info

Remove all -- and space rows and spaces at the beginning.

[Oracle @ huang ~] $ Grep-v ^ --/tmp/luo.txt | grep-v ^ $>/tmp/luo1.txt
[Oracle @ huang ~] $ Vim/tmp/luo1.txt
[Oracle @ huang ~] $ Sed-n '1, 23' p/tmp/luo1.txt>/tmp/luo2.txt
Intercept the content between the following two rows. Note that the following line appears for the first time.
STARTUP NOMOUNT
..................
SIZE 30408704 reuse autoextend on next 655360 MAXSIZE 32767 M;

[Oracle @ huang ~] $ Sed-I's/^ // '/tmp/luo2.txt
[Oracle @ huang ~] $ Sed-I's/^ // '/tmp/luo2.txt
[Oracle @ huang ~] $ Sed-I's/^ // '/tmp/luo2.txt
[Oracle @ huang ~] $ Sed-I's/^ // '/tmp/luo2.txt
[Oracle @ huang ~] $ Sed-I's/^ // '/tmp/luo2.txt
[Oracle @ huang ~] $ Vim/tmp/luo2.txt
When you are sure, the lines starting with space and -- are deleted.


SQL> shutdown abort;
ORACLE instance shut down.
SQL> @/tmp/luo2.txt run the script to create a new control file.
ORACLE instance started.

Total System Global Area 1090519040 bytes
Fixed Size 1267020 bytes
Variable Size 704645812 bytes
Database Buffers 369098752 bytes
Redo Buffers 15507456 bytes

Control file created.

Media recovery complete.

Database altered.


Tablespace altered.

SQL> ho ls/sof/oracle/oradata/orcl/
Control01.ctl example01.dbf redo03.log temp01.dbf
Control02.ctl redo01.log sysaux01.dbf undotbs01.dbf
Control03.ctl redo02.log system01.dbf users01.dbf

The above are several methods to restore the control file.

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.