Rumah >pangkalan data >tutorial mysql >Oracle 11g logminer实验
Oracle 11g logminer实验,创建目录:mkdir -p /home/oracle/logmnr,将归档打开,可以为后面的归档分析实验做准备。
创建目录:mkdir -p /home/Oracle/logmnr
将归档打开,,可以为后面的归档分析实验做准备。
安装三个包:
dbmslm.sql
dbmslmd.sql
dbmslms.sql
完毕后,设置utl_file_dir
alter system set utl_file_dir = '/home/oracle/logmnr' scope=spfile;
重启生效
创建数据字典:
begin
dbms_logmnr_d.build(
dictionary_filename=>'logminer_dict.dat',
dictionary_location=>'/home/oracle/logmnr');
end;
/
现在可以创建列表了:
execute dbms_logmnr.add_logfile(options=>dbms_logmnr.new,logfilename=>'/home/oracle/app/oracle/oradata/bdlms/redo11.log');
添加:
execute dbms_logmnr.add_logfile(options=>dbms_logmnr.new,logfilename=>'/home/oracle/app/oracle/oradata/bdlms/redo21.log');
此时可以查看v$logmnr_logs
启用日志分析:
begin
dbms_logmnr.start_logmnr(
dictfilename=>'/home/oracle/logmnr/logminer_dict.dat'
);
end;
/
也可以限制条件:
begin
dbms_logmnr.start_logmnr(
dictfilename=>'/home/oracle/logmnr/logminer_dict.dat',
starttime =>to_date('2012-01-01 16:40:23','YYYY-MM-DD HH24:MI:SS'),
endtime =>to_date('2012-01-02 16:40:00','YYYY-MM-DD HH24:MI:SS')
);
end;
/
观察分析结果:
select sql_redo from v$logmnr_contents;
也可以把此结果保存起来:
create table log_backup as select * from v$logmnr_contents;
最后停掉日志分析:
execute dbms_logmnr.end_logmnr();