使用LogMiner查看归档日志
查看归档文件序号
select sequence#,first_time from v$log_history order by first_time desc;
查看归档日志大小
du -m 归档日志文件
用sql语句确定要分析的归档日志文件
select t.first_time,t.name from v$archived_log t order by t.first_time desc;
使用LogMiner分析数据
exec sys.dbms_logmnr.add_logfile(logfilename =>'+fra/orcl/ARCHIVELOG/2017_12_20/thread_4_seq_44812.51752.963273579',options => dbms_logmnr.new);
启动LogMiner
execute dbms_logmnr.start_logmnr (options=>dbms_logmnr.dict_from_online_catalog);
把分析数据放入表中。
create table logminer_20171220 tablespace ypt as select * from v$logmnr_contents;
授予表给普通用户
grant select on logminer_20171220 to emr_ehr;
结束LogMiner分析
execute dbms_logmnr.end_logmnr
查看分析日志的结果
select t.scn,t.timestamp,t.table_name,t.sql_redo,t.sql_undo, t.rowid from logminer_20171220 t; 或者
select t.scn,t.operation,t.timestamp,t.table_name,t.sql_redo,t.sql_undo from logminer_20171220 t;