ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;
Extract a LogMiner Dictionary:
To use LogMiner, you must supply it with a dictionary by doing one of the following:
- Specify use of the online catalog by using the DICT_FROM_ONLINE_CATALOG option when you start LogMiner.
- Extract database dictionary information to the redo log files.
- Extract database dictionary information to a flat file.
1.Create a list of redo log files. Specify the NEW option of the DBMS_LOGMNR.ADD_LOGFILE PL/SQL procedure to signal that this is the beginning of a new list.
EXECUTE DBMS_LOGMNR.ADD_LOGFILE( -
LOGFILENAME => '/oracle/logs/log1.f', -
OPTIONS => DBMS_LOGMNR.NEW);
2.If desired, add more redo log files,
EXECUTE DBMS_LOGMNR.ADD_LOGFILE( -
LOGFILENAME => '/oracle/logs/log2.f', -
OPTIONS => DBMS_LOGMNR.ADDFILE);
The OPTIONS parameter is optional and default value is DBMS_LOGMNR.ADDFILE.
3.If desired, remove redo log files
EXECUTE DBMS_LOGMNR.REMOVE_LOGFILE( -
LOGFILENAME => '/oracle/logs/log2.f');
Start LogMiner:
You must start LogMiner.use the OPTIONS parameter to specify either the DICT_FROM_REDO_LOGS or DICT_FROM_ONLINE_CATALOG option. If you specify DICT_FROM_REDO_LOGS, LogMiner expects to find a dictionary in the redo log files that you specified with the DBMS_LOGMNR.ADD_LOGFILE procedure. To determine which redo log files contain a dictionary, look at the V$ARCHIVED_LOG view.If you are specifying the name of a flat file LogMiner dictionary, you must supply a fully qualified filename for the dictionary file. So,
EXECUTE DBMS_LOGMNR.START_LOGMNR(OPTIONS => DBMS_LOGMNR.DICT_FROM_ONLINE_CATALOG);
OR
EXECUTE DBMS_LOGMNR_D.BUILD( OPTIONS=> DBMS_LOGMNR_D.STORE_IN_REDO_LOGS);
OR
EXECUTE DBMS_LOGMNR.START_LOGMNR(DICTFILENAME =>'/oracle/database/dictionary.ora');
Query V$LOGMNR_CONTENTS:
For Example,
SELECT (XIDUSN || '.' || XIDSLT || '.' || XIDSQN) AS XID,
USERNAME, SQL_REDO FROM V$LOGMNR_CONTENTS WHERE USERNAME != 'SYS'
AND SEG_OWNER IS NULL OR SEG_OWNER NOT IN ('SYS', 'SYSTEM');
End the LogMiner Session:
EXECUTE DBMS_LOGMNR.END_LOGMNR;
No comments:
Post a Comment