Use backup control files to restore Databases

Source: Internet
Author: User

The backup control file is used to restore the control file with backup in the database. However, after I perform the ddl operation, the current control file is newer than the backup file, and all the control files are lost, how to restore the database using the backup control file?

Step 1: Check the current redo and archive files sys @ PAN> select group #, sequence #, archived, status, first_change # from v $ log; GROUP # SEQUENCE # arc status FIRST_CHANGE # ---------- --- ---------------- ------------- 1 4 no current 443342 2 2 yes inactive 443335 3 3 yes inactive 443338 sys @ PAN> select name from v $ archived_log where name is not null; NAME ------------------------------------------------------------------ --------------/U01/flash_recovery_area/PAN/archivelog/2013_06_23/o1_mf_1_1_8w1_nhky _. arc/u01/flash_recovery_area/PAN/archivelog/2013_06_23/o1_mf_1_2_8w1_njog _. arc/u01/flash_recovery_area/PAN/archivelog/2013_06_23/o1_mf_1_3_8w1_nlhz _. arc Step 2: Cold Standby Step 3: alter database backup controlfile to trace; generate a trace file that can be used to restore the control file, which is a text file. Step 4: alter database backup controlfile to '/backup/pancontrol. Bak'; back up the current control file. Step 5: Create a tablespace, create a table in the tablespace, and add data. The purpose is to change controlfile to a new one. Create tablespace ts_test02 datafile '/u01/oradata/pan/ts_test02_01.dbf' size 10 m; sqlplus scott/tiger create table tb_test02 (id int) tablespace ts_test02; insert into tb_test02 values (1 ); insert into tb_test02 values (2); insert into tb_test02 values (3); commit; in which log file are these changes? Sys @ PAN> select group #, sequence #, archived, status from v $ log; GROUP # SEQUENCE # arc status ---------- --- ---------------- 1 4 no current 2 2 yes inactive 3 3 3 yes inactive Elapsed: 00:00:00. 01 in theory, log 1 will be used for restoration later. Step 6 Delete the current controlfile Step 7 shutdown abort Step 8 Use Backup controlfile dump. [Oracle @ oracle11g pan] $ cp/backup/pancontrol. bak control01.ctl [oracle @ oracle11g pan] $ cp/backup/pancontrol. bak control02.ctl Step 9 from the database to mount, if open will error: sys @ PAN> alter database open; alter database open * ERRORat line 1: ORA-01589: must use RESETLOGS or NORESETLOGS option for database open step 10 tries to use the backup controlfile to restore the database. Recover database using backup controlfile; Result: sys @ PAN> recover database using backup controlfile; ORA-00279: change 443470 generated at 06/23/2013 10:23:49 needed for thread 1 ORA-00289: suggestion: /u01/flash_recovery_area/PAN/archivelog/2013_06_23/o1_mf_1_4 _ % u _. arc ORA-00280: change 443470 for thread 1 is in sequence #4 Specify log: {<RET> = suggested | filename | AUTO | CANCEL} check whether there is this archive log in this directory, No. That is to say, the database will first find your archive log for recovery, but we know that the previous DDL operations have been recorded in the online log no. 1, so I will use the redo log no. 1 for recovery. Continue: recover database using backup controlfile; ORA-00279: change 443470 generated at 06/23/2013 10:23:49 needed for thread 1 ORA-00289: suggestion: /u01/flash_recovery_area/PAN/archivelog/2013_06_23/o1_mf_1_4 _ % u _. arc ORA-00280: change 443470 for thread 1 is in sequence #4 Specifylog: {<RET> = suggested | filename | AUTO | CANCEL}/u01/oradata/pan/redo01.log ORA-00283: recovery session canceled due To errors ORA-01244: unnamed datafile (s) added to control file by media recovery ORA-01110: data file 9: '/u01/oradata/pan/ts_test02_01.dbf' ORA-01112: media recovery not started error again! It says there is no such file, because the log records ts_test02_01.dbf, but there is no such file in the control file. Okay, now let's check what the file in the control file is called. Sys @ PAN> select file #, status, name from v $ datafile; FILE # status name ---------- upload 1 SYSTEM/u01/oradata/pan/system01.dbf 2 ONLINE/u01/oradata/pan/sysaux01.dbf 3 ONLINE/u01/oradata/pan/lxtbs01.dbf 4 ONLINE/u01 /oradata/pan/users01.dbf 5 ONLINE/u01/oradata/pan/undotbs02.dbf 6 ONLINE/u01/oradata/pan/ts_test01.dbf 7 ONLINE/u01/oradata/pan/ts_readonly01.dbf 8 ONLINE/u01/oradata/pan/app2_01.dbf 9 RECOVER/u01/oracle/dbs/UNNAMED00009 9 rows selected. now, the name of the control file is "/u01/oracle/dbs/unnamed1_9". I will rename it to correct first. Sys @ PAN> alter database rename file '/u01/oracle/dbs/unnamed1_9 '2 to'/u01/oradata/pan/ts_test02_01.dbf '; now it is restored again, use redo log 1. Recover database using backup controlfile; ORA-00279: change 443687 generated at 06/23/2013 10:27:38 needed for thread 1 ORA-00289: suggestion:/u01/flash_recovery_area/PAN/archivelog/2013_06_23/latest _ % u _. arc ORA-00280: change 443687 for thread 1 is in sequence #4 Specify log: {<RET> = suggested | filename | AUTO | CANCEL}/u01/oradata/pan/redo01.log Log applied. media recovery complete. indeed, it is restored Success! Step 11 alter database open resetlogs; Step 12 cold backup

 


Related Article

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.