1、創建數據字典文件(data-dictionary)
(1)首先在init.ora初始化參數文件中,指定數據字典文件的位置,也就是添加壹個參數UTL_FILE_DIR,該參數值為服務器中放置數據字典文件的目錄。
如:UTL_FILE_DIR = ($ORACLE_HOME\logs) ,重新啟動數據庫,使新加的參數生效。
(2)創建數據字典文件:
SQL> connect /as sysdba
SQL> execute dbms_logmnr_d.build(dictionary_filename =>
'dict.ora',dictionary_location => 'G:\oracle\logs');
PL/SQL procedure successfully completed
2、創建要分析的日誌文件列表:
(1)創建分析列表,即所要分析的日誌:
SQL> execute dbms_logmnr.add_logfile(LogFileName =>
'G:\ORACLE\ORADATA\ORADBSP\REDO04.LOG',Options => dbms_logmnr.new);
PL/SQL procedure successfully completeds
(2)添加分析日誌文件(壹次添加1個為宜):
SQL>
execute dbms_logmnr.add_logfile(LogFileName =>
'G:\ORACLE\ORADATA\ORADBSP\REDO05.LOG',
Options => dbms_logmnr.ADDFILE);
PL/SQL procedure successfully completed
3、使用logMiner進行日誌分析:
(1)無限制條件,即用數據字典文件對要分析的日誌文件所有內容做分析:
SQL> execute dbms_logmnr.start_logmnr
(DictFileName => 'G:\oracle\logs\dict.ora');
PL/SQL procedure successfully completed