Logmnr in Oracle 10 Gb uses instance Parsing

Source: Internet
Author: User

Oracle 10gInLogmnrIn Oracle9i, The Logmnr tool is a good measure for DBAs to retrieve excluded data. Logmnr can be used to complete the following tasks:

1. Identify the database change registration, which may be a change analysis. If some users suspect that they have any problems with their use, many errors may occur, and Logmnr can be used to analyze these transactions, let's see what happened.

2. Identify and modify users' false monopoly. If some users accidentally remove non-tables, they are not sure, at this time, we can use Logmnr to analyze who is enforcing DML, which may be a DDL monopoly.

3. retrieve lost data. If you cannot use flashback or use flashback, you can use the Logmnr tool to retrieve data. In this case, you only need to archive logs.

Content and data dictionary included in the Logmnr Tool

Dbms_logmnr_d package: used to extract dictionary messages to the table, including three processes:

1) add_logfile: Used to Add/Remove log files for analysis.

2) start_logmnr: Used to enable log analysis and enable many different analysis options in 9i/10g.

3) end_logmnr: Used to terminate the analysis session. It recycles the memory borrowed by LogMiner.

In case of idle users wanting to use the above package, the current authorization capability in sys is sufficient, such:

Sys user authorization:

SQL> grant execute on dbms_logmnr to scott;

The data dictionary related to LogMiner is as follows:

U v $ logmnr_dictionary: Data Dictionary messages that LogMiner may exploit.

U v $ logmnr_parameters: The parameter message set by LogMiner.

U v $ logmnr_logs: List of logs currently used for analysis.

U v $ logmnr_contents: Log Analysis gains.

Logmnr analysis process demonstration

Create a table, insert some data, and then remove the data.

Connect:

 
 
  1. Oracle Database 10g Enterprise Edition Release 10.2.0.1.0-Production
  2. With the Partitioning, OLAP and Data Mining options
  3. SQL> alter system archive log current;
  4. The system has been changed.
  5. SQL> create table mytesttab as select * from scott. dept;
  6. The table has been created.
  7. SQL> insert into mytesttab values (80, 'it', 'wa ');
  8. 1 line has been created.
  9. SQL> insert into mytesttab values (90, 'mgr ', 'ymr ');
  10. 1 line has been created.
  11. SQL> commit;
  12. Submission ends.
  13. SQL> delete from mytesttab;
  14. Six rows have been excluded.
  15. SQL> commit;
  16. Submission ends.
  17. SQL> alter system archive log current;
  18. The system has been changed.

Then, find the log files registered during the monopoly process.

 
 
  1. D:/oracle/flash_recovery_area/MYORACLE/ARCHIVELOG/o1_mf_00004_3cvhlkjm_.arc file under the 2007_08_11 directory. We must analyze and process this file.
  2. SQL> exec sys. dbms_logmnr.add_logfile (LogFileName => 'd:/oracle/flash_recovery_area/MYORACLE/ARCHIVELO
  3. G/2007_08_11/o1_mf_00004_3cvhlkjm_.arc ', options => dbms_logmnr.new );
  4. The PL/SQL process has won.
  5. SQL> exec sys. dbms_logmnr.start_logmnr (options => sys. dbms_logmnr.dict_from_online_catalog );
  6. The PL/SQL process has won.
  7. OK. The analysis ends.

View log registration content

 
 
  1. SQL> select t. scn, t. timestamp, t. seg_owner, t. operation
  2. 2 from v $ logmnr_contents t where t. seg_name = 'mytesttab ';
  3. Scn timestamp SEG_OWNE OPERATION
  4. ------------------------------------------
  5. 5483840-07 SYS DDL
  6. 5483863-07 SYS INSERT
  7. 5483874-07 SYS INSERT
  8. 5483885-07 SYS DELETE
  9. 5483885-07 SYS DELETE
  10. 5483885-07 SYS DELETE
  11. 5483885-07 SYS DELETE
  12. 5483886-07 SYS DELETE
  13. 5483886-07 SYS DELETE
  14. Nine rows have been selected.
  15. SQL> select t. SQL _REDO from v $ logmnr_contents t where t. seg_name = 'mytesttab ';
  16. SQL _REDO
  17. Bytes ----------------------------------------------------------------------------------------------------
  18. Create table mytesttab as select * from scott. dept;
  19. Insert into "SYS". "MYTESTTAB" ("DEPTNO", "DNAME", "LOC") values ('80', 'it', 'wa ');
  20. Insert into "SYS". "MYTESTTAB" ("DEPTNO", "DNAME", "LOC") values ('90', 'mgr ', 'ymr ');
  21. Delete from "SYS". "MYTESTTAB" where "DEPTNO" = '10' and "DNAME" = 'account' and "LOC" = 'new
  22. YORK
  23. Delete from "SYS". "MYTESTTAB" where "DEPTNO" = '20' and "DNAME" = 'Research 'and "LOC" = 'Dallas'
  24. Delete from "SYS". "MYTESTTAB" where "DEPTNO" = '30' and "DNAME" = 'sales' and "LOC" = 'Chicago 'and
  25. Delete from "SYS". "MYTESTTAB" where "DEPTNO" = '40' and "DNAME" = 'operations' and "LOC" = 'boston'
  26. Delete from "SYS". "MYTESTTAB" where "DEPTNO" = '80' and "DNAME" = 'it' and "LOC" = 'wa 'and ROWID =
  27. Delete from "SYS". "MYTESTTAB" where "DEPTNO" = '90' and "DNAME" = 'mgr 'and "LOC" = 'lil' and ROWID =
  28. Nine rows have been selected.
  29. SQL> select t. SQL _UNDO from v $ logmnr_contents t where t. seg_name = 'mytesttab ';
  30. SQL _UNDO
  31. Bytes ----------------------------------------------------------------------------------------------------
  32. Delete from "SYS". "MYTESTTAB" where "DEPTNO" = '80' and "DNAME" = 'it' and "LOC" = 'wa 'and ROWID =
  33. Delete from "SYS". "MYTESTTAB" where "DEPTNO" = '90' and "DNAME" = 'mgr 'and "LOC" = 'lil' and ROWID =
  34. Insert into "SYS". "MYTESTTAB" ("DEPTNO", "DNAME", "LOC") values ('10', 'accounting', 'New YORK ');
  35. Insert into "SYS". "MYTESTTAB" ("DEPTNO", "DNAME", "LOC") values ('20', 'Research ', 'Dallas ');
  36. Insert into "SYS". "MYTESTTAB" ("DEPTNO", "DNAME", "LOC") values ('30', 'sales', 'Chicago ');
  37. Insert into "SYS". "MYTESTTAB" ("DEPTNO", "DNAME", "LOC") values ('40', 'operations', 'boston ');
  38. Insert into "SYS". "MYTESTTAB" ("DEPTNO", "DNAME", "LOC") values ('80', 'it', 'wa ');
  39. Insert into "SYS". "MYTESTTAB" ("DEPTNO", "DNAME", "LOC") values ('90', 'mgr ', 'ymr ');
  40. Nine rows have been selected.

Here is an introduction to the use of Logmnr instances in Oracle 10g. I hope this introduction will be helpful to you!

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.