How to use Logminer to analyze a specific DML operation log

Source: Internet
Author: User

How to use Logminer to analyze a specific DML operation log
In Oracle database maintenance, it is often necessary to analyze what the original database has done to delete, update, increase data operations, so it is generally necessary to use the Logminer tool to analyze the archive log.
Environment: aix5.3+oracle10.2.0.1 use IBM Tivoli Storage Manager to back up database data, archive logs to a library

1, determine the specific time of the DML operation, the corresponding archive log from the library to restore to the database
2, using Logminer to analyze the corresponding archive log

First, in the sqlplus with the SYS superuser login database, and then change the current time to the ' yyyy-mm-dd hh24:mi:ss ' format, so as to see clearly the starting time of the archive log:
Sql>alter session Set nls_date_format= ' Yyyy-mm-dd hh24:mi:ss ';

The sequence# of the V$log_history view is the archive log sequence number, First_time is the start time of the archive log.
Sql>select sequence#,first_time from V$log_history;
Write down the archive log sequence for one day, for example, 3988--4000

Third, the use of Rman target/into the database, the corresponding archive log from the library to the database,/oracle/oms/oradata/temp directory for the directory to put archived logs.

RUN
{
SET ARCHIVELOG DESTINATION to '/oracle/oms/oradata/temp ';
RESTORE ARCHIVELOG SEQUENCE 3988;
}

Note: Export multiple archive logs:

RUN
{
SET ARCHIVELOG DESTINATION to '/oracle/oms/oradata/temp ';
RESTORE ARCHIVELOG SEQUENCE between 2895 and 2897;
}

Note: 3988 is the serial number of the archived log, there are multiple logs, you need to run more than one of the above statements.


Iv. Create a log analysis list and put the first archive log in the analysis list
Sql>execute dbms_logmnr.add_logfile (logfilename=> '/oracle/oms/oradata/temp/1_3988_644336885.dbf ', options= >dbms_logmnr.new);

V. Put the second archive log in the analysis list (the second archive log is the following format)
Sql>execute dbms_logmnr.add_logfile (logfilename=> '/oracle/oms/oradata/temp/1_3989_644336885.dbf ', options= >dbms_logmnr.addfile);


Six, start Logminer
Sql> Execute DBMS_LOGMNR.START_LOGMNR (options=>dbms_logmnr.dict_from_online_catalog);

Seven, the analysis of the data in the Logminer_test table, so convenient to query. Select a free table space because the amount of data in the table v$logmnr_contents is large
Sql>
CREATE TABLE Logminer_test tablespace mlog_norm_space
As
SELECT * from V$logmnr_contents;

Eight, the Analysis Log table logminer_test query permissions to lhomsread read-only database users, so using third-party tools is convenient to query (Plsql, etc.):
Sql>grant Select on Logminer_test to Lhomsread;

Ix. End of Logminer
Sql> Execute DBMS_LOGMNR.END_LOGMNR;

How to use Logminer to analyze a specific DML operation log

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.