[Logmnr]對歸檔日誌進行資料探勘
1、建立演示資料
2、手動切換歸檔日誌
3、查詢歸檔日誌相關資訊
4、新增需要進行解析的日誌檔案
5、使用線上字典進行解析+只查詢commit的資料+不顯示rowid
6、查詢解析結果
7、結束整個Logminer
其中第5步也可以使用utl_file_dir(不建議,該引數只是為了相容9i),具體步驟如下:
①修改utl_file_dir引數,並重啟資料庫
②使用dbms_logmnr_d.build建立OS上的字典檔案
③新增歸檔日誌檔案
④啟用Logmnr分析
-
SQL> update emp set sal=sal+100 where deptno=10;
SQL> update emp set sal=sal+200 where deptno=20;
SQL> update emp set sal=sal+300 where deptno=30;
SQL> update emp set sal=sal+400 where deptno=40;
SQL> update emp set sal=sal-400 where deptno=10;
-
SQL> alter system switch logfile;
- System altered
-
SQL> select name,sequence# from v$archived_log;
NAME SEQUENCE#
--------------------------------------------------- ----------
/u01/oracle/archive/1_34_895068568.dbf 34
/u01/oracle/archive/1_35_895068568.dbf 35
/u01/oracle/archive/1_36_895068568.dbf 36
3 rows selected
-
SQL> exec dbms_logmnr.add_logfile('/u01/oracle/archive/1_34_895068568.dbf',dbms_logmnr.new);
-
PL/SQL procedure successfully completed
-
-
SQL> exec dbms_logmnr.add_logfile('/u01/oracle/archive/1_35_895068568.dbf',dbms_logmnr.addfile);
-
PL/SQL procedure successfully completed
-
-
SQL> exec dbms_logmnr.add_logfile('/u01/oracle/archive/1_36_895068568.dbf',dbms_logmnr.addfile);
- PL/SQL procedure successfully completed
-
SQL> exec dbms_logmnr.start_logmnr(options=>dbms_logmnr.dict_from_online_catalog+dbms_logmnr.committed_data_only+dbms_logmnr.no_rowid_in_stmt);
- PL/SQL procedure successfully completed
-
SQL> select sql_redo,sql_undo from v$logmnr_contents where table_name='EMP';
SQL_REDO SQL_UNDO
------------------------------------------------------------------------------------------------------------------------
update "SCOTT"."EMP" set "SAL" = '2472' where "SAL" = '2462' update "SCOTT"."EMP" set "SAL" = '2462' where "SAL" = '2472'
update "SCOTT"."EMP" set "SAL" = '5022' where "SAL" = '5012' update "SCOTT"."EMP" set "SAL" = '5012' where "SAL" = '5022'
update "SCOTT"."EMP" set "SAL" = '1322' where "SAL" = '1312' update "SCOTT"."EMP" set "SAL" = '1312' where "SAL" = '1322'
update "SCOTT"."EMP" set "SAL" = '2572' where "SAL" = '2472' update "SCOTT"."EMP" set "SAL" = '2472' where "SAL" = '2572'
update "SCOTT"."EMP" set "SAL" = '5122' where "SAL" = '5022' update "SCOTT"."EMP" set "SAL" = '5022' where "SAL" = '5122'
update "SCOTT"."EMP" set "SAL" = '1422' where "SAL" = '1322' update "SCOTT"."EMP" set "SAL" = '1322' where "SAL" = '1422'
update "SCOTT"."EMP" set "SAL" = '1020' where "SAL" = '820' update "SCOTT"."EMP" set "SAL" = '820' where "SAL" = '1020'
update "SCOTT"."EMP" set "SAL" = '3195' where "SAL" = '2995' update "SCOTT"."EMP" set "SAL" = '2995' where "SAL" = '3195'
update "SCOTT"."EMP" set "SAL" = '3220' where "SAL" = '3020' update "SCOTT"."EMP" set "SAL" = '3020' where "SAL" = '3220'
update "SCOTT"."EMP" set "SAL" = '1320' where "SAL" = '1120' update "SCOTT"."EMP" set "SAL" = '1120' where "SAL" = '1320'
update "SCOTT"."EMP" set "SAL" = '3220' where "SAL" = '3020' update "SCOTT"."EMP" set "SAL" = '3020' where "SAL" = '3220'
update "SCOTT"."EMP" set "SAL" = '1930' where "SAL" = '1630' update "SCOTT"."EMP" set "SAL" = '1630' where "SAL" = '1930'
update "SCOTT"."EMP" set "SAL" = '1580' where "SAL" = '1280' update "SCOTT"."EMP" set "SAL" = '1280' where "SAL" = '1580'
update "SCOTT"."EMP" set "SAL" = '1580' where "SAL" = '1280' update "SCOTT"."EMP" set "SAL" = '1280' where "SAL" = '1580'
update "SCOTT"."EMP" set "SAL" = '3180' where "SAL" = '2880' update "SCOTT"."EMP" set "SAL" = '2880' where "SAL" = '3180'
update "SCOTT"."EMP" set "SAL" = '1830' where "SAL" = '1530' update "SCOTT"."EMP" set "SAL" = '1530' where "SAL" = '1830'
update "SCOTT"."EMP" set "SAL" = '1280' where "SAL" = '980' update "SCOTT"."EMP" set "SAL" = '980' where "SAL" = '1280'
update "SCOTT"."EMP" set "SAL" = '2172' where "SAL" = '2572' update "SCOTT"."EMP" set "SAL" = '2572' where "SAL" = '2172'
update "SCOTT"."EMP" set "SAL" = '4722' where "SAL" = '5122' update "SCOTT"."EMP" set "SAL" = '5122' where "SAL" = '4722'
update "SCOTT"."EMP" set "SAL" = '1022' where "SAL" = '1422' update "SCOTT"."EMP" set "SAL" = '1422' where "SAL" = '1022'
20 rows selected
-
SQL> exec dbms_logmnr.end_logmnr();
- PL/SQL procedure successfully completed
①修改utl_file_dir引數,並重啟資料庫
-
SQL> alter system set utl_file_dir='/home/oracle/' scope=spfile;
-
System altered.
-
-
SQL> shutdown immediate;
-
-
SQL> startup
- ORACLE instance started.
-
SQL> exec dbms_logmnr_d.build('logmnr_dict.ora','/home/oracle/',dbms_logmnr_d.store_in_flat_file);
- PL/SQL procedure successfully completed.
-
SQL> exec dbms_logmnr.add_logfile('/u01/oracle/archive/1_32_895068568.dbf',dbms_logmnr.new);
-
PL/SQL procedure successfully completed.
-
-
SQL> exec dbms_logmnr.add_logfile('/u01/oracle/archive/1_33_895068568.dbf',dbms_logmnr.addfile);
-
PL/SQL procedure successfully completed.
-
-
SQL> exec dbms_logmnr.add_logfile('/u01/oracle/archive/1_34_895068568.dbf',dbms_logmnr.addfile);
- PL/SQL procedure successfully completed.
-
SQL> exec dbms_logmnr.start_logmnr(dictfilename=>'/home/oracle/logmnr_dict.ora');
- PL/SQL procedure successfully completed.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29812844/viewspace-1988827/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- [Logmnr]對重做日誌進行資料探勘
- logmnr挖掘歸檔日誌檔案
- logmnr分析歸檔重做日誌
- 使用歸檔日誌分析解決歸檔日誌迅速增長問題(logmnr)
- 使用logmnr分析歸檔日誌恢復被drop掉的資料表
- 測試在丟失歸檔日誌的情況下,跳過部分歸檔日誌進行資料恢復資料恢復
- 在oracle中Logmnr進行日誌挖掘Oracle
- 使用logmnr,在RMAN備份檔案中恢復備份的歸檔日誌檔案進行分析
- Oralce資料庫關閉歸檔日誌並且刪除歸檔日誌資料庫
- LogMnr-誤DML後使用logmnr對資料進行恢復
- 手工rm刪除歸檔日誌對備份歸檔日誌的影響
- 使用LOGMNR檢視資料庫日誌資料庫
- 資料檔案重建,從歸檔日誌中回退資料
- rman清除歸檔日誌經典資料
- 無歸檔日誌恢復rman資料
- 達夢資料庫使用DBMS_LOGMNR進行日誌挖掘詳細步驟資料庫
- 歸檔日誌
- 通過DataWorks資料整合歸檔日誌服務資料至MaxCompute進行離線分析
- 【Oracle】歸檔日誌管理-設定歸檔日誌路徑以及歸檔日誌冗餘Oracle
- 歸檔日誌無法歸檔導致資料庫hang住資料庫
- 對歸檔模式下CLEAR 未歸檔日誌後恢復資料庫的一點看法模式資料庫
- oracle資料庫歸檔日誌量陡增分析Oracle資料庫
- 歸檔日誌滿造成資料庫當機資料庫
- RMAN備份資料檔案+控制檔案+歸檔日誌
- logmnr 日誌挖掘
- SQL資料庫怎麼進行資料歸檔和歸檔管理?SQL資料庫
- oracle歸檔日誌Oracle
- Oracle 歸檔日誌Oracle
- 歸檔日誌挖掘
- PostgreSQL 歸檔日誌SQL
- WINDOWS下對NIGNX日誌檔案進行限制Windows
- Oracle資料庫重做日誌及歸檔日誌的工作原理說明Oracle資料庫
- dbms_logmnr 線上挖歸檔 恢復資料
- 將資料庫轉換為歸檔日誌模式資料庫模式
- 日誌和告警資料探勘經驗談
- 控制檔案/歸檔日誌
- ORACLE LOGMNR 日誌挖掘Oracle
- 歸檔日誌多歸檔路徑 duplex