DBMS_LOGMNR package contains PRocedures used to initialize the LogMiner tool and to begin and end a LogMiner session.See Also: Oracle Database Utilities for information about using LogMiner and DBMS_LOGMNR_D for information on the package subprograms that extract a LogMiner dictionary and re-create LogMiner tables in alternate tablespacesThis chapter contains the following topics:EXECUTE_CATALOG_ROLE to use the DBMS_LOGMNR package.ADD_LOGFILE options flag in the DBMS_LOGMNR package.NEWImplicitly calls the DBMS_LOGMNR.END_LOGMNR procedure to end the current LogMiner session and then creates a new session. The new session starts a new list of redo log files to be analyzed, beginning with the redo log file you specify.ADDFILEAdds the specified redo log file to the list of redo log files to be analyzed. Any attempt to add a duplicate file raises an exception (ORA-01289). This is the default if no options flag is specified.Table 47-2 describes the constants for the START_LOGMNR options flag in the DBMS_LOGMNR package.COMMITTED_DATA_ONLYIf set, DML statements corresponding to committed transactions are returned. DML statements corresponding to a committed transaction are grouped together. Transactions are returned in their commit order. Transactions that are rolled back or in-progress are filtered out, as are internal redo records (those related to index operations, management, and so on). If this option is not set, all rows for all transactions (committed, rolled back, and in-progress) are returned in the order in which they are found in the redo logs (in order of SCN values).SKIP_CORRUPTIONDirects a select operation on the V$LOGMNR_CONTENTS view 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) is corrupt. You should check the INFO column in the V$LOGMNR_CONTENTS view to determine the corrupt blocks skipped by LogMiner. When a corruption in the redo log file is skipped, the OPERATION column contains the value CORRUPTED_BLOCKS, and the STATUS column contains the value 1343.DDL_DICT_TRACKINGIf the LogMiner dictionary in use is a flat file or in the redo log files, LogMiner updates its internal dictionary 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 internal dictionary is built. The database to which LogMiner is connected must be open. This option cannot be used in conjunction with the DICT_FROM_ONLINE_CATALOG option and cannot be used when the LogMiner dictionary being used is one that was extracted to a flat file prior to Oracle9i.DICT_FROM_ONLINE_CATALOGDirects LogMiner to use the current online database dictionary rather than a LogMiner dictionary contained in a flat file or in the redo log files being analyzed. This option cannot be used in conjunction with the DDL_DICT_TRACKING option. The database to which LogMiner is connected must be the same one that generated the redo log files. EXPect to see a value of 2 in the STATUS column of the V$LOGMNR_CONTENTS view if the table definition in the database does not match the table definition in the redo log file.DICT_FROM_REDO_LOGSIf set, LogMiner expects to find a LogMiner dictionary in the redo log files that were specified. The redo log files are specified with the DBMS_LOGMNR.ADD_LOGFILE procedure or with the DBMS_LOGMNR.START_LOGMNR procedure with the CONTINUOUS_MINE option.NO_SQL_DELIMITERIf set, the SQL delimiter (a semicolon) is not placed at the end of reconstrUCted SQL statements. This is helpful for applications that open a cursor and then execute the reconstructed statements.NO_ROWID_IN_STMTIf set, the ROWID clause is not included in the reconstructed SQL statements. The redo log file may already contain logically unique identifiers for modified rows if supplemental logging is enabled. When using this option, you must be sure that supplemental logging was enabled in the source database at the appropriate level and that no duplicate rows exist in the tables of interest. LogMiner does not make any guarantee regarding the uniqueness of logical row identifiers.PRINT_PRETTY_SQLIf set, LogMiner formats the reconstructed SQL statements for ease of reading. These reconstructed SQL statements are not executable.CONTINUOUS_MINEDirects LogMiner to automatically add redo log files, as needed, to find the data of interest. You only need to specify the first log to start mining, or just the starting SCN or date to indicate to LogMiner where to begin mining logs. You are not required to specify any redo log files explicitly. LogMiner automatically adds and mines the (archived and online) redo log files for the data of interest. This option requires that LogMiner is connected to the same database instance that is generating the redo log files.DBMS_LOGMNR.ADD_LOGFILE or DBMS_LOGMNR.START_LOGMNR (the former if you plan to specify log files explicitly; the latter if you plan to use continuous mining). The session ends with a call to DBMS_LOGMNR.END_LOGMNR. Within a LogMiner session, you can specify the redo log files to be analyzed and the SCN or time range of interest; then you can issue SQL SELECT statements against the V$LOGMNR_CONTENTS view to retrieve the data of interest.V$LOGMNR_CONTENTS view to determine if undo or redo column values exist for the column specified by the column_name input parameter to this functionEND_LOGMNR ProcedureFinishes a LogMiner sessionMINE_VALUE FunctionYou can call this function for any row returned from the V$LOGMNR_CONTENTS view to retrieve the undo or redo column value of the column specified by the column_name input parameter to this functionREMOVE_LOGFILE ProcedureRemoves a redo log file from the list of redo log files for LogMiner to processSTART_LOGMNR ProcedureInitializes the LogMiner utility and starts LogMiner (unless the session was already started with a call to DBMS_LOGMNR.ADD_LOGFILE)LogFileNameSpecifies the name of the redo log file to add to the list of redo log files to be analyzed during this session.optionsDoes one of the following:DBMS_LOGMNR.NEW) DBMS_LOGMNR.ADDFILE)V$LOGMNR_CONTENTS view, you must make a successful call to the DBMS_LOGMNR.START_LOGMNR procedure (within the current LogMiner session). CONTINUOUS_MINE option, the LogMiner session must be set up with a list of redo log files to be analyzed. Use the ADD_LOGFILE procedure to specify the list of redo log files to analyze. CONTINUOUS_MINE option and you want to analyze more than one redo log file, you must call the ADD_LOGFILE procedure separately for each redo log file. The redo log files do not need to be registered in any particular order. RESETLOGS SCN as the first redo log file. (The database RESETLOGS SCN uniquely identifies each execution of an ALTER DATABASE OPEN RESETLOGS statement. When the online redo logs are reset, Oracle creates a new and unique incarnation of the database.) RESETLOGS SCN) than that with which the current list of redo log files is associated, use the END_LOGMNR procedure to end the current LogMiner session, and then build a new list using the ADD_LOGFILE procedure. ORA-01284: file <filename> cannot be opened. ORA-01287: file <filename> is from a different database incarnation. ORA-01289: cannot add duplicate log file <filename>. ORA-01290: cannot remove unlisted log file <filename>. ORA-01324: cannot add file <filename> due to DB_ID mismatch.MINE_VALUE function.If the MINE_VALUE function returns a NULL value, it can mean either:NULL value.COLUMN_PRESENT function, which returns a 1 if the column is present in the redo or undo portion of the data. Otherwise, it returns a 0.sql_redo_undoSpecifies either the REDO_VALUE or the UNDO_VALUE column in the V$LOGMNR_CONTENTS view from which to extract data values. See the Usage Notes for more information.column_nameSpecifies the fully qualified name (schema.table.column) of the column for which this function will return information.COLUMN_PRESENT function. The COLUMN_PRESENT function returns 1 if the self-describing record (the first parameter) contains the column specified in the second parameter. This can be used to determine the meaning of NULL values returned by the DBMS_LOGMNR.MINE_VALUE function.0Specified column is not present in this row of V$LOGMNR_CONTENTS.1Column is present in this row of V$LOGMNR_CONTENTS.COLUMN_PRESENT function, you must have successfully started LogMiner. COLUMN_PRESENT function must be invoked in the context of a select operation on the V$LOGMNR_CONTENTS view. COLUMN_PRESENT function does not support LONG, LOB, ADT, or COLLECTION datatypes. sql_redo_undo parameter depends on the operation performed and the data of interest: UNDO_VALUE. REDO_VALUE. REDO_VALUE (because the value of a column prior to an insert operation will always be null). UNDO_VALUE (because the value of a column after a delete operation will always be null).column_name parameter was not a fully qualified column name.DBMS_LOGMNR.ADD_LOGFILE and specify the NEW option.END_LOGMNR procedure was called without adding any log files or before the START_LOGMNR procedure was called.REDO_VALUE) or undo (UNDO_VALUE) portion of the data. The second argument is a string that specifies the fully qualified name of the column to be mined. The MINE_VALUE function always returns a string that can be converted back to the original datatype.sql_redo_undoSpecifies either the REDO_VALUE or the UNDO_VALUE column in the V$LOGMNR_CONTENTS view from which to extract data values. See the Usage Notes for more information.column_nameSpecifies the fully qualified name (schema.table.column) of the column for which this function will return information.NULLThe column is not contained within the self-describing record, or the column value is NULL. To distinguish between the two different null possibilities, use the DBMS_LOGMNR.COLUMN_PRESENT function.NON-NULLThe column is contained within the self-describing record; the value is returned in string format.MINE_VALUE function, you must have successfully started LogMiner. MINE_VALUE function must be invoked in the context of a select operation from the V$LOGMNR_CONTENTS view. MINE_VALUE function does not support LONG, LOB, ADT, or COLLECTION datatypes. sql_redo_undo parameter depends on the operation performed and the data of interest: UNDO_VALUE. REDO_VALUE. REDO_VALUE (because the value of a column prior to an insert operation will always be null). UNDO_VALUE (because the value of a column after a delete operation will always be null).column_name parameter was not a fully qualified column name.REMOVEFILE constant that was an option on the ADD_LOGFILE procedure prior to Oracle Database 10g.LogFileNameSpecifies the name of the redo log file to be removed from the list of redo log files to be analyzed during this session.V$LOGMNR_CONTENTS view, you must make a successful call to to the DBMS_LOGMNR.START_LOGMNR procedure (within the current LogMiner session). END_LOGMNR procedure to end the current LogMiner session, and then build a new list using the ADD_LOGFILE procedure. ADD_LOGFILE procedure must match the database ID and RESETLOGS SCN of the removed redo log files. Therefore, to analyze the redo log files from a different database (or a database incarnation with a different database RESETLOGS SCN) than that with which the current list of redo log files is associated, use the END_LOGMNR procedure to end the current LogMiner session, and then build a new list using the ADD_LOGFILE procedure.startScnDirects LogMiner to return only redo records with an SCN greater than or equal to the startScn specified. This fails if there is no redo log file containing the specified startScn value. (You can query the FILENAME, LOW_SCN, and NEXT_SCN columns in the V$LOGMNR_LOGS view for each redo log file to determine the range of SCN values contained in each redo log file.)endScnDirects LogMiner to return only redo records with an SCN less than or equal to the endScn specified. If you specify an endScn value that is beyond the value in any redo log file, then LogMiner will use the greatest endScn value in the redo log file that contains the most recent changes. (You can query the FILENAME, LOW_SCN, and NEXT_SCN columns in the V$LOGMNR_LOGS view for each redo log file to determine the range of SCN values contained in each redo log file.)startTimeDirects LogMiner to return only redo records with a timestamp greater than or equal to the startTime specified. This fails if there is no redo log file containing the specified startTime value. (You can query the FILENAME, LOW_TIME, and HIGH_TIME columns in the V$LOGMNR_LOGS view for each redo log file to determine the range of time covered in each redo log file.) This parameter is ignored if startScn is specified. See the Usage Notes for additional information.endTimeDirects LogMiner to return only redo records with a timestamp less than or equal to the endTime specified. If you specify an endTime value that is beyond the value in any redo log file, then LogMiner will use the greatest endTime in the redo log file that contains the most recent changes. You can query the FILENAME, LOW_TIME, and HIGH_TIME columns in the V$LOGMNR_LOGS view for each redo log file to determine the range of time covered in each redo log file.) This parameter is ignored if endScn is specified. See the Usage Notes for additional information.DictFileNameSpecifies the flat file that contains the LogMiner dictionary. It is used to reconstruct SQL_REDO and SQL_UNDO columns in V$LOGMNR_CONTENTS, as well as to fully translate SEG_NAME, SEG_OWNER, SEG_TYPE_NAME, TABLE_NAME, and TABLE_SPACE columns. The fully qualified path name for the LogMiner dictionary file must be specified. (This file must have been created previously through the DBMS_LOGMNR_D.BUILD procedure.) You need to specify this parameter only if neither DICT_FROM_REDO_LOGS nor DICT_FROM_ONLINE_CATALOG is specified.optionsSee Table 47-2, " Constants for START_LOGMNR Options Flag".START_LOGMNR procedure, you can query the following views: V$LOGMNR_CONTENTS - contains history of information in redo log files V$LOGMNR_DICTIONARY - contains current information about the LogMiner dictionary file extracted to a flat file V$LOGMNR_PARAMETERS - contains information about the LogMiner sessionV$LOGMNR_LOGS view after a redo log file list has been added to the list of files that LogMiner is to mine.)DBMS_LOGMNR.START_LOGMNR. You must specify all desired parameters and options (including SCN and time ranges) each time you call DBMS_LOGMNR.START_LOGMNR CONTINUOUS_MINE option directs LogMiner to automatically add redo log files, as needed, to find the data of interest. You need to specify only the first log to start mining, or just the starting SCN or date to indicate to LogMiner where to begin mining logs. Keep the following in mind when using the CONTINUOUS_MINE option: V$ARCHIVED_LOGS view to determine which redo log file entries will be found by LogMiner. V$ARCHIVED_LOGS view), the archived redo log file may not be accessible by LogMiner for various reasons. For example, the archived redo log file may have been deleted or moved from its location (maybe because of a backup operation to tape), or the Directory where it resides may not be not available.CONTINUOUS_MINE option and an ending time or SCN that will occur in the future (or you do not specify an end time or SCN), a query of the V$LOGMNR_CONTENTS view will not finish until the database has generated redo log files beyond the specified time or SCN. In this scenario, LogMiner will automatically add archived redo log files to the LogMiner redo log file list as they are generated. In addition, in this scenario only, LogMiner may automatically remove redo log files from the list to keep it at 50 processed redo files. This is to save PGA memory as LogMiner automatically adds redo log files to the list. If LogMiner did not perform automated removal, memory could eventually be exhausted. CONTINUOUS_MINE option is not specified, it is possible that the database is writing to the online redo log file at the same time that LogMiner is reading the online redo log file. If a log switch occurs while LogMiner is reading an online redo log file, the database will overwrite what LogMiner is attempting to read. The data that LogMiner returns if the file it is trying to read gets overwritten by the database is unpredictable.startTime nor a startScn parameter, LogMiner will set the startScn parameter to use the lowest SCN value from the redo log file that contains the oldest changes. DBMS_LOGMNR.START_LOGMNR without the CONTINUOUS_MINE option, and you specify: 0 for the startTime or startScn value, then the lowest SCN in the LogMiner redo log file list will be used as the startScn startTime or startScn value, then an error is returned 0 or a nonzero number for the endTime or endScn value, then the highest SCN in the LogMiner redo log file list will be used as the endScnDBMS_LOGMNR.START_LOGMNR with the CONTINUOUS_MINE option, and you specify: 0 for the startTime or startScn value, then an error is returned. startTime or startScn value that is greater than any value in the database's archived redo log files, then LogMiner starts mining in the online redo log file. LogMiner will continue to process the online redo log file until it finds a change at, or beyond, the requested starting point before it returns rows from the V$LOGMNR_CONTENTS view. endTime or endScn parameter value that indicates a time or SCN in the future, then LogMiner includes the online redo log files when it mines. When you query the V$LOGMNR_CONTENTS view, rows will be returned from this view as changes are made to the database, and will not stop until LogMiner sees a change beyond the requested ending point. 0 for the endTime or endScn parameter value, then LogMiner includes the online redo log files when it mines. When you query the V$LOGMNR_CONTENTS view, rows will be returned from this view as changes are made to the database, and will not stop until you enter CTL+C or you terminate the PL/SQL cursor.ORA-01280: fatal LogMiner error. ORA-01281: SCN range specified is invalid. The startScn or endScn parameter value is not a valid SCN, or endScn is less than startScn.ORA-01282: date range specified is invalid. The value for the startTime parameter was greater than the value specified for the endTime parameter, or there was no redo log file that was compatible with the date range specified with the startTime and endTime parameters.ORA-01283: options parameter specified is invalid. ORA-01284: file <filename> cannot be opened. The LogMiner dictionary file specified in the DictFileName parameter has a full path length greater than 256 characters, or the file cannot be opened.ORA-01285: error reading file <filename>. ORA-01291: missing log file. 新聞熱點
疑難解答