Oracle 11g 表空間的誤刪除前傳, 有關控制檔案的備份和恢復(預熱)
--控制檔案備份到跟蹤檔案 sys@TESTDB11>alter database backup controlfile to trace;
Database altered.
--檢視匯出到哪個跟蹤檔案了 sys@TESTDB11>select value from v$diag_info where name = 'Default Trace File';
VALUE ---------------------------------------------------------------------------- /u01/app/oracle/diag/rdbms/testdb11/TestDB11/trace/TestDB11_ora_1656.trc
--檢視跟蹤檔案的內容 [oracle@S1011:/export/home/oracle]$ more /u01/app/oracle/diag/rdbms/testdb11/TestDB11/trace/TestDB11_ora_1656.trc
CREATE CONTROLFILE REUSE DATABASE "TESTDB11" NORESETLOGS ARCHIVELOG MAXLOGFILES 16 MAXLOGMEMBERS 3 MAXDATAFILES 100 MAXINSTANCES 8 MAXLOGHISTORY 292 LOGFILE GROUP 1 '/u01/app/oracle/oradata/TestDB11/redo01.log' SIZE 50M BLOCKSIZE 512, GROUP 2 '/u01/app/oracle/oradata/TestDB11/redo02.log' SIZE 50M BLOCKSIZE 512, GROUP 3 '/u01/app/oracle/oradata/TestDB11/redo03.log' SIZE 50M BLOCKSIZE 512 -- STANDBY LOGFILE DATAFILE '/oradata/system01.dbf', '/oradata/sysaux01.dbf', '/oradata/undotbs01.dbf', '/oradata/users01.dbf', '/oradata/example01.dbf' CHARACTER SET AL32UTF8 ;
--檢視庫中所有的控制檔案 sys@TESTDB11>select name from v$controlfile;
NAME ----------------------------------------------------------------------------------------------------------- /u01/app/oracle/oradata/TestDB11/control01.ctl /u01/app/oracle/fast_recovery_area/TestDB11/control02.ctl
--關庫 sys@TESTDB11>shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down.
--將所有控制檔案移走 [oracle@S1011:/export/home/oracle]$ mv /u01/app/oracle/oradata/TestDB11/control01.ctl /tmp [oracle@S1011:/export/home/oracle]$ mv /u01/app/oracle/fast_recovery_area/TestDB11/control02.ctl /tmp
--現在只能啟動到nomount狀態 sys@TESTDB11>startup ORACLE instance started.
Total System Global Area 855982080 bytes Fixed Size 2230792 bytes Variable Size 641730040 bytes Database Buffers 209715200 bytes Redo Buffers 2306048 bytes ORA-00205: error in identifying control file, check alert log for more info
sys@TESTDB11>select status from v$instance;
STATUS ------------ STARTED
--重建控制檔案 sys@TESTDB11>CREATE CONTROLFILE REUSE DATABASE "TESTDB11" NORESETLOGS ARCHIVELOG 2 MAXLOGFILES 16 3 MAXLOGMEMBERS 3 4 MAXDATAFILES 100 5 MAXINSTANCES 8 6 MAXLOGHISTORY 292 LOGFILE GROUP 1 '/u01/app/oracle/oradata/TestDB11/redo01.log' SIZE 50M BLOCKSIZE 512, GROUP 2 '/u01/app/oracle/oradata/TestDB11/redo02.log' SIZE 50M BLOCKSIZE 512, GROUP 3 '/u01/app/oracle/oradata/TestDB11/redo03.log' SIZE 50M BLOCKSIZE 512 -- STANDBY LOGFILE DATAFILE '/oradata/system01.dbf', '/oradata/sysaux01.dbf', '/oradata/undotbs01.dbf', '/oradata/users01.dbf', '/oradata/example01.dbf' CHARACTER SET AL32UTF8 19 ;
Control file created.
--此時狀態已經為mount了 sys@TESTDB11>select status from v$instance;
STATUS ------------ MOUNTED
--啟庫 sys@TESTDB11>alter database open;
Database altered.
--還有一種方式就是熱備份指令碼的最後一句,備份為二進位制 sys@TESTDB11>alter database backup controlfile to '/pooldisk02/backup01/inconsistent/control01.bak1' reuse;
Database altered. --檢視備份出來的這個二進位制檔案的內容 [oracle@S1011:/export/home/oracle]$ strings /pooldisk02/backup01/inconsistent/control01.bak1 }|{z TESTDB11 TAG20130813T041706 1TESTDB11 1TESTDB11 TestDB11 1,}& 1,}& :+v- a+v- CEv- :+v- a+v- CEv- /u01/app/oracle/oradata/TestDB11/redo02.log /u01/app/oracle/oradata/TestDB11/redo01.log /u01/app/oracle/oradata/TestDB11/redo03.log /oradata/example01.dbf /oradata/users01.dbf /oradata/undotbs01.dbf /oradata/sysaux01.dbf /oradata/system01.dbf pooldisk02/backup01/inconsistent/control01.bak1 /u01/app/oracle/oradata/TestDB11/redo02.log /u01/app/oracle/oradata/TestDB11/redo01.log /u01/app/oracle/oradata/TestDB11/redo03.log /oradata/example01.dbf /oradata/users01.dbf /oradata/undotbs01.dbf /oradata/sysaux01.dbf /oradata/system01.dbf /pooldisk02/backup01/inconsistent/control01.bak1 SYSTEM SYSAUX UNDOTBS1 USERS EXAMPLE TEMP SYSTEM SYSAUX UNDOTBS1 USERS EXAMPLE 1,}& /archive1/1_93_813665348.dbf 1,}& /archive2/1_93_813665348.dbf 0,}& /archive1/1_94_813665348.dbf 0,}& /archive2/1_94_813665348.dbf 1,}& /archive1/1_93_813665348.dbf 1,}& /archive2/1_93_813665348.dbf 0,}& /archive1/1_94_813665348.dbf 0,}& /archive2/1_94_813665348.dbf /archive1/1_95_813665348.dbf /archive2/1_95_813665348.dbf TestDB11 ORACLE_HOME UNNAMED_INSTANCE_2 UNNAMED_INSTANCE_3 UNNAMED_INSTANCE_4 UNNAMED_INSTANCE_5 UNNAMED_INSTANCE_6 UNNAMED_INSTANCE_7 UNNAMED_INSTANCE_8 UNNAMED_INSTANCE_1 UNNAMED_INSTANCE_2 UNNAMED_INSTANCE_3 UNNAMED_INSTANCE_4 UNNAMED_INSTANCE_5 UNNAMED_INSTANCE_6 UNNAMED_INSTANCE_7 UNNAMED_INSTANCE_8 ACM unit testing operation LSB Database Guard Supplemental Log Data DDL LSB Role Change Support RFS block and kill across RAC RAC-wide SGA
--關庫 sys@TESTDB11>shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down.
--移除2個控制檔案 [oracle@S1011:/export/home/oracle]$ mv /u01/app/oracle/oradata/TestDB11/control01.ctl /tmp [oracle@S1011:/export/home/oracle]$ mv /u01/app/oracle/fast_recovery_area/TestDB11/control02.ctl /tmp
--啟庫 sys@TESTDB11>startup ORACLE instance started.
Total System Global Area 855982080 bytes Fixed Size 2230792 bytes Variable Size 641730040 bytes Database Buffers 209715200 bytes Redo Buffers 2306048 bytes ORA-00205: error in identifying control file, check alert log for more info
sys@TESTDB11>select status from v$instance;
STATUS ------------ STARTED
--看一下控制檔案的位置 sys@TESTDB11>show parameter control_file
NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ control_file_record_keep_time integer 7 control_files string /u01/app/oracle/oradata/TestDB 11/control01.ctl, /u01/app/ora cle/fast_recovery_area/TestDB1 1/control02.ctl
--還原回來 sys@TESTDB11>! cp /pooldisk02/backup01/inconsistent/control01.bak1 /u01/app/oracle/oradata/TestDB11/control01.ctl
sys@TESTDB11>! cp /pooldisk02/backup01/inconsistent/control01.bak1 /u01/app/oracle/fast_recovery_area/TestDB11/control02.ctl
--用歷史的控制檔案mount sys@TESTDB11>alter database mount;
Database altered.
--檢視控制控制檔案中記錄的檢查點的資訊 sys@TESTDB11>col name for a30 sys@TESTDB11>select name, checkpoint_change# from v$datafile;
NAME CHECKPOINT_CHANGE# ------------------------------ ------------------ /oradata/system01.dbf 2525453 /oradata/sysaux01.dbf 2525453 /oradata/undotbs01.dbf 2525453 /oradata/users01.dbf 2525453 /oradata/example01.dbf 2525453
--檢視資料檔案中記錄的檢查點資訊(比控制檔案中的新) sys@TESTDB11>select name, checkpoint_change# from v$datafile_header;
NAME CHECKPOINT_CHANGE# ------------------------------ ------------------ /oradata/system01.dbf 2526071 /oradata/sysaux01.dbf 2526071 /oradata/undotbs01.dbf 2526071 /oradata/users01.dbf 2526071 /oradata/example01.dbf 2526071
--此時開庫提示 sys@TESTDB11>alter database open; alter database open * ERROR at line 1: ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
--嘗試使用resetlogs開庫 sys@TESTDB11>alter database open resetlogs; alter database open resetlogs * ERROR at line 1: ORA-01152: file 1 was not restored from a sufficiently old backup ORA-01110: data file 1: '/oradata/system01.dbf'
--嘗試直接恢復 sys@TESTDB11>recover database; ORA-00283: recovery session canceled due to errors ORA-01610: recovery using the BACKUP CONTROLFILE option must be done
--指定使用歷史的控制檔案進行恢復,但歸檔日誌沒歸檔出來 sys@TESTDB11>recover database using backup controlfile; ORA-00279: change 2525716 generated at 08/13/2013 04:13:38 needed for thread 1 ORA-00289: suggestion : /archive2/1_96_813665348.dbf ORA-00280: change 2525716 for thread 1 is in sequence #96
Specify log: {<RET>=suggested | filename | AUTO | CANCEL} auto ORA-00308: cannot open archived log '/archive2/1_96_813665348.dbf' ORA-27037: unable to obtain file status Solaris-AMD64 Error: 2: No such file or directory Additional information: 3
ORA-00308: cannot open archived log '/archive2/1_96_813665348.dbf' ORA-27037: unable to obtain file status Solaris-AMD64 Error: 2: No such file or directory Additional information: 3
--確定需要的96號日誌還沒有歸檔出來 sys@TESTDB11>select sequence#, group#, status from v$log;
SEQUENCE# GROUP# STATUS ---------- ---------- ---------------- 94 1 INACTIVE 96 3 CURRENT 95 2 INACTIVE
--確定是哪個聯機重做日誌檔案 sys@TESTDB11>col member for a50 sys@TESTDB11>select group#, member from v$logfile;
GROUP# MEMBER ---------- -------------------------------------------------- 2 /u01/app/oracle/oradata/TestDB11/redo02.log 1 /u01/app/oracle/oradata/TestDB11/redo01.log 3 /u01/app/oracle/oradata/TestDB11/redo03.log
--再次進行恢復,指定使用特定的日誌檔案 sys@TESTDB11>recover database using backup controlfile; ORA-00279: change 2525716 generated at 08/13/2013 04:13:38 needed for thread 1 ORA-00289: suggestion : /archive2/1_96_813665348.dbf ORA-00280: change 2525716 for thread 1 is in sequence #96
Specify log: {<RET>=suggested | filename | AUTO | CANCEL} /u01/app/oracle/oradata/TestDB11/redo03.log -- 直接輸入需要的聯機重做日誌 Log applied. Media recovery complete.
sys@TESTDB11>alter database open resetlogs;
Database altered.
--檢視已經備份的歸檔日誌 sys@TESTDB11>select sequence#, name from v$archived_log;
SEQUENCE# NAME ---------- ------------------------------ 93 /archive1/1_93_813665348.dbf 93 /archive2/1_93_813665348.dbf 94 /archive1/1_94_813665348.dbf 94 /archive2/1_94_813665348.dbf 95 /archive1/1_95_813665348.dbf 95 /archive2/1_95_813665348.dbf 94 /archive1/1_94_813665348.dbf 94 /archive2/1_94_813665348.dbf 95 /archive1/1_95_813665348.dbf 95 /archive2/1_95_813665348.dbf 96 /archive1/1_96_813665348.dbf 96 /archive2/1_96_813665348.dbf
12 rows selected.
--對整個庫進行非一致性備份 sys@TESTDB11>@backup_script/backup02.sql |
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/17013648/viewspace-1153856/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle 11g 表空間的誤刪除, 當前的控制檔案不識別該表空間Oracle
- 表空間不完全恢復(全備--備份控制檔案--刪除表空間andy--日誌檔案)
- Oracle 11g RAMN恢復-控制檔案的備份和恢復Oracle
- Oracle 11g RMAN恢復-使用者誤刪除表空間Oracle
- flashback database 恢復誤刪除的表空間。Database
- oracle誤刪除表空間的資料檔案Oracle
- ORACLE 11g TSPITR恢復被刪除的表空間Oracle
- undo表空間檔案丟失恢復(1)--有備份
- 控制檔案的備份和恢復
- 【物理熱備】(下)備份恢復系統表空間 手工備份恢復
- 刪除表空間和表空間包含的檔案
- oracle8i誤刪除臨時表空間後的恢復Oracle
- Oracle恢復誤刪除的資料檔案Oracle
- Oracle系統表空間剛新增的一個資料檔案誤刪除恢復處理Oracle
- lsof恢復oracle誤刪除檔案Oracle
- undo表空間檔案丟失恢復(2)--無備份有redo的情況下恢復
- 全備份情況下,刪除控制檔案及恢復
- 不完全恢復(資料檔案備份--新建表空間--控制檔案備份--日誌歸檔檔案)
- 備份與恢復--利用備份的控制檔案恢復
- Oracle備份與恢復【丟失控制檔案的恢復】Oracle
- 不完全恢復(全備--備份控制檔案--新建表空間andy--日誌檔案)
- Oracle 11g RMAN恢復-只讀表空間的恢復(備份是在表空間只讀狀態下做的)Oracle
- ORACLE 11G沒有備份檔案引數檔案在異機通過rman備份恢復找回被誤刪的資料Oracle
- 【北亞資料恢復】誤刪除oracle表和誤刪除oracle表資料的資料恢復方法資料恢復Oracle
- 【備份恢復】利用 備份控制檔案到指定目錄下的控制檔案 恢復控制檔案
- Oracle rman 備份與恢復 臨時表空間的檔案問題解決Oracle
- 刪除表空間,有rman全備的恢復(使用dbms_backup_restore來進行恢復)REST
- 利用備份的控制檔案恢復
- 誤刪除資料檔案、控制檔案的非RMAN恢復方法
- Oracle 11g資料庫恢復:場景10:新建表空間沒有備份Oracle資料庫
- 備份與恢復系列 十一 控制檔案的備份與恢復
- 使用lsof恢復誤刪除的檔案
- oracle 失誤刪掉資料檔案後,刪除表空間操作Oracle
- oracle11g 資料檔案誤刪恢復(無備份)Oracle
- 【管理篇備份恢復】rman恢復測試(一) 表空間資料檔案
- 非歸檔庫誤刪表空間後的資料恢復資料恢復
- RMAN備份恢復之控制檔案的恢復(三)
- RMAN備份恢復之控制檔案的恢復(二)