Oracle9i Supplied PL/SQL Packages and Types Reference
Release 1 (9.0.1)

Part Number A89852-02
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback

Go to previous page Go to next page

24
DBMS_LOGMNR

LogMiner allows you to make queries based on actual data values. For instance, you could issue a query to select all updates to the table scott.emp or all deletions performed by user scott. You could also perform a query to show all updates to scott.emp that increased sal more than a certain amount. Such data can be used to analyze system behavior and to perform auditing tasks.

The DBMS_LOGMNR package contains procedures used to initialize the LogMiner tool. You use these procedures to list the redo log files to be analyzed and to specify the SCN or time range of interest. After these procedures complete, the server is ready to process SQL SELECT statements against the V$LOGMNR_CONTENTS view.

The data in redo log files is especially important for recovery, because you can use it to pinpoint when a database became corrupted.You can then use this information to recover the database to the state just prior to corruption.

See Also:

Oracle9i Database Administrator's Guide and Oracle9i User-Managed Backup and Recovery Guide 

This chapter discusses the following topics:

DBMS_LOGMNR Constants

The following sections describe the constants for the DBMS_LOGMNR package.

Constants for ADD_LOGFILE Options Flag

NEW

DBMS_LOGMNR.NEW purges the existing list of redo log files, if any. Places the specified redo log file in the list of log files to be analyzed.

ADDFILE

DBMS_LOGMNR.ADDFILE adds the specified redo log file to the list of log files to be analyzed. Any attempts to add a duplicate file raise an exception (ORA-1289).

REMOVEFILE

DBMS_LOGMNR.REMOVEFILE removes the redo log file from the list of log files to be analyzed. Any attempts to remove a file that has not been previously added, raise an exception (ORA-1290).

Constants for START_LOGMNR Options Flag

COMMITTED_DATA_ONLY

If set, only DMLs corresponding to committed transactions are returned. DMLs corresponding to a committed transaction are grouped together. Transactions are returned in their commit order. If this option is not set, all rows for all transactions (committed, rolled back and in-progress) are returned.

SKIP_CORRUPTION

Directs a SELECT operation from V$LOGMNR_CONTENTS to skip any corruptions in the redo log file being analyzed and continue processing. This option works only when a block in the redo log file (and not the header of the redo log file) has been corrupted. Caller should check the INFO column in the V$LOGMNR_CONTENTS view to determine the corrupt blocks skipped by LogMiner.

DDL_DICT_TRACKING

If the dictionary in use is a flat file or in the redo log files, LogMiner ensures that its internal dictionary is updated if a DDL event occurs. This ensures that correct SQL_REDO and SQL_UNDO information is maintained for objects that are modified after the LogMiner dictionary is built.

This option cannot be used in conjunction with the DICT_FROM_ONLINE_CATALOG option.

NO_DICT_RESET_ONSELECT

This option is only valid if the DDL_DICT_TRACKING option is also specified. It prevents LogMiner from reloading its internal dictionary at the beginning of each select operation on V$LOGMNR_CONTENTS. This can be an advantage because it can be time consuming to refresh the dictionary if a DDL operation has updated the dictionary.

If you use this option, be aware that because the dictionary has not been refreshed for subsequent select operations, you may get incompletely reconstructed SQL_REDO and SQL_UNDO information for objects that are modified in the redo log files. Such incomplete reconstructions produce SQL that cannot be executed.

DICT_FROM_ONLINE_CATALOG

Directs LogMiner to use the current live database dictionary rather than a dictionary snapshot contained in a flat file or in a redo log file.

This option cannot be used in conjunction with the DDL_DICT_TRACKING option.

DICT_FROM_REDO_LOGS

If set, LogMiner expects to find a dictionary in the redo log files that were specified with the DBMS_LOGMNR.ADD_LOGFILE procedure.

Extracting Data Values From Redo Log Files

LogMiner data extraction from redo log files is performed using two mine functions: DBMS_LOGMNR.MINE_VALUE and DBMS_LOGMNR.COLUMN_PRESENT, described later in this chapter.

Example of Using DBMS_LOGMNR

The following example shows how to use the DBMS_LOGMNR procedures to add redo log files to a LogMiner session, how to start LogMiner, how to perform a select operation from V$LOGMNR_CONTENTS, and how to end a LogMiner session. For complete descriptions of the DBMS_LOGMNR procedures, see Summary of DBMS_LOGMNR Subprograms.

EXECUTE DBMS_LOGMNR.ADD_LOGFILE( 
   LogFileName => '/oracle/logs/log1.f',
   Options => dbms_logmnr.NEW);

EXECUTE DBMS_LOGMNR.ADD_LOGFILE( 
   LogFileName => '/oracle/logs/log2.f', 
   Options => dbms_logmnr.ADDFILE);

EXECUTE DBMS_LOGMNR.START_LOGMNR(
   DictFileName =>'/oracle/dictionary.ora');

SELECT sql_redo 
FROM V$LOGMNR_CONTENTS
EXECUTE DBMS_LOGMNR.END_LOGMNR();

Summary of DBMS_LOGMNR Subprograms

Table 24-1 describes the procedures in the DBMS_LOGMNR supplied package.

Table 24-1 DBMS_LOGMNR Package Subprograms
Subprogram  Description 

"ADD_LOGFILE Procedure" 

Adds a file to the existing or newly created list of archive files to process. 

"START_LOGMNR Procedure" 

Initializes the LogMiner utility. 

"END_LOGMNR Procedure" 

Finishes a LogMiner session. 

"MINE_VALUE Function" 

This function may be called for any row returned from V$LOGMNR_CONTENTS to retrieve the undo or redo column value of the column specified by the column_name input parameter to this function. 

"COLUMN_PRESENT Function" 

This function may be called for any row returned from V$LOGMNR_CONTENTS to determine if undo or redo column values exist for the column specified by the column_name input parameter to this function. 


Go to previous page Go to next page
Oracle
Copyright © 1996-2001, Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback