以下内容需要在一个会话里面操作,否则不生效:
1、配置需要挖掘的归档日志
begin
dbms_logmnr.add_logfile(logfilename => '/u01/arch/1_3797_910177675.dbf',options=> dbms_logmnr.NEW);
dbms_logmnr.add_logfile(logfilename=>'/u01/arch/1_3798_910177675.dbf',options=>dbms_logmnr.ADDFILE);
dbms_logmnr.add_logfile(logfilename=>'/u01/arch/1_3799_910177675.dbf',options=>dbms_logmnr.ADDFILE);
dbms_logmnr.add_logfile(logfilename=>'/u01/arch/1_3800_910177675.dbf',options=>dbms_logmnr.ADDFILE);
dbms_logmnr.add_logfile(logfilename=>'/u01/arch/1_3801_910177675.dbf',options=>dbms_logmnr.ADDFILE);
dbms_logmnr.add_logfile(logfilename=>'/u01/arch/1_3802_910177675.dbf',options=>dbms_logmnr.ADDFILE);
dbms_logmnr.add_logfile(logfilename=>'/u01/arch/1_3803_910177675.dbf',options=>dbms_logmnr.ADDFILE);
dbms_logmnr.add_logfile(logfilename=>'/u01/arch/1_3804_910177675.dbf',options=>dbms_logmnr.ADDFILE);
dbms_logmnr.add_logfile(logfilename=>'/u01/arch/1_3805_910177675.dbf',options=>dbms_logmnr.ADDFILE);
dbms_logmnr.add_logfile(logfilename=>'/u01/arch/1_3806_910177675.dbf',options=>dbms_logmnr.ADDFILE);
dbms_logmnr.add_logfile(logfilename=>'/u01/arch/1_3807_910177675.dbf',options=>dbms_logmnr.ADDFILE);
dbms_logmnr.add_logfile(logfilename=>'/u01/arch/1_3808_910177675.dbf',options=>dbms_logmnr.ADDFILE);
dbms_logmnr.add_logfile(logfilename=>'/u01/arch/1_3809_910177675.dbf',options=>dbms_logmnr.ADDFILE);
dbms_logmnr.add_logfile(logfilename=>'/u01/arch/1_3810_910177675.dbf',options=>dbms_logmnr.ADDFILE);
dbms_logmnr.start_logmnr(StartTime => to_date('2016-7-11 22:03:00','YYYY-MM-DD HH24:MI:SS'),
EndTime => to_date('2016-7-11 22:18:00','YYYY-MM-DD HH24:MI:SS'));
end;
其中StartTime与EndTime的值必须在归档日志对应的时间范围内,否则会报错。
2、查询记录
select * from v$logmnr_contents;
v$logmnr_contents字段的含义见官方文档。