Oracle 11g 数据恢复 数据误删除后的恢复 0、执行 select log_mode from v$database;查看是否为归档模式 1、确定删除时间和被删除的表 04-23,GR

Oracle 11g 数据恢复




数据误删除后的恢复


0、执行 select log_mode  from v$database;查看是否为归档模式
1、确定删除时间和被删除的表 04-23,GRDA0
2、执行下面SQL,框定归档文件
   exec DBMS_LOGMNR.START_LOGMNR(OPTIONS => SYS.DBMS_LOGMNR.DICT_FROM_ONLINE_CATALOG); 

3、执行下面语句,把框定的日志文件,增加到logmnr的分析列表中,第一个用dbms_logmnr.NEW,随后的用dbms_logmnr.NEW
exec DBMS_LOGMNR.ADD_LOGFILE('+FLASH/orcl/archivelog/2013_04_22/thread_2_seq_2832.462.813433037',dbms_logmnr.NEW);  
exec DBMS_LOGMNR.ADD_LOGFILE('+FLASH/orcl/archivelog/2013_04_22/thread_2_seq_2833.460.813455987',dbms_logmnr.addfile);  
exec DBMS_LOGMNR.ADD_LOGFILE('+FLASH/orcl/archivelog/2013_04_23/thread_1_seq_2447.457.813463711',dbms_logmnr.addfile);  
exec DBMS_LOGMNR.ADD_LOGFILE('+FLASH/orcl/archivelog/2013_04_23/thread_2_seq_2834.459.813463401',dbms_logmnr.addfile);  
exec DBMS_LOGMNR.ADD_LOGFILE('+FLASH/orcl/archivelog/2013_04_23/thread_2_seq_2835.458.813463683',dbms_logmnr.addfile);  
exec DBMS_LOGMNR.ADD_LOGFILE('+FLASH/orcl/archivelog/2013_04_23/thread_2_seq_2836.456.813485713',dbms_logmnr.addfile);  
exec DBMS_LOGMNR.ADD_LOGFILE('+FLASH/orcl/archivelog/2013_04_23/thread_1_seq_2448.454.813488559',dbms_logmnr.addfile);  
exec DBMS_LOGMNR.ADD_LOGFILE('+FLASH/orcl/archivelog/2013_04_23/thread_2_seq_2837.455.813485725',dbms_logmnr.addfile);  
exec DBMS_LOGMNR.ADD_LOGFILE('+FLASH/orcl/archivelog/2013_04_23/thread_2_seq_2838.451.813535223',dbms_logmnr.addfile);  
exec DBMS_LOGMNR.ADD_LOGFILE('+FLASH/orcl/archivelog/2013_04_23/thread_1_seq_2449.453.813512759',dbms_logmnr.addfile);  
exec DBMS_LOGMNR.ADD_LOGFILE('+FLASH/orcl/archivelog/2013_04_23/thread_1_seq_2450.452.813535249',dbms_logmnr.addfile);  
exec DBMS_LOGMNR.ADD_LOGFILE('+FLASH/orcl/archivelog/2013_04_24/thread_2_seq_2839.449.813549789',dbms_logmnr.addfile);  
exec DBMS_LOGMNR.ADD_LOGFILE('+FLASH/orcl/archivelog/2013_04_24/thread_1_seq_2451.450.813549619',dbms_logmnr.addfile);  


4、执行下面语句,开始分析
exec DBMS_LOGMNR.START_LOGMNR(OPTIONS => SYS.DBMS_LOGMNR.DICT_FROM_ONLINE_CATALOG); 
5、执行下面语句,把被删除数据恢复到临时表中,之前最好先做select,查看是否是要恢复的数据,及要恢复的数据量是否正确
create table X2sp4.aaa as 
select to_char(TIMESTAMP,'yyyy-mm-dd hh24:mi:ss') ts,a.* from v$logmnr_contents a
where table_name = 'DA_GRDA0' AND seg_owner = 'X2SP4' AND operation = 'DELETE'


6、查看aaa表的SQL_UNDO字段,为恢复用的SQL,把这些数据回到到临时表BBB,然后对比恢复数据

你可能感兴趣的:(oracle,日志,数据恢复,归档,lo)