Oracle 11g LogMiner解析redo日志(5)

EMPNO ENAME      JOB          MGR HIREDATE              SAL    COMM    DEPTNO
 ---------- ---------- --------- ---------- ------------------- ---------- ---------- ----------
      7900 JAMES      CLERK          7698 1981-12-03 00:00:00        0            30
      7902 FORD      ANALYST          7566 1981-12-03 00:00:00        0            20
      7934 MILLER    CLERK          7782 1982-01-23 00:00:00        0            10

14 rows selected.

SQL>
 SQL>
 SQL> update xxx set job=sal;

14 rows updated.

SQL> commit;

Commit complete.

SQL> alter system switch logfile;

System altered.

SQL>

8.8、查看数据库当前归档信息

SQL> select GROUP#,THREAD#,SEQUENCE#,ARCHIVED,MEMBERS,status from v$log;

GROUP#    THREAD#  SEQUENCE# ARC    MEMBERS STATUS
 ---------- ---------- ---------- --- ---------- ----------------
      1        1        154 YES          1 INACTIVE
      2        1        156 NO          1 CURRENT
      3        1        155 YES          1 ACTIVE

SQL> alter system switch logfile;

System altered.

SQL> select GROUP#,THREAD#,SEQUENCE#,ARCHIVED,MEMBERS,status from v$log;

GROUP#    THREAD#  SEQUENCE# ARC    MEMBERS STATUS
 ---------- ---------- ---------- --- ---------- ----------------
      1        1        157 NO          1 CURRENT
      2        1        156 YES          1 ACTIVE
      3        1        155 YES          1 ACTIVE

SQL>

8.9、添加要分析的归档文件

SQL> execute dbms_logmnr.add_logfile('/u01/app/oracle/flash_recovery_area/OR11G/archivelog/2018_09_20/o1_mf_1_153_ft6k0418_.arc',DBMS_LOGMNR.new );

PL/SQL procedure successfully completed.

SQL> execute dbms_logmnr.add_logfile('/u01/app/oracle/flash_recovery_area/OR11G/archivelog/2018_09_20/o1_mf_1_154_ft6k04lg_.arc',DBMS_LOGMNR.addfile );

PL/SQL procedure successfully completed.

SQL> execute dbms_logmnr.add_logfile('/u01/app/oracle/flash_recovery_area/OR11G/archivelog/2018_09_20/o1_mf_1_155_ft6mvo0s_.arc',DBMS_LOGMNR.addfile );

PL/SQL procedure successfully completed.

SQL> execute dbms_logmnr.add_logfile('/u01/app/oracle/flash_recovery_area/OR11G/archivelog/2018_09_20/o1_mf_1_156_ft6mwq0j_.arc',DBMS_LOGMNR.addfile );

PL/SQL procedure successfully completed.

SQL> execute dbms_logmnr.add_logfile('/u01/app/oracle/flash_recovery_area/OR11G/archivelog/2018_09_20/o1_mf_1_158_ft6n833c_.arc',DBMS_LOGMNR.addfile );

PL/SQL procedure successfully completed.

SQL> execute dbms_logmnr.add_logfile('/u01/app/oracle/flash_recovery_area/OR11G/archivelog/2018_09_20/o1_mf_1_157_ft6n80o4_.arc',DBMS_LOGMNR.addfile );

PL/SQL procedure successfully completed.

SQL>

8.10、执行分析

SQL> exec dbms_logmnr.start_logmnr(dictfilename=>'/u03/007dict.data');

PL/SQL procedure successfully completed.

SQL>

8.11、将分析结果持久化保存

因为logminer分析处理的结果只有本session能看到,所以可以先用表把数据记录,然后再进行分析:

SQL> Create table df01 as select * from v$logmnr_contents;

Table created.

SQL>
 8.12、分析数据表

Oracle 11g LogMiner解析redo日志

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/aae97e34c402eb60dd40fae9b0c9b0e1.html