PL/SQL Packages and Types Reference 47
日期:2007年7月21日 作者: 查看:[大字体 中字体 小字体]-
DBMS_LOGMNR
The
See Also:DBMS_LOGMNRpackage contains procedures used to initialize the LogMiner tool and to begin and end a LogMiner session.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 tablespaces
This chapter contains the following topics:
- Using DBMS_LOGMNR
- Security Model
- Constants
- Operational Notes
- Summary of DBMS_LOGMNR Subprograms
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 tablespaces
This chapter contains the following topics:
- Using DBMS_LOGMNR
- Security Model
- Constants
- Operational Notes
- Summary of DBMS_LOGMNR Subprograms
Using DBMS_LOGMNR
- Security Model
- Constants
- Operational Notes
Security Model
You must have the role,
EXECUTE_CATALOG_ROLEto use the DBMS_LOGMNR package.
Constants
Table 47-1 describes the constants for the
ADD_LOGFILEoptions flag in theDBMS_LOGMNRpackage.Table 47-1 Constants for ADD_LOGFILE Options Flag
Constant Description NEWImplicitly calls the
DBMS_LOGMNR.END_LOGMNRprocedure 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_LOGMNRoptions flag in theDBMS_LOGMNRpackage.Table 47-2 Constants for START_LOGMNR Options Flag
Constant Description 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_CONTENTSview 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 theINFOcolumn in theV$LOGMNR_CONTENTSview to determine the corrupt blocks skipped by LogMiner. When a corruption in the redo log file is skipped, theOPERATIONcolumn contains the valueCORRUPTED_BLOCKS, and theSTATUScolumn contains the value1343.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_REDOandSQL_UNDOinformation 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_CATALOGoption 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_TRACKINGoption. The database to which LogMiner is connected must be the same one that generated the redo log files.EXPect to see a value of
2in theSTATUScolumn of theV$LOGMNR_CONTENTSview 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_LOGFILEprocedure or with theDBMS_LOGMNR.START_LOGMNRprocedure with theCONTINUOUS_MINEoption.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
ROWIDclause 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.
Operational Notes
A LogMiner session begins with a call to
DBMS_LOGMNR.ADD_LOGFILEorDBMS_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 toDBMS_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 SQLSELECTstatements against theV$LOGMNR_CONTENTSview to retrieve the data of interest.
Summary of DBMS_LOGMNR Subprograms
Table 47-3 DBMS_LOGMNR Package Subprograms
Subprogram Description ADD_LOGFILE Procedure
Adds a redo log file to the existing or newly created list of redo log files for LogMiner to process, so that if a new list is created, this marks the beginning of a LogMiner session
COLUMN_PRESENT Function
You can call this function for any row returned from the
V$LOGMNR_CONTENTSview to determine if undo or redo column values exist for the column specified by thecolumn_nameinput parameter to this functionEND_LOGMNR Procedure
Finishes a LogMiner session
MINE_VALUE Function
You can call this function for any row returned from the
V$LOGMNR_CONTENTSview to retrieve the undo or redo column value of the column specified by thecolumn_nameinput parameter to this functionREMOVE_LOGFILE Procedure
Removes a redo log file from the list of redo log files for LogMiner to process
START_LOGMNR Procedure
Initializes the LogMiner utility and starts LogMiner (unless the session was already started with a call to
DBMS_LOGMNR.ADD_LOGFILE)
ADD_LOGFILE Procedure
This procedure adds a file to an existing or newly created list of log files for LogMiner to process.
Syntax
DBMS_LOGMNR.ADD_LOGFILE( LogFileName IN VARCHAR2, options IN BINARY_INTEGER default ADDFILE );
Parameters
Table 47-4 ADD_LOGFILE Procedure Parameters
Parameter Description 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:
- Starts a new LogMiner session and a new list of redo log files for analysis (
DBMS_LOGMNR.NEW) - Adds a file to an existing list of redo log files for analysis (
DBMS_LOGMNR.ADDFILE)
See Table 47-1, " Constants for ADD_LOGFILE Options Flag".
Usage Notes
- Before querying the
V$LOGMNR_CONTENTSview, you must make a successful call to theDBMS_LOGMNR.START_LOGMNRprocedure (within the current LogMiner session). - Unless you specify the
CONTINUOUS_MINEoption, the LogMiner session must be set up with a list of redo log files to be analyzed. Use theADD_LOGFILEprocedure to specify the list of redo log files to analyze. - If you are not using the
CONTINUOUS_MINEoption and you want to analyze more than one redo log file, you must call theADD_LOGFILEprocedure separately for each redo log file. The redo log files do not need to be registered in any particular order. - Both archived and online redo log files can be mined.
- After you have added the first redo log file to the list, each additional redo log file that you add to the list must be associated with the same database and database
RESETLOGSSCNas the first redo log file. (The databaseRESETLOGSSCNuniquely identifies each execution of anALTERDATABASEOPENRESETLOGSstatement. When the online redo logs are reset, Oracle creates a new and unique incarnation of the database.) - 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 theEND_LOGMNRprocedure to end the current LogMiner session, and then build a new list using theADD_LOGFILEprocedure. - LogMiner matches redo log files by the log sequence number. Thus, two redo log files with different names but with the same log sequence number will return the ORA-01289 exception. For instance, the online counterpart of an archived redo log file has a different name from the archived redo log file, but attempting to register it with LogMiner after registering the archived counterpart will result in the ORA-01289 exception being returned.
Exceptions
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.
COLUMN_PRESENT Function
This function is designed to be used in conjunction with the
MINE_VALUEfunction.If the
MINE_VALUEfunction returns aNULLvalue, it can mean either:- The specified column is not present in the redo or undo portion of the data.
- The specified column is present and has a
NULLvalue.
To distinguish between these two cases, use the
COLUMN_PRESENTfunction, which returns a1if the column is present in the redo or undo portion of the data. Otherwise, it returns a0.Syntax
DBMS_LOGMNR.COLUMN_PRESENT( sql_redo_undo IN RAW, column_name IN VARCHAR2 default '') RETURN NUMBER;Parameters
Table 47-5 COLUMN_PRESENT Function Parameters
Parameter Description sql_redo_undoSpecifies either the
REDO_VALUEor theUNDO_VALUEcolumn in theV$LOGMNR_CONTENTSview 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.Return Values
Table 47-6 describes the return values for the
COLUMN_PRESENTfunction. TheCOLUMN_PRESENTfunction 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 ofNULLvalues returned by theDBMS_LOGMNR.MINE_VALUEfunction.Table 47-6 Return Values for COLUMN_PRESENT Function
Return Description 0Specified column is not present in this row of
V$LOGMNR_CONTENTS.1Column is present in this row of
V$LOGMNR_CONTENTS.Usage Notes
- To use the
COLUMN_PRESENTfunction, you must have successfully started LogMiner. - The
COLUMN_PRESENTfunction must be invoked in the context of a select operation on theV$LOGMNR_CONTENTSview. - The
COLUMN_PRESENTfunction does not supportLONG, LOB,ADT, orCOLLECTIONdatatypes. - The value for the
sql_redo_undoparameter depends on the operation performed and the data of interest:- If an update operation was performed and you want to know what the value was prior to the update operation, specify
UNDO_VALUE. - If an update operation was performed and you want to know what the value is after the update operation, specify
REDO_VALUE. - If an insert operation was performed, typically you would specify
REDO_VALUE(because the value of a column prior to an insert operation will always be null). - If a delete operation was performed, typically you would specify
UNDO_VALUE(because the value of a column after a delete operation will always be null).
- If an update operation was performed and you want to know what the value was prior to the update operation, specify
Exceptions
- ORA-01323: invalid state.
- [1] [2] [3] [4] [5] 下一页
-
- PL/SQL Packages and Types Reference 47 相关文章:
- ·PL/SQL Packages and Types Reference 47
- PL/SQL Packages and Types Reference 47 相关软件
- 特别声明:本站除部分特别声明禁止转载的专稿外的其他文章可以自由转载,但请务必注明出处和原始作
- 者.文章版权归文章原始作者所有.对于被本站转载文章的个人和网站,我们表示深深的谢意。如果本站转
- 载的文章有版权问题请联系编辑人员,我们尽快予以更正. 转载请注明来源:http://www.hackhome.com
下一篇:更改数据库SID
- Using DBMS_LOGMNR
精品推荐
热点TOP10
- ·9istatspack使用手册
- ·ORACLE UPDATE 语句语法与性能分析的一点看法
- ·ORACLE备份&恢复案例--ORACLE BACKUP&RESTORE SCHEME
- ·关于oracle日期函数的介绍和使用
- ·Oracle的SQL*PLUS命令的使用大全
- ·oracle函数之常见单行字符串函数
- ·ORACLE傻瓜手册长篇连载
- ·详细介绍ORACLE sqlplus命令
- ·Decode 函数的用法
- ·ORACLE 培训教程(1)
- ·Oracle 游标使用大全
- ·把Oracle数据库移植到Microsoft SQL Server 7.0
- ·Oracle数据库检查死锁的sql
- ·Oracle的SQL语句执行效率问题查找与解决方法
- ·Oracle常用的OCI函数
- ·用正则表达式函数验证身份证号码合法性
- ·oracle中pro*c的学习
- ·VMware下RedHat安装Oracle 9i RAC全攻略
- ·Oracle 9i 分析函数参考手册
- ·数据库备份与恢复测试(8)
特别推荐
- ·Oracle环境下APACHE虚拟服务器如何设置
- ·常见Oracle HINT的用法
- ·ORA-00257: archiver error. Connect internal only, until freed.
- ·oracle的update问题
- ·小议索引的使用
- ·oracle产品服务和技术级别介绍,OrACLE服务
- ·Oracle 数据类型
- ·Oracle数据库检查死锁的sql
- ·怎样将冷备份移植到另一台Solaris机器上
- ·Oracle 动态SQL返回单条结果和结果集
- ·手动建立 Oracle9i 数据库
- ·Oracle内存结构(二)----Shared Pool的详细信息
- ·DELPHI 调用 Oracle 存储过程并返回数据集的例子.
- ·关于block中行数据的存储与空间重组三
- ·Sybase及SQL Anywhere SQL语句小结
- ·ORACLE备份&恢复案例--ORACLE BACKUP&RESTORE SCHEME
- ·Oracle ERP 11业务调研报告-AP应付帐
- ·在 Oracle 数据库上构建 .NET 应用程序
- ·Oracle的SQL语句执行效率问题查找与解决方法
- ·oracle中pro*c的学习
