ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 异机logminer分析11g r2 rac的日志(linux环境)

异机logminer分析11g r2 rac的日志(linux环境)

原创 Linux操作系统 作者:pangzi913 时间:2012-05-18 08:21:22 0 删除 编辑
主环境:11g R2 rac
测试环境:11g R2 rac
os:centos 5
测试环境是从生产环境恢复的数据库。现在用测试环境分析主环境的日志。报错:
SQL> EXECUTE dbms_logmnr.start_logmnr(DictFileName=>'/tmp/logs/dict.ora');
BEGIN dbms_logmnr.start_logmnr(DictFileName=>'/tmp/logs/dict.ora'); END;
*
ERROR at line 1:
ORA-01295: DB_ID mismatch between dictionary /tmp/logs/dict.ora and logfiles
ORA-06512: at "SYS.DBMS_LOGMNR", line 58
ORA-06512: at line 1

========================================

环境搭建:
alter system set UTL_FILE_DIR ='/tmp/logs/' scope=both;
UTL_FILE_DIR ='/tmp/logs/'
@/u01/app/oracle/product/11.2.0/db_1/rdbms/admin/dbmslmd.sql
@/u01/app/oracle/product/11.2.0/db_1/rdbms/admin/dbmslm.sql
@/u01/app/oracle/product/11.2.0/db_1/rdbms/admin/dbmslms.sql

ALTER DATABASE ADD SUPPLEMENTAL LOG DATA (PRIMARY KEY, UNIQUE INDEX) COLUMNS;

UTL_FILE_DIR ='/tmp/logs/'

创建数据字典:
EXECUTE dbms_logmnr_d.build(dictionary_filename =>'dict.ora',dictionary_location =>'/tmp/logs');

增加日志文件分析    
EXECUTE dbms_logmnr.add_logfile(LogFileName=>'/u01/oradata/archlog/1_23551_766249125.arc',Options=>dbms_logmnr.new);                                                                                    
EXECUTE dbms_logmnr.add_logfile(LogFileName=>'/u01/oradata/archlog/2_20910_766249125.arc',Options=>dbms_logmnr.addfile);


执行分析日志:
SQL> EXECUTE dbms_logmnr.start_logmnr(DictFileName=>'/tmp/logs/dict.ora');
BEGIN dbms_logmnr.start_logmnr(DictFileName=>'/tmp/logs/dict.ora'); END;
*
ERROR at line 1:
ORA-01295: DB_ID mismatch between dictionary /tmp/logs/dict.ora and logfiles
ORA-06512: at "SYS.DBMS_LOGMNR", line 58
ORA-06512: at line 1

======================================
最后解决方法:select dbid from v$database;查出生产环境的dbid,发现分别在rac的2台主机上查找的dbid都是一样的。
修改字典文件dict.ora中dbid。
EXECUTE dbms_logmnr.start_logmnr(DictFileName=>'/tmp/logs/dict.ora');
正常执行。

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/7633405/viewspace-730084/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2008-11-22

  • 博文量
    40
  • 访问量
    61884