最新文章專題視頻專題問(wèn)答1問(wèn)答10問(wèn)答100問(wèn)答1000問(wèn)答2000關(guān)鍵字專題1關(guān)鍵字專題50關(guān)鍵字專題500關(guān)鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關(guān)鍵字專題關(guān)鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
問(wèn)答文章1 問(wèn)答文章501 問(wèn)答文章1001 問(wèn)答文章1501 問(wèn)答文章2001 問(wèn)答文章2501 問(wèn)答文章3001 問(wèn)答文章3501 問(wèn)答文章4001 問(wèn)答文章4501 問(wèn)答文章5001 問(wèn)答文章5501 問(wèn)答文章6001 問(wèn)答文章6501 問(wèn)答文章7001 問(wèn)答文章7501 問(wèn)答文章8001 問(wèn)答文章8501 問(wèn)答文章9001 問(wèn)答文章9501
當(dāng)前位置: 首頁(yè) - 科技 - 知識(shí)百科 - 正文

oracle11g之LogMiner分析重做日志實(shí)踐

來(lái)源:懂視網(wǎng) 責(zé)編:小采 時(shí)間:2020-11-09 16:29:50
文檔

oracle11g之LogMiner分析重做日志實(shí)踐

oracle11g之LogMiner分析重做日志實(shí)踐:1.安裝LogMiner 以DBA用戶身份運(yùn)行下面2個(gè)腳本: dbmslm.sql用來(lái)創(chuàng)建DBMS_LOGMNR包,該包用來(lái)分析日志文件。 SQL @$ORACLE_HOME/rdbms/admin/dbmslm.sql;Package created.Grant succeeded.Synonym created. dbms
推薦度:
導(dǎo)讀oracle11g之LogMiner分析重做日志實(shí)踐:1.安裝LogMiner 以DBA用戶身份運(yùn)行下面2個(gè)腳本: dbmslm.sql用來(lái)創(chuàng)建DBMS_LOGMNR包,該包用來(lái)分析日志文件。 SQL @$ORACLE_HOME/rdbms/admin/dbmslm.sql;Package created.Grant succeeded.Synonym created. dbms
  • dbmslm.sql用來(lái)創(chuàng)建DBMS_LOGMNR包,該包用來(lái)分析日志文件。
  • SQL> @$ORACLE_HOME/rdbms/admin/dbmslm.sql;
    
    Package created.
    
    Grant succeeded.
    
    Synonym created.
  • dbmslmd.sql用來(lái)創(chuàng)建DBMS_LOGMNR_D包,該包用來(lái)創(chuàng)建數(shù)據(jù)字典文件。
  • SQL> @$ORACLE_HOME/rdbms/admin/dbmslmd.sql;
    
    Package created.
    
    Synonym created.


    2.設(shè)置參數(shù)UTL_FILE_DIR

    添加參數(shù)UTL_FILE_DIR,該參數(shù)值為服務(wù)器中放置數(shù)據(jù)字典文件的目錄,

    SQL> CREATE DIRECTORY utlfile AS '/home/oracle/logminer';
    
    Directory created.
    
    SQL> alter system set utl_file_dir='/home/oracle/logminer' scope=spfile;
    
    System altered.

    重啟數(shù)據(jù)庫(kù),生效上面的設(shè)置。

    SQL> shutdown immediate;
    
    SQL> startup;
    
    SQL> show parameters utl_file_dir;

    3.啟動(dòng)補(bǔ)充日志

    補(bǔ)充日志不是LogMiner日志分析必須的步驟,但是如果不啟用補(bǔ)充日志,分析日志的的很多結(jié)果集信息就會(huì)顯示為“UNKNOWN”,下面是開(kāi)啟最小補(bǔ)充日志。

    SQL> ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;
    
    Database altered.
    
    SQL> SELECT SUPPLEMENTAL_LOG_DATA_MIN FROM V$DATABASE;
    
    SUPPLEME
    
     --------
    
     YES
    

    4.創(chuàng)建專門的LogMiner用戶

    不是必須,實(shí)為管理安全方便。

    5.創(chuàng)建數(shù)據(jù)字典

    SQL> EXECUTE dbms_logmnr_d.build(dictionary_filename => 'dictionary.ora', dictionary_location =>'/home/oracle/logminer');

    6.添加需要分析的在線日志或者歸檔日志

    SQL> EXECUTE DBMS_LOGMNR.ADD_LOGFILE(LOGFILENAME =>'
    
    /home/oracle/flash_recovery_area/PRIMARY/archivelog/2016_04_25/o1_mf_1_199_ckv04o6w_.arc',OPTIONS => DBMS_LOGMNR.NEW);
    
    SQL> EXECUTE DBMS_LOGMNR.ADD_LOGFILE(LOGFILENAME =>'
    
    /home/oracle/flash_recovery_area/PRIMARY/archivelog/2016_04_25/o1_mf_1_201_ckv08jyp_.arc',OPTIONS => DBMS_LOGMNR.ADDFILE);
    
    PL/SQL procedure successfully completed.
    
    SQL> EXECUTE DBMS_LOGMNR.ADD_LOGFILE(LOGFILENAME =>'
    
    /home/oracle/flash_recovery_area/PRIMARY/archivelog/2016_04_25/o1_mf_1_200_ckv05pmp_.arc',OPTIONS => DBMS_LOGMNR.ADDFILE);
    
    PL/SQL procedure successfully completed.

    7. 使用字典分析歸檔日志文件

    SQL> EXECUTE dbms_logmnr.start_logmnr(dictfilename=>'/home/oracle/logminer/dictionary.ora');

    8.在線日志分析實(shí)例

  • 插入數(shù)據(jù)
  • SQL> insert into nn.t1 values(1000,'succ');
    
    1 row created.
    
    SQL> commit;
    
    Commit complete.

  • 查詢當(dāng)前日志序列號(hào)
  • SQL> SELECT group#, sequence#, status, first_change#, first_time FROM V$log ORD ER BY first_change#;
    
     GROUP# SEQUENCE# STATUS FIRST_CHANGE# FIRST_TIM
    
    ---------- ---------- ---------------- ------------- ---------
    
     1 208 INACTIVE 2825768 25-APR-16
    
     2 209 INACTIVE 2825872 25-APR-16
    
     3 210 CURRENT 2845771 25-APR-16

  • 加入當(dāng)前日志組
  • SQL> EXECUTE DBMS_LOGMNR.ADD_LOGFILE(LOGFILENAME =>'/home/oracle/oradata/orcl/redo03.log',OPTIONS => DBMS_LOGMNR.ADDFILE);
    
    PL/SQL procedure successfully completed.

  • 使用LogMiner進(jìn)行分析
  • SQL> EXECUTE dbms_logmnr.start_logmnr(dictfilename=>'/home/oracle/logminer/dictionary.ora');
    
    PL/SQL procedure successfully completed.

  • 查詢分析結(jié)果
  • SQL> SELECT sql_redo, sql_undo, seg_owner FROM v$logmnr_contents WHERE seg_name='T1';
    
    SQL_REDO SQL_UNDO SEG_OWNER
    
    insert into "NN"."T1"("TID","TNAME") values ('1000','succ');
    
    delete from "NN"."T1" where "TID" = '1000' and "TNAME" = 'succ' and ROWID = 'AAAR7YAAEAAAACrAAD';
    
    NN


    9.關(guān)閉LogMiner會(huì)話

    SQL> EXECUTE DBMS_LOGMNR.END_LOGMNR;
    



    聲明:本網(wǎng)頁(yè)內(nèi)容旨在傳播知識(shí),若有侵權(quán)等問(wèn)題請(qǐng)及時(shí)與本網(wǎng)聯(lián)系,我們將在第一時(shí)間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

    文檔

    oracle11g之LogMiner分析重做日志實(shí)踐

    oracle11g之LogMiner分析重做日志實(shí)踐:1.安裝LogMiner 以DBA用戶身份運(yùn)行下面2個(gè)腳本: dbmslm.sql用來(lái)創(chuàng)建DBMS_LOGMNR包,該包用來(lái)分析日志文件。 SQL @$ORACLE_HOME/rdbms/admin/dbmslm.sql;Package created.Grant succeeded.Synonym created. dbms
    推薦度:
    標(biāo)簽: 11 日志 重做
    • 熱門焦點(diǎn)

    最新推薦

    猜你喜歡

    熱門推薦

    專題
    Top