Sunday 1 April 2012

Oracle Log Mining Steps on RAC

*The whole activity must be done on one session.

*Check the number of archive logs for which you want to do log mining.

Check the sequence of archive logs from the both for which you want to mining

Suppose,
10.10.10.1 - node1
Mon Dec 13 12:26:16 2010
Thread 1 advanced to log sequence 15289 (LGWR switch)

Mon Dec 13 16:02:50 2010
Thread 1 advanced to log sequence 15298 (LGWR switch)


10.10.10.2 - node2
Mon Dec 13 12:26:16 2010
Thread 2 advanced to log sequence 15062 (LGWR switch)

Mon Dec 13 16:22:04 2010
Thread 2 advanced to log sequence 15072 (LGWR switch)


Steps:
1)set utl_file_dir
   alter system set utl_file_dir='/oracle/test' scope=spfile  (The path/location where you put the archive logs)
   Bounce the database

2)Extracting the LogMiner Dictionary to a Flat file (flat file is one of the option)
  EXECUTE DBMS_LOGMNR_D.BUILD('dictionary.ora','/oracle/test',DBMS_LOGMNR_D.STORE_IN_FLAT_FILE);

3)Add Logfiles
EXECUTE DBMS_LOGMNR.ADD_LOGFILE(LOGFILENAME => '/oracle/test/1_15289_66678900.dbf',OPTIONS => DBMS_LOGMNR.new);
EXECUTE DBMS_LOGMNR.ADD_LOGFILE(LOGFILENAME => '/oracle/test/1_15290_66678900.dbf',OPTIONS => DBMS_LOGMNR.ADDFILE);
EXECUTE DBMS_LOGMNR.ADD_LOGFILE(LOGFILENAME => '/oracle/test/1_15291_66678900.dbf',OPTIONS => DBMS_LOGMNR.ADDFILE);
EXECUTE DBMS_LOGMNR.ADD_LOGFILE(LOGFILENAME => '/oracle/test/1_15292_66678900.dbf',OPTIONS => DBMS_LOGMNR.ADDFILE);

4)Filtering Data that is returned (Showing only Committed transactions)
 EXECUTE DBMS_LOGMNR.START_LOGMNR(OPTIONS => DBMS_LOGMNR.COMMITTED_DATA_ONLY);

5)Extract relevant information from the view v$logmnr_contents
  Example:
  select seg_owner,operation,sql_redo,sql_undo from v$logmnr_contents where SEG_owner='SCOTT';

6)To end the Log mining process
  exec dbms_logmnr.end_logmnr;


Note: Check the below doc for proper information
Using LogMiner, How to determine the cause of lots of redo generation. [ID 300395.1]
LogMiner Utility Release 8.1.x - 10g [ID 291686.1]


No comments:

Post a Comment