ITPub博客

首页 > 数据库 > Oracle > LogMiner相关知识(摘自网络)

LogMiner相关知识(摘自网络)

原创 Oracle 作者:shawnloong 时间:2015-06-25 21:23:53 0 删除 编辑
官方文档关于LogMiner介绍:
http://docs.oracle.com/cd/E11882_01/server.112/e22490/logminer.htm
以下摘自官网:

LogMiner Benefits

All changes made to user data or to the database dictionary are recorded in the Oracle redo log files so that database recovery operations can be performed.

Because LogMiner provides a well-defined, easy-to-use, and comprehensive relational interface to redo log files, it can be used as a powerful data auditing tool,
and also as a sophisticated data analysis tool. The following list describes some key capabilities of LogMiner:
Pinpointing when a logical corruption to a database, such as errors made at the application level, may have begun. These might include errors such as those where
the wrong rows were deleted because of incorrect values in a WHERE clause, rows were updated with incorrect values, the wrong index was dropped, and so forth.
For example, a user application could mistakenly update a database to give all employees 100 percent salary increases rather than 10 percent increases,
or a database administrator (DBA) could accidently delete a critical system table. It is important to know exactly when an error was made so that you know
when to initiate time-based or change-based recovery. This enables you to restore the database to the state it was in just before corruption. See
 "Querying V$LOGMNR_CONTENTS Based on Column Values" for details about how you can use LogMiner to accomplish this.

    Determining what actions you would have to take to perform fine-grained recovery at the transaction level. If you fully understand and take into account
    existing dependencies, then it may be possible to perform a table-specific undo operation to return the table to its original state. This is achieved by
    applying table-specific reconstructed SQL statements that LogMiner provides in the reverse order from which they were originally issued. See "Scenario 1:
    Using LogMiner to Track Changes Made by a Specific User" for an example.

    Normally you would have to restore the table to its previous state, and then apply an archived redo log file to roll it forward.

    Performance tuning and capacity planning through trend analysis. You can determine which tables get the most updates and inserts. That information
    provides a historical perspective on disk access statistics, which can be used for tuning purposes. See "Scenario 2: Using LogMiner to Calculate Table
    Access Statistics" for an example.

    Performing postauditing. LogMiner can be used to track any data manipulation language (DML) and data definition language (DDL) statements executed
    on the database, the order in which they were executed, and who executed them. (However, to use LogMiner for such a purpose, you need to have an idea
    when the event occurred so that you can specify the appropriate logs for analysis; otherwise you might have to mine a large number of redo log files,
    which can take a long time. Consider using LogMiner as a complementary activity to auditing database use. See the Oracle Database Administrator's Guide
    for information about database auditing.)
为什么会用到LogMiner?
主要出于以下几个缘由:

    当数据库发生了误操作,需要不完全恢复,为确认误操作准确的时间点或SCN号,此时需用到LogMiner。
    传统恢复一个上TB或是恢复一个几百GB表空间中的一个小表,标准的操作是把整个表空间恢复到之前的状态,然后再应用归档日志,加上搭建恢复环境的时间,整个时间会很长。通过LogMiner可以换一种恢复思维,能通过它解析到这个表上所有的DML操作,可以做反向修复。合理的使用会大幅降低此情况恢复的复杂度和时间。
    可以把LogMiner当成最强大的数据库审计工具。
    在过去的某个时间数据库很忙或是产生了大量的归档日志,通过LogMiner可以知道是哪些操作,哪个表占比较大,主要矛盾在哪。
       Logminer是oracle从8i开始提供的用于分析重做日志信息的工具,它包括DBMS_LOGMNR和DBMS_LOGMNR_D两个package,后边的D是字典的意思。它既能分析redo log file,也能分析归档后的archive log file。在分析日志的过程中需要使用数据字典,一般先生成数据字典文件后使用,10g版本还可以使用在线数据字典。

 LogMiner是Oracle数据库提供的一个工具,它用于分析重做日志和归档日志所记载的事务操作。

       (1)确定数据库的逻辑损坏时间。假定某个用户执行drop table误删除了重要表sales,通过LogMiner可以准确定位该误操作的执行时间和SCN值,然后通过基于时间恢复或者基于SCN恢复可以完全恢复该表数据。

       (2)确定事务级要执行的精细逻辑恢复操作。假定某些用户在某表上执行了一系列DML操作并提交了事务,并且其中某个用户的DML操作存在错误。通过LogMiner可以取得任何用户的DML操作及相应的UNDO操作,通过执行UNDO操作可以取消用户的错误操作。

       (3)执行后续审计。通过LogMiner可以跟踪Oracle数据库的所有DML、DDL和DCL操作,从而取得执行这些操作的时间顺序、执行这些操作的用户等信息。

Logminer 支持的数据类型和表的存储属性
LogMiner supports the following datatypes and table storage attributes:

(1).      CHAR

(2).      NCHAR

(3).      VARCHAR2 and VARCHAR

(4).      NVARCHAR2

(5).      NUMBER

(6).      DATE

(7).      TIMESTAMP

(8).      TIMESTAMP WITH TIME ZONE

(9).      TIMESTAMP WITH LOCAL TIME ZONE

(10).  INTERVAL YEAR TO MONTH

(11).  INTERVAL DAY TO SECOND

(12).  RAW

(13).  CLOB

(14).  NCLOB

(15).  BLOB

(16).  LONG

(17).  LONG RAW

(18).  BINARY_FLOAT

(19).  BINARY_DOUBLE

(20).  Index-organized tables (IOTs), including those with overflows or LOB columns

(21).  Function-based indexes

(22).  XMLTYPE data when it is stored in CLOB format

(23).  Tables using basic table compression and OLTP table compression

 

       Support for multibyte CLOBs is available only for redo logs generated by a database with compatibility set to a value of 10.1 or higher.

       Support for LOB and LONG datatypes is available only for redo logs generated by a database with compatibility set to a value of 9.2.0.0 or higher.

       Support for index-organized tables without overflow segment or with no LOB columns in them is available only for redo logs generated by a database with compatibility set to 10.0.0.0 or higher.

       Support for index-organized tables with overflow segment or with LOB columns is available only for redo logs generated by a database with compatibility set to 10.2.0.0 or higher.

 

1.2  Logminer 不支持的数据类型和表存储属性

LogMiner does not support these datatypes and table storage attributes:

(1).      BFILE datatype

(2).      Simple and nested abstract datatypes (ADTs)

(3).      Collections (nested tables(嵌套表) and VARRAYs)

(4).      Object refs

(5).      SecureFiles (unless database compatibility is set to 11.2 or higher)

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/24486203/viewspace-1712398/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2011-08-29

  • 博文量
    110
  • 访问量
    292637