Saturday, January 10, 2009

ORA-01295: DB_ID mismatch between dictionary USE_ONLINE_CATALOG and logfiles

Problem Description
While doing remote mining in the mining database through logminer START_LOGMNR procedure fails with ORA-01295. May be you want to analysis redo log files of the production database in the testing environment.
SQL> BEGIN
DBMS_LOGMNR.START_LOGMNR
(options =>
dbms_logmnr.dict_from_online_catalog);
END;
/
2 3 4 5 6
BEGIN
*
ERROR at line 1:
ORA-01295: DB_ID mismatch between dictionary USE_ONLINE_CATALOG and logfiles
ORA-06512: at "SYS.DBMS_LOGMNR", line 58
ORA-06512: at line 2

Cause of The Problem
The error occurs because the dictionary file produced by a database (testing) is different from the one that produced the logfiles (production). In order to use logminer you need to extract dictionary information from the source database(production) to the mining database(testing).

Solution of The Problem

Step 1.
Extract the dictionary to the redo logs in the production database by executing following command,
SQL> EXECUTE DBMS_LOGMNR_D.BUILD(OPTIONS=> DBMS_LOGMNR_D.STORE_IN_REDO_LOGS);

Step 2
After executing commnad in step 1 the dictionary is extract into the redo logs and in fact they become archived instantly. Then check in which redo logs the dictionary is located by running this on production,
SQL> SELECT NAME FROM V$ARCHIVED_LOG WHERE DICTIONARY_BEGIN='YES';
SQL> SELECT NAME FROM V$ARCHIVED_LOG WHERE DICTIONARY_END='YES';


Step 3
Tranfer the output of step 3 into the testing database. You can use scp or telnet to do this.

Step 4
Now in the mining database(testing) provide all the redo log files (including the one from which the transactions need to be mined) and start Log Miner (do not specify dictFileName):

SQL> EXECUTE DBMS_LOGMNR.START_LOGMNR(OPTIONS => DBMS_LOGMNR.DICT_FROM_REDO_LOGS);

No comments:

Post a Comment