LogMiner 配置
参考文档:<>P275
对于RAC环境,只要在一个节点上做。对所有参数修改,都必须确保有反映到所使用的spfiledzzds_p.ora
RAC环境中,两个节点的dictionary内容上是一致的。
这里不能改变以前的supplemental log 会影响GoldenGate
1 安装logminer
要安装logminer工具,必须首先要运行下面这样两个脚本,
SQL> @?/rdbms/admin/dbmslm.sql
SQL> @?/rdbms/admin/dbmslmd.sql
这两个脚本必须均以SYS用户身份运行。其中第一个脚本用来创建DBMS_LOGMNR包,该包用来分析日志文件。第二个脚本用来创建DBMS_LOGMNR_D包,该包用来创建数据字典文件
。
2 perform initial setup activities
open supplemental logging
SQL> alter database add supplemental log data;
drop supplemental logging
SQL> ALTER DATABASE DROP SUPPLEMENTAL LOG DATA;
use alternate tablespace to store LogMiner tables. by default, SYSTEM is used.
SQL> EXECUTE DBMS_LOGMNR_D.SET_TABLESPACE('tools');
3 extract the dictionary to a flat file.
# mkdir /u01/oracle/oradict
SQL> alter system set UTL_FILE_DIR ='/u01/oracle/oradict/' scope=spfile;
SQL> shutdown immediate
SQL> startup
SQL> CONNECT SYS
SQL> EXECUTE dbms_logmnr_d.build('dictionary.ora', '/u01/oracle/oradict/');
4 specify redo logs for analysis
add the first log to LogMiner log list
SQL>
execute dbms_logmnr.add_logfile( logfilename=>'/u01/oracle/archivelog/his1/1_7.dbf', options=> dbms_logmnr.new);
add more log to LogMiner log list
SQL> execute dbms_logmnr.add_logfile( logfilename=>'/u01/oracle/archivelog/dzzds20/xxx1.log',options=> dbms_logmnr.addfile);
or option is not necessary
SQL> execute dbms_logmnr.add_logfile( logfilename=>'/u01/oracle/archivelog/dzzds20/xxx2.log');
if desired, remove redo logs.
SQL> execute dbms_logmnr.add_logfile( logfilename=>'/u01/oracle/archivelog/dzzds20/xxx1.log',options=> dbms_logmnr.removefile);
5 start a LogMiner Session
SQL> execute dbms_logmnr.start_logmnr(dictfilename=>'/u01/oracle/oradict/dictionary.ora');
or add some restriction,time,scn, commited etc.
SQL> execute dbms_logmnr.start_logmnr(
DictFileName =>'f:\logminer\dictionary.ora',
StartTime => to_date('2004-9-18 00:00:00','YYYY-MM-DD HH24:MI:SS')
EndTime => to_date('2004-9-18 23:59:59','YYYY-MM-DD HH24:MI:SS '));
6 query v$LOGMNR_CONTENTS
SQL> SELECT sql_redo,sql_undo FROM v$logmnr_contents WHERE username='test' AND seg_name='t_test';
需要强调一点的是,视图v$logmnr_contents中的分析结果仅在我们运行过程'dbms_logmrn.start_logmnr'这个会话的生命期中存在。这是因为所有的logminer存储都在PGA内
存中,所有其他的进程是看不到它的,同时随着进程的结束,分析结果也随之消失。
7 end a logminer session
SQL> EXECUTE DBMS_LOGMNR.END_LOGMNR;
阅读(2868) | 评论(0) | 转发(0) |