Oracle Control File Corruption recovery

Source: Internet
Author: User

1. Use the trace file to restore

SQL> alter database backup controlfile to trace; -- back up the control file to the trace file

Database altered.
 
SQL> @ gettrace -- get the path of the trace file
 
TRACE_FILE_NAME
--------------------------------------------------------------------------------
/Oracle/app/admin/ora10g/udump/ora10g_ora_300000.trc
 
SQL>!
Oracle@www.bkjia.com ~ $ More/oracle/app/admin/ora10g/udump/ora10g_ora_300000.trc
 
/Oracle/app/admin/ora10g/udump/ora10g_ora_300000.trc
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0-Production
With the Partitioning, OLAP and Data Mining options
ORACLE_HOME =/oracle/app/oracle/product/10.2.0/db_1
System name: Linux
Node name: www.bkjia.com
Release: 2.6.18-164. el5
.
.
.
 
-- ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE
STARTUP NOMOUNT
Create controlfile reuse database "ORA10G" NORESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
# MAXLOGHISTORY 292
LOGFILE
GROUP 1'/oradata/ora10g/redo01.log' SIZE 50 M,
GROUP 2'/oradata/ora10g/redo02.log 'SIZE 50 M,
GROUP 3 '/oradata/ora10g/redo03.log' SIZE 50 M
-- STANDBY LOGFILE
DATAFILE
'/Oradata/ora10g/system01.dbf ',
'/Oradata/ora10g/undotbs01.dbf ',
.
.
.
 
Alter tablespace temp add tempfile '/oradata/ora10g/temp01.dbf'
SIZE 20971520 reuse autoextend on next 655360 MAXSIZE 32767 M;
-- End of tempfile additions.
--
 
[Oracle@www.bkjia.com udump] $ cd
Oracle@www.bkjia.com ~ $ Vim recontro. SQL -- copy the useful statements in the trace file to recreate the control file. If no trace file has been backed up before, we can start from init {SID }. obtain the data file, log file, database tablespace, and other information in the ora file, and put init {SID }. the contents of the ora file are created in the following format:
 
STARTUP NOMOUNT
Create controlfile reuse database "ORA10G" NORESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
# MAXLOGHISTORY 292
LOGFILE
GROUP 1'/oradata/ora10g/redo01.log' SIZE 50 M,
GROUP 2'/oradata/ora10g/redo02.log 'SIZE 50 M,
GROUP 3 '/oradata/ora10g/redo03.log' SIZE 50 M
DATAFILE
'/Oradata/ora10g/system01.dbf ',
'/Oradata/ora10g/undotbs01.dbf ',
'/Oradata/ora10g/sysaux01.dbf ',
'/Oradata/ora10g/users01.dbf'
Character set ZHS16GBK
;
Variable recno number;
EXECUTE: RECNO: = SYS. DBMS_BACKUP_RESTORE.SETCONFIG ('controlfile AUTOBACKUP ', 'off ');
RECOVER DATABASE
Alter system archive log all;
Alter database open;
SIZE 20971520 reuse autoextend on next 655360 MAXSIZE 32767 M;
STARTUP NOMOUNT
Create controlfile reuse database "ORA10G" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
# MAXLOGHISTORY 292
LOGFILE
GROUP 1'/oradata/ora10g/redo01.log' SIZE 50 M,
GROUP 2'/oradata/ora10g/redo02.log 'SIZE 50 M,
GROUP 3 '/oradata/ora10g/redo03.log' SIZE 50 M
DATAFILE
'/Oradata/ora10g/system01.dbf ',
'/Oradata/ora10g/undotbs01.dbf ',
'/Oradata/ora10g/sysaux01.dbf ',
'/Oradata/ora10g/users01.dbf'
Character set ZHS16GBK
;
Variable recno number;
EXECUTE: RECNO: = SYS. DBMS_BACKUP_RESTORE.SETCONFIG ('controlfile AUTOBACKUP ', 'off ');
RECOVER DATABASE USING BACKUP CONTROLFILE
Alter database open resetlogs;
SIZE 20971520 reuse autoextend on next 655360 MAXSIZE 32767 M;
"Recontro. SQL" 49L, 1641C written
Oracle@www.bkjia.com ~ $ Sqlplus/as sysdba
 
SQL * Plus: Release 10.2.0.1.0-Production on Tue Jul 19 03:30:34 2011
 
Copyright (c) 1982,200 5, Oracle. All rights reserved.
 
 
Connected:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0-Production
With the Partitioning, OLAP and Data Mining options
 
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> set echo on -- enable display output
SQL> @ recontro -- use the script of the newly created refactoring control file to recreate the control file
SQL> STARTUP NOMOUNT
ORACLE instance started.
 
Total System Global Area 209715200 bytes
Fixed Size 1218556 bytes
Variable Size 75499524 bytes
Database Buffers 130023424 bytes
Redo Buffers 2973696 bytes
SQL> CREATE CONTROLFILE REUSE DATABASE "ORA10G" NORESETLOGS ARCHIVELOG
2 MAXLOGFILES 16
3 MAXLOGMEMBERS 3
4 MAXDATAFILES 100
5 MAXINSTANCES 8
6 MAXLOGHISTORY 292
7. LOGFILE
8 GROUP 1'/oradata/ora10g/redo01.log' SIZE 50 M,
9 GROUP 2'/oradata/ora10g/redo02.log 'SIZE 50 M,
10 GROUP 3'/oradata/ora10g/redo03.log' SIZE 50 M
11 DATAFILE
12'/oradata/ora10g/system01.dbf ',
13 '/oradata/ora10g/undotbs01.dbf ',
14'/oradata/ora10g/sysaux01.dbf ',
15'/oradata/ora10g/users01.dbf'
16 character set ZHS16GBK
17;
 
Control file created.
 
SQL> VARIABLE RECNO NUMBER;
SQL> EXECUTE: RECNO: = SYS. DBMS_BACKUP_RESTORE.SETCONFIG ('controlfile AUTOBACKUP ', 'off ');
 
PL/SQL procedure successfully completed.
 
SQL> RECOVER DATABASE
 
SQL> ALTER SYSTEM ARCHIVE LOG ALL;
 
System altered.
 
SQL> ALTER DATABASE OPEN;
 
Database altered.
 
SQL> ALTER TABLESPACE TEMP ADD TEMPFILE '/oradata/ora10g/temp01.dbf'
2 SIZE 20971520 reuse autoextend on next 655360 MAXSIZE 32767 M;
 
Tablespace altered.
 
SQL> STARTUP NOMOUNT
ORA-01081: cannot start already-running ORACLE-shut it down first
SQL> CREATE CONTROLFILE REUSE DATABASE "ORA10G" RESETLOGS ARCHIVELOG
2 MAXLOGFILES 16
3 MAXLOGMEMBERS 3
4 MAXDATAFILES 100
5 MAXINSTANCES 8
6 MAXLOGHISTORY 292
7. LOGFILE
8 GROUP 1'/oradata/ora10g/redo01.log' SIZE 50 M,
9 GROUP 2'/oradata/ora10g/redo02.log 'SIZE 50 M,
10 GROUP 3'/oradata/ora10g/redo03.log' SIZE 50 M
11 DATAFILE
12'/oradata/ora10g/system01.dbf ',
13 '/oradata/ora10g/undotbs01.dbf ',
14'/oradata/ora10g/sysaux01.dbf ',
15'/oradata/ora10g/users01.dbf'
16 character set ZHS16GBK
17;
Create controlfile reuse database "ORA10G" RESETLOGS ARCHIVELOG
 
SQL> VARIABLE RECNO NUMBER;
SQL> EXECUTE: RECNO: = SYS. DBMS_BACKUP_RESTORE.SETCONFIG ('controlfile AUTOBACKUP ', 'off ');
 
PL/SQL procedure successfully completed.
 
SQL> RECOVER DATABASE USING BACKUP CONTROLFILE
 
SQL> ALTER DATABASE OPEN RESETLOGS;
 
SQL> ALTER TABLESPACE TEMP ADD TEMPFILE '/oradata/ora10g/temp01.dbf'
2 SIZE 20971520 reuse autoextend on next 655360 MAXSIZE 32767 M;
Alter tablespace temp add tempfile '/oradata/ora10g/temp01.dbf'
 
Tablespace altered.
SQL> select open_mode from v $ database;
 
OPEN_MODE
----------
READ WRITE

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.