主頁 > 知識庫 > 如何使用log miner分析oracle日志

如何使用log miner分析oracle日志

熱門標(biāo)簽:七日殺a19.5全地圖標(biāo)注 騰訊地圖標(biāo)注要費(fèi)用嗎 高德地圖標(biāo)注公司名字大全 廣東營銷智能外呼系統(tǒng)商家 N個(gè)你智能電銷機(jī)器人 外呼電話系統(tǒng)用卡嗎 電渠外呼系統(tǒng) 地圖標(biāo)注怎么保存 車瑪仕極限運(yùn)動(dòng)場所地圖標(biāo)注

當(dāng)我們不小心誤操作致使數(shù)據(jù)庫數(shù)據(jù)丟失、改變時(shí), 需要對數(shù)據(jù)庫對象做基于時(shí)間點(diǎn)的恢復(fù),找到我們需要的數(shù)據(jù),這個(gè)時(shí)間點(diǎn)不能認(rèn)為精確確定,我們可以通過對oracle日志進(jìn)行分析,而獲得無操作的精確時(shí)間點(diǎn)。
oracle db提供了一個(gè)分析日志包logmnr
logminer 工具的使用
-------對redo log 進(jìn)行挖掘,找出在某個(gè)時(shí)間點(diǎn)所作的DDL 或DML 操作(包括:時(shí)間點(diǎn)、datablock scn 、sql語句)
實(shí)驗(yàn)測試

SQL> select name from v$archived_log;
 
NAME
--------------------------------------------------
/oracle/arch1/1_2_883536782.dbf
 
SQL>
SQL>
SQL> delete from scott.t1; 
576 rows deleted. 
SQL> alter system archive log current; 
System altered. 
SQL> create table scott.t6 as select * from scott.emp; 
Table created. 
SQL> alter system archive log current;
System altered.
SQL> select name from v$archived_log;
 
NAME
--------------------------------------------------
/oracle/arch1/1_2_883536782.dbf
/oracle/arch1/1_3_883536782.dbf
/oracle/arch1/1_4_883536782.dbf

--啟動(dòng)log miner添加要分析的日志

SQL> execute dbms_logmnr.add_logfile(logfilename=>'/oracle/arch1/1_2_883536782.dbf',options=>dbms_logmnr.new);

PL/SQL procedure successfully completed.

--添加需要分析的日志

SQL> execute dbms_logmnr.add_logfile(logfilename=>'/oracle/arch1/1_3_883536782.dbf',options=>dbms_logmnr.addfile); 

PL/SQL procedure successfully completed. 

SQL> execute dbms_logmnr.add_logfile(logfilename=>'/oracle/arch1/1_4_883536782.dbf',options=>dbms_logmnr.addfile) 

PL/SQL procedure successfully completed.

--執(zhí)行l(wèi)og miner


SQL> execute dbms_logmnr.start_logmnr(options=>dbms_logmnr.dict_from_online_catalog); 

PL/SQL procedure successfully completed.

--查詢分析結(jié)果

SQL> alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss'; 
Session altered.
SQL> select username,scn,timestamp,sql_redo from v$logmnr_contents where seg_name='T1'; 
USERNAME  SCN TIMESTAMP
------------------------------ ---------- -------------------
SQL_REDO
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
delete from "SCOTT"."T1" where "EMPNO" = '7782' and "ENAME" = 'CLARK' and "JOB" = 'MANAGER' and "MGR" = '7839' and "HIREDATE" = TO_DATE('1981-06-09 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and "SAL" = '245
0' and "COMM" IS NULL and "DEPTNO" = '10' and ROWID = 'AAAVbSAAFAAAACXABi';
 
SYS  1494545 2015-06-28 04:24:44
delete from "SCOTT"."T1" where "EMPNO" = '7839' and "ENAME" = 'KING' and "JOB" = 'PRESIDENT' and "MGR" IS NULL and "HIREDATE" = TO_DATE('1981-11-17 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and "SAL" = '500
0' and "COMM" IS NULL and "DEPTNO" = '10' and ROWID = 'AAAVbSAAFAAAACXABj';
 
SYS  1494545 2015-06-28 04:24:44
delete from "SCOTT"."T1" where "EMPNO" = '7844' and "ENAME" = 'TURNER' and "JOB" = 'SALESMAN' and "MGR" = '7698' and "HIREDATE" = TO_DATE('1981-09-08 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and "SAL" = '1
。。。。。

--結(jié)束log miner 分析

SQL> execute dbms_logmnr.end_logmnr;
 
PL/SQL procedure successfully completed.

以上就是本文的全部內(nèi)容,希望大家可以喜歡。

您可能感興趣的文章:
  • 理解和使用Oracle 8i分析工具LogMiner
  • 淺談LogMiner的使用方法

標(biāo)簽:蘇州 玉樹 遼寧 長沙 棗莊 贛州 來賓 大興安嶺

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《如何使用log miner分析oracle日志》,本文關(guān)鍵詞  如何,使用,log,miner,分析,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《如何使用log miner分析oracle日志》相關(guān)的同類信息!
  • 本頁收集關(guān)于如何使用log miner分析oracle日志的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章