创建数据字典的目的就是让LogMiner引用涉及到内部数据字典中的部分时为他们实际的名字,而不是系统内部的16进制。
数据字典文件是一个文本文件,使用包DBMS_LOGMNR_D来创建。
如果我们要分析的数据库中的表有变化,影响到库的数据字典也发生变化,这时就需要重新创建该字典文件。另外一种情况是在分析另外一个数据库文件的重作日志时,也必须要重新生成一遍被分析数据库的数据字典文件。
Research Transactions with Log Miner
This tip comes from Ron Warshawsky, Sr. Production DBA for Arzoon.com in Palo Alto, CA
Oracle's Log Miner allows researching database transactions recorded in the online and archive redo logs. It can be a very useful tool to undo logical database corruption.
Preconditions:
Set initialization parameter UTL_FILE_DIR to the valid directory.
Run script dbmslmd.sql to create necessary packages.
--------------------------------------------------------------------------------
1. Build log miner dictionary (rebuild after database objects created or modified).
execute dbms_logmnr_d.build ( 'db_name_lm_dict.ora', '/export/home/oracle/admin/db_name/ufile );
2. To create list of redo / archive logs for analysis, execute:
BEGIN
dbms_logmnr.add_logfile(
options => dbms_logmnr.NEW,
logfilename => '/export/home/oracle/oradata/db_name/redo01.log' );
dbms_logmnr.add_logfile(
options => dbms_logmnr.ADDFILE,
logfilename => '/export/home/oracle/oradata/db_name/redo02.log' );
dbms_logmnr.start_logmnr(
dictfilename => '/export/home/oracle/admin/db_name/ufile/db_name_lm_dict.ora'
);
END;
/
3. Research stored transactions, using view V$LOGMNR_CONTENTS.
Example:
SELECT TIMESTAMP, USERNAME, OPERATION, SQL_REDO, SQL_UNDO FROM v$logmnr_contents order by 1 desc;
4. To finish:
EXECUTE dbms_logmnr.end_logmnr();