日期:2014-05-16 浏览次数:20430 次
但ORACLE又提供了另外一种机制:
从redo日志或归档日志中恢复该数据,并且更加神奇,ORACLE甚至将其还原为一条条的sql语句!不得不佩服ORACLE的强大功能!
而且该方法还有一点是flashback功能所望尘莫及的:它甚至可以恢复drop掉的表,以及其中的全部语句。
方法如下:
SQL> select member from v$logfile;
?
MEMBER
--------------------------------------------
/home/ora10g/oradata/orcl/redo03.log
/home/ora10g/oradata/orcl/redo02.log
/home/ora10g/oradata/orcl/redo01.log
SQL> EXECUTE DBMS_LOGMNR.ADD_LOGFILE('/home/ora10g/oradata/orcl/redo01.log',DBMS_LOGMNR.NEW);
?
PL/SQL procedure successfully completed.
?
SQL> EXECUTE DBMS_LOGMNR.ADD_LOGFILE('/home/ora10g/oradata/orcl/redo02.log',DBMS_LOGMNR.ADDFILE);
?
PL/SQL procedure successfully completed.
?
SQL> EXECUTE DBMS_LOGMNR.ADD_LOGFILE('/home/ora10g/oradata/orcl/redo03.log',DBMS_LOGMNR.ADDFILE);
?
PL/SQL procedure successfully completed.
?
SQL> EXECUTE DBMS_LOGMNR.START_LOGMNR(options=>16);
?
PL/SQL procedure successfully completed.
?
SQL> select sql_redo from v$logmnr_contents where seg_name='TEST';
?
SQL_REDO
--------------------------------------------
drop table test;
create table test(id integer,name varchar(20)); <----看到了吧^_^删除的表都可以再找回来。
?