Oracle control file recovery involves backup, control file creation scripts, and no 3

Source: Internet
Author: User
The recovery of the control file is divided into two steps: 1. Restore from backup; 2. Restore from redo log. 1. Backup control file recovery control files are classified by backup time span: 1 ). online image backup: the current control file, that is, the control file that the control_files initialization parameter points to except the corrupt control file; 2 ). structure backup: After the backup of the Control File

The recovery of the control file is divided into two steps: 1. Restore from backup; 2. Restore from redo log. 1. Backup control file recovery control files are classified by backup time span: 1 ). online image backup: the current control file, that is, the control file that the control_files initialization parameter points to except the corrupt control file; 2 ). structure backup: After the backup of the Control File

There are two steps to restore the control file:

1. Restore from backup;

2. Use the redo log to restore.


1. Backup control file recovery

Control files are classified by backup time span:

1) online image backup: the current control file, that is, the control file other than the corrupt control file pointed to by the control_files initialization parameter;

2). Structure backup: After the backup of the control file, the database structure does not change (for example, adding or deleting tablespaces and redoing log files );

3). Historical backup: the database structure changes after the backup of the control file.

After the control file is corrupted

1. SQL> shutdown abort

2. SQL> startup

Error message ora-00205 control file error or ora-00227 control file bad block, database started to started status


3. Check whether online image Backup exists. If yes, follow these steps:

1) Check the warning log to determine which control files are damaged;

2) copy the correct control file to the location of the damaged control file;

3) SQL> alter database mount;

4) SQL> alter database open;


Otherwise, check whether there is a structure backup. If yes, follow these steps to restore the backup:

1) Enter rman: rman target/

2) restore the control file from the backup

RMAN> restore controlfile from autobackup; (automatic backup)

Or

RMAN> restore controlfile from 'location of the control file for manual backup '; (manual backup)

3) set the database to the mount status

RMAN> alter database mount;

4) Media recovery

RMAN> recover database;

5) RMAN> alter database open resetlogs;


If only historical backup is available:

Inconsistency may occur after the historical backup is used. You need to manually fix the inconsistency in the following two cases:

1) The backup control file contains information about a data file or tablespace, but does not actually exist.

2) There is no online log group information in the backup, but it actually exists (use recover database using backup controlfile to enter the corresponding online Log Path in the prompt during recovery)


A. The recovery steps are the same as those for manual backup of the structure backup for Automatic Recovery inconsistencies.

B. the backup control file contains information about a data file or tablespace, but does not actually exist.

1) Enter rman: rman target/

2) restore the control file from the backup

RMAN> restore controlfile from 'location of the control file for manual backup '; (manual backup)

3) set the database to the mount status

RMAN> alter database mount;

4) in this case, you cannot directly reply to the database, but should ignore the lost data file or table space.

Data file:

SQL> alter database datafile File No. offline; (data file)

Restore database

SQL> recover database using backup controlfile;

Tablespace (including all data files in the tablespace ):

SQL> recover database skip tablespace name;

5) RMAN> alter database open resetlogs;


2. There is no control file backup, but the control file is tracked and backed up, that is, there is a script for creating the control file

1. SQL> shutdown abort

2. SQL> startup

Error message ora-00205 control file error or ora-00227 control file bad block, database started to started status

3. Find the backup trace file and extract the script for creating the control file from it. createctl. SQL


4. Execute the script createctl. SQL

SQL> @ createctl. SQL


3. If there is no backup or trace backup for the control file, you need to manually create the control file

1. SQL> shutdown abort

2. SQL> startup

Error message ora-00205 control file error or ora-00227 control file bad block, database started to started status

3. manually create a control file
SQL> create controlfile reuse (/set) database "database Name" noresetlogs (/resetlogs is used only when online logs is corrupted) noarchivelog
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
# MAXLOGHISTORY 4672
LOGFILE
GROUP 1 'Directory of redo log 1 'SIZE 50 M,
GROUP 2 'Directory of redo log 2 'SIZE 50 M,
GROUP 3 'Directory of redo log 3 'SIZE 50 M
DATAFILE
'Data file directory/system01.dbf ',
'Data file directory/undotbs01.dbf ',
'Data file directory/sysaux01.dbf ',
'Data file directory/users01.dbf ',
'Data file directory/info01.dbf' (excluding temp files)
Character set ZHS16GBK
;
Prompt: Creation successful

4. Media recovery
SQL> RECOVER DATABASE
SQL> ALTER DATABASE OPEN;
SQL> ALTER TABLESPACE TEMP ADD TEMPFILE 'temp file directory/temp01.dbf'
SIZE 1244667904 reuse autoextend on next 655360 MAXSIZE 32767 M;


After the restoration is complete, remember to back up the control file.
Backup Control File
Alter database backup controlfile to 'f: \ ORACLE \ BACKUP \ TEST. Bak ';
Alter database backup controlfile to trace as 'directory'; -- generate the script for creating the control file, which can be viewed through show parameter user_dump_dest.






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.