oracle dbms_logmnr,logminer系列文章四(DBMS_LOGMNR_D包参考)

http://www.stanford.edu/dept/itss/docs/oracle/10g/appdev.101/b10802/d_logmna.htm#76949

48

DBMS_LOGMNR_D

The DBMS_LOGMNR_D package contains two procedures:

The BUILD procedure extracts the LogMiner data dictionary to either the redo log files or to a flat file. This information is saved in preparation for future analysis of redo log files using the LogMiner tool.

The SET_TABLESPACE procedure re-creates all LogMiner tables in an alternate tablespace.

See Also:

for information about using LogMiner and DBMS_LOGMNR for information on the package subprograms used in running a LogMiner session.

This chapter contains the following topic:

Using DBMS_LOGMNR_D

Overview

Note:

The LogMiner data dictionary consists of the memory data structures and the database tables that are used to store and retrieve information about objects and their versions. It is referred to as the LogMiner dictionary throughout the LogMiner documentation.

Security Model

You must have the role, EXECUTE_CATALOG_ROLE to use the DBMS_LOGMNR_D package.

Summary of DBMS_LOGMNR_D Subprograms

Table 48-1  DBMS_LOGMNR_D Package Subprograms

Procedure

DescriptionExtracts the LogMiner dictionary to either a flat file or one or more redo log files

Re-creates all LogMiner tables in an alternate tablespace

BUILD Procedure

This procedure extracts the LogMiner data dictionary to either the redo log files or to a flat file.

Syntax

DBMS_LOGMNR_D.BUILD ( dictionary_filename IN VARCHAR2,

dictionary_location IN VARCHAR2,

options IN NUMBER);

Parameters

Table 48-2 describes the parameters for the BUILD procedure.

Table 48-2  BUILD Procedure Parameters

Parameter

Descriptiondictionary_filename

Specifies the name of the LogMiner dictionary file.

dictionary_location

Specifies the path to the LogMiner dictionary file directory.

options

Specifies that the LogMiner dictionary is written to either a flat file (STORE_IN_FLAT_FILE) or the redo log files (STORE_IN_REDO_LOGS).

To extract the LogMiner dictionary to a flat file, you must supply a filename and location.

To extract the LogMiner dictionary to the redo log files, specify only the STORE_IN_REDO_LOGS option. The size of the LogMiner dictionary may cause it to be contained in multiple redo log files.

The combinations of parameters used result in the following behavior:

If you do not specify any parameters, an error is returned.

If you specify a filename and location, without any options, the LogMiner dictionary is extracted to a flat file with that name.

If you specify a filename and location, as well as the STORE_IN_FLAT_FILE option, the LogMiner dictionary is extracted to a flat file with the specified name.

If you do not specify a filename and location, but do specify the STORE_IN_REDO_LOGS option, the LogMiner dictionary is extracted to the redo log files.

If you specify a filename and location, as well as the STORE_IN_REDO_LOGS option, an error is returned.

If you do not specify a filename and location, but do specify the STORE_IN_FLAT_FILE option, an error is returned.

Exceptions

ORA-01302: dictionary build options missing or incorrect.

This error is returned under the following conditions:

If the value of the OPTIONS parameter is not one of the supported values (STORE_IN_REDO_LOGS, STORE_IN_FLAT_FILE) or is not specified

If the STORE_IN_REDO_LOGS option is not specified and neither the dictionary_filename nor the dictionary_location parameter is specified

If the STORE_IN_REDO_LOGS option is specified and either the dictionary_filename or the dictionary_location parameter is specified

ORA-01308: initialization parameter UTL_FILE_DIR is not set.

ORA-01336: specified dictionary file cannot be opened.

This error is returned under the following conditions:

The specified value for the dictionary_location does not exist.

The UTL_FILE_DIR initialization parameter is not set to have access to the dictionary_location.

The dictionary file is read-only.

Usage Notes

Ideally, the LogMiner dictionary file will be created after all database dictionary changes have been made and prior to the creation of any redo log files that are to be analyzed. As of Oracle9i release 1 (9.0.1), you can use LogMiner to dump the LogMiner dictionary to the redo log files or a flat file, perform DDL operations, and dynamically apply the DDL changes to the LogMiner dictionary.

Do not run the DBMS_LOGMNR_D.BUILD procedure if there are any ongoing DDL operations.

The database must be open when you run the DBMS_LOGMNR_D.BUILD procedure.

When extracting a LogMiner dictionary to a flat file, the procedure queries the dictionary tables of the current database and creates a text-based file containing the contents of the tables. To extract a LogMiner dictionary to a flat file, the following conditions must be met:

You must specify a directory for use by the PL/SQL procedure. To do so, set the initialization parameter UTL_FILE_DIR in the initialization parameter file. For example:

UTL_FILE_DIR = /oracle/dictionary

After setting the parameter, you must shut down and restart the database for this parameter to take effect. If you do not set this parameter, the procedure will fail.

You must ensure that no DDL operations occur while the LogMiner dictionary build is running. Otherwise, the LogMiner dictionary file may not contain a consistent snapshot of the database dictionary.

Be aware that the DDL_DICT_TRACKING option to the DBMS_LOGMNR.START_LOGMNR procedure is not supported for flat file dictionaries created prior to Oracle9i. If you attempt to use the DDL_DICT_TRACKING option with a LogMiner database extracted to a flat file prior to Oracle9i, the ORA-01330 error (problem loading a required build table) is returned.

To extract a LogMiner dictionary file to the redo log files, the following conditions must be met:

The DBMS_LOGMNR_D.BUILD procedure must be run on a system that is running Oracle9i or later.

Archivelog mode must be enabled in order to generate usable redo log files.

The COMPATIBLE parameter in the initialization parameter file must be set to 9.2.0 or higher.

The database to which LogMiner is attached must be Oracle9i or later.

In addition, supplemental logging (at least the minimum level) should be enabled to ensure that you can take advantage of all the features that LogMiner offers. See for information about using supplemental logging with LogMiner.

Examples

Example 1: Extracting the LogMiner Dictionary to a Flat File

The following example extracts the LogMiner dictionary file to a flat file named dictionary.ora in a specified path (/oracle/database).

SQL> EXECUTE dbms_logmnr_d.build('dictionary.ora', - '/oracle/database/', - options => dbms_logmnr_d.store_in_flat_file);

Example 2: Extracting the LogMiner Dictionary to the Redo Log Files

The following example extracts the LogMiner dictionary to the redo log files.

SQL> EXECUTE dbms_logmnr_d.build( - options => dbms_logmnr_d.store_in_redo_logs);

SET_TABLESPACE Procedure

By default, all LogMiner tables are created to use the SYSAUX tablespace. However, it may be desirable to have LogMiner tables use an alternate tablespace. Use this procedure to move LogMiner tables to an alternate tablespace.

Syntax

DBMS_LOGMNR_D.SET_TABLESPACE( new_tablespace IN VARCHAR2);

Parameters

Table 48-3  SET_TABLESPACE Parameter

Parameter

Descriptionnew_tablespace

A string naming a preexisting tablespace. To move all LogMiner tables to employ this tablespace, supply this parameter.

Usage Notes

Users upgrading from earlier versions of Oracle Database may find LogMiner tables in the SYSTEM tablespace. Oracle encourages such users to consider using the SET_TABLESPACE procedure to move the tables to the SYSAUX tablespace once they are confident that they will not be downgrading to an earlier version of Oracle Database.

Users of this routine must supply an existing tablespace.

See Also:

and for information about tablespaces and how to create them

Example: Using the DBMS_LOGMNR_D.SET_TABLESPACE Procedure

The following example shows the creation of an alternate tablespace and execution of the DBMS_LOGMNR_D.SET_TABLESPACE procedure.

SQL> CREATE TABLESPACE logmnrts$ datafile '/usr/oracle/dbs/logmnrts.f' SIZE 25 M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED; SQL> EXECUTE dbms_logmnr_d.set_tablespace('logmnrts$');

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值