Oracle Log Mining

Source: Internet
Author: User

Logminer based on package:

[[email protected] ~]$ ls/u01/oracle/10g/rdbms/admin/dbmslm.sql-->DBMS_LOGMNR Tool

/u01/oracle/10g/rdbms/admin/dbmslm.sql

[Email protected] ~]$ Ls/u01/oracle/10g/rdbms/admin/dbmslmd.sql-->dbms_logmnr_d tool

/u01/oracle/10g/rdbms/admin/dbmslmd.sql

To tap an online log:

Sql> Execute Dbms_logmnr.add_logfile

('/u01/oracle/oradata/orcl/redo03.log ', dbms_logmnr.new);

Sql> Execute Dbms_logmnr.add_logfile

('/u01/oracle/oradata/orcl/redo02.log ', dbms_logmnr.addfile);

Sql> Execute DBMS_LOGMNR.START_LOGMNR

(options=>dbms_logmnr.dict_from_online_catalog+dbms_logmnr.committed_data_only);

Sql> Select Sql_redo,sql_undo from v$logmnr_contents where table_name= ' EMP ';

Sql> CREATE TABLE TLog as SELECT * from V$logmnr_contents;

Table created.

Sql> exec DBMS_LOGMNR.END_LOGMNR ();

PL/SQL procedure successfully completed.

Mining Archive logs:

sql> Delete from dept where deptno=70;

1 row deleted.

Sql> commit;

Commit complete.

sql> Delete from dept where deptno=60;

1 row deleted.

Sql> commit;

Commit complete.

sql> alter system switch logfile;

System altered.

sql> alter system switch logfile;

System altered.

sql> alter system switch logfile;

System altered.

Sql> select name from V$archived_log;

NAME

--------------------------------------------------------------------------------------------------------------- ---

/u01/oracle/flash_recovery_area/orcl/archivelog/2015_04_01/o1_mf_1_2_bkp6s8vy_.arc

/u01/oracle/flash_recovery_area/orcl/archivelog/2015_04_01/o1_mf_1_3_bkp6sdbz_.arc

/u01/oracle/flash_recovery_area/orcl/archivelog/2015_04_01/o1_mf_1_4_bkp6sjbz_.arc

Sql> Show Parameter Utl_file

NAME TYPE VALUE

------------------------------------ ----------- ------------------------------

Utl_file_dir string

Sql> alter system set utl_file_dir= '/home/oracle/' scope=spfile;

System altered.

sql> shutdown Immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

Sql> Startup

ORACLE instance started.

Total System Global area 285212672 bytes

Fixed Size 1218968 bytes

Variable Size 88082024 bytes

Database buffers 188743680 bytes

Redo buffers 7168000 bytes

Database mounted.

Database opened.

sql> exec dbms_logmnr_d.build (' Log.ora ', '/home/oracle/', dbms_logmnr_d.store_in_flat_file);

PL/SQL procedure successfully completed.

sql> exec dbms_logmnr.add_logfile ('/u01/oracle/flash_recovery_area/orcl/archivelog/2015_04_01/o1_mf_1_12_ Bkr48xy4_.arc ', dbms_logmnr.new);

PL/SQL procedure successfully completed.

sql> exec dbms_logmnr.add_logfile ('/u01/oracle/flash_recovery_area/orcl/archivelog/2015_04_01/o1_mf_1_11_ Bkr48wsk_.arc ', dbms_logmnr.addfile);

PL/SQL procedure successfully completed.

sql> exec dbms_logmnr.add_logfile ('/u01/oracle/flash_recovery_area/orcl/archivelog/2015_04_01/o1_mf_1_10_ Bkr48vcs_.arc ', dbms_logmnr.addfile);

PL/SQL procedure successfully completed.

sql> exec dbms_logmnr.start_logmnr (dictfilename=> '/home/oracle/log.ora ');

PL/SQL procedure successfully completed.

Sql> Select Sql_undo,sql_redo from v$logmnr_contents where table_name= ' EMP ';

No rows selected

Sql> exec DBMS_LOGMNR.END_LOGMNR ();

PL/SQL procedure successfully completed.

Oracle Log Mining

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.