Oracle logMiner

-- oracle 10g  10.2.0.1.0


--1 change UTL_FILE_DIR 
alter system set UTL_FILE_DIR = 'F:\orace-center\log' scope = spfile;

-- restart database
  shutdown immediate;
startup 

-- 2 create dict file
begin
   dbms_logmnr_d.build('sqltrace.ora','F:\orace-center\log'); 
end;

-- 3 add logfiles
-- Options:1 new 2 remove a logfile 3 add a logfile
--
--PROCEDURE add_logfile(
   --  LogFileName    	IN  VARCHAR2,
    -- Options		IN  BINARY_INTEGER default ADDFILE );

BEGIN
  DBMS_LOGMNR.add_logfile('F:\oracle\product\10.2.0\db_1\RDBMS\ARC02384_0767272915.001',1);
  DBMS_LOGMNR.add_logfile('F:\oracle\product\10.2.0\db_1\RDBMS\ARC02383_0767272915.001',3);
  DBMS_LOGMNR.add_logfile('F:\oracle\product\10.2.0\db_1\RDBMS\ARC02382_0767272915.001',3);
END;



-- query
select * from v$logmnr_logs;
2382        F:\oracle\product\10.2.0\db_1\RDBMS\ARC02382_0767272915.001        2011-11-18 14:05:51        2011-11-21 15:54:52        808900772        ORCLONE        393838        2011-11-15 11:21:55        1        2382        1176079        1202646        NO        NO        ARCHIVE        512        3032576                0
2383        F:\oracle\product\10.2.0\db_1\RDBMS\ARC02383_0767272915.001        2011-11-21 15:54:52        2011-11-21 15:59:26        808900772        ORCLONE        393838        2011-11-15 11:21:55        1        2383        1202646        1202923        NO        NO        ARCHIVE        512        110080                0
2384        F:\oracle\product\10.2.0\db_1\RDBMS\ARC02384_0767272915.001        2011-11-21 15:59:26        2011-11-21 16:14:29        808900772        ORCLONE        393838        2011-11-15 11:21:55        1        2384        1202923        1203591        NO        NO        ARCHIVE        512        439296                0

-- 4 analyse logfile
 -- PROCEDURE start_logmnr(
 --    startScn           IN  NUMBER default 0 ,
 --  endScn 		IN  NUMBER default 0,
 -- startTime      	IN  DATE default '',
 --    endTime        	IN  DATE default '',
 --    DictFileName    	IN  VARCHAR2 default '',
 --    Options		IN  BINARY_INTEGER default 0 );

--
BEGIN
  DBMS_LOGMNR.START_LOGMNR(0, 0,
                            TO_DATE('20111120 12:15:00', 'yyyymmdd hh24:mi:ss'), TO_DATE('20111122 15:40:30', 'yyyymmdd hh24:mi:ss'), 'F:\orace-center\log\sqltrace.ora', 0);
END;


-- query result

select * from v$logmnr_contents;

 

 

--=============================

日志文件相关视图

SELECT *
  FROM V$LOG;
SELECT *
  FROM V$LOGFILE;
SELECT *
  FROM V$LOG_HISTORY;

SELECT *
  FROM V$LOGMNR_LOGS;
SELECT *
  FROM V$LOGMNR_CONTENTS A;

 ---==========================================

官方文档

附件

 

你可能感兴趣的:(oracle)