用物理備庫的檔案來恢復主庫

aaqwsh發表於2011-04-09

如果主庫丟失資料檔案或者檔案壞掉時,可以拷貝物理備庫對應的資料檔案方式用來恢復主庫:

 

SQL> alter system switch logfile;

System altered.

SQL> alter database datafile '/data/ora10g/RACDBSTD/TEST01.DBF' offline drop;

Database altered.

SQL>  alter system switch logfile;

System altered.

SQL> alter database datafile '/data/ora10g/RACDBSTD/TEST01.DBF' online;
alter database datafile '/data/ora10g/RACDBSTD/TEST01.DBF' online
*
ERROR at line 1:
ORA-01113: file 6 needs media recovery
ORA-01110: data file 6: '/data/ora10g/RACDBSTD/TEST01.DBF'


SQL> recover datafile 6;
ORA-00279: change 982515 generated at 04/09/2011 09:23:53 needed for thread 1
ORA-00289: suggestion : /data/ora10g/RACDBSTD/arch/1_3_745800569.dbf
ORA-00280: change 982515 for thread 1 is in sequence #3


Specify log: {=suggested | filename | AUTO | CANCEL}
auto
ORA-00279: change 982516 generated at 04/09/2011 09:25:04 needed for thread 1
ORA-00289: suggestion : /data/ora10g/RACDBSTD/arch/1_4_745800569.dbf
ORA-00280: change 982516 for thread 1 is in sequence #4
ORA-00278: log file '/data/ora10g/RACDBSTD/arch/1_3_745800569.dbf' no longer
needed for this recovery


ORA-00279: change 982601 generated at 04/09/2011 09:25:18 needed for thread 1
ORA-00289: suggestion : /data/ora10g/RACDBSTD/arch/1_5_745800569.dbf
ORA-00280: change 982601 for thread 1 is in sequence #5
ORA-00278: log file '/data/ora10g/RACDBSTD/arch/1_4_745800569.dbf' no longer
needed for this recovery


Log applied.
Media recovery complete.
SQL>
SQL> alter database datafile '/data/ora10g/RACDBSTD/TEST01.DBF' online;

Database altered.

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/758322/viewspace-692004/,如需轉載,請註明出處,否則將追究法律責任。

相關文章