--OBS: A documentaç?o da oracle se encontra no site abaixo:
--SITE: http://download-west.oracle.com/docs/cd/A97630_01/server.920/a96521/logminer.htm#18501
/* Otitiza o ítem 4.
select 'EXECUTE DBMS_LOGMNR.ADD_LOGFILE('''||'/u01/utl/'||substr(name,14,27)||''', DBMS_LOGMNR.ADDFILE);'
from V$ARCHIVED_LOG where dest_id = 1
and sequence# between 94540 and 94611
*/
--1. setar a variável UTL_FILE_DIR para um cominho exiteste
--2. executar o comando a procedure DBMS_LOGMNR_D.BUILD para a construç?o do dicionário (FLAT FILE)
EXECUTE DBMS_LOGMNR_D.BUILD('dictionary.ora', '/u01/utl', DBMS_LOGMNR_D.STORE_IN_FLAT_FILE);
--3. Iniciar uma nova lista de archives com o comando abaixo:
EXECUTE DBMS_LOGMNR.ADD_LOGFILE('/u01/utl/vs01_1_66700_623237409.dbf', DBMS_LOGMNR.NEW);
--4. Adicionar novos archives com os comandos abaixo:
EXECUTE DBMS_LOGMNR.ADD_LOGFILE('/u01/utl/vs01_1_66701_623237409.dbf', DBMS_LOGMNR.ADDFILE);
EXECUTE DBMS_LOGMNR.ADD_LOGFILE('/u01/utl/vs01_1_66702_623237409.dbf', DBMS_LOGMNR.ADDFILE);
--5. Executar a procudure DBMS_LOGMNR.START_LOGMNR para iniciar a consulta na V$LOGMNR_CONTENTS
EXECUTE DBMS_LOGMNR.START_LOGMNR( DICTFILENAME =>'/u01/utl/dictionary.ora');
--6 Exemplo de uma consulta na tabela V$LOGMNR_CONTENTS
--SELECT /* + FIRST_ROWS */ A.USERNAME, A.session_info, A.ROW_ID, a.operation, a.timestamp,SQL_REDO, SQL_UNDO
--CREATE TABLE admin.tb_auditoria_15102008 AS
insert /*+ APPEND */ into admin.tb_auditoria_15102008
SELECT /*+ FIRST_ROWS */ *
FROM V$LOGMNR_CONTENTS A
WHERE UPPER(A.SQL_REDO) LIKE '%TB_PROFISSAO%'
SELECT /* + FIRST_ROWS */ B.USERNAME, B.session_info, B.operation, B.timestamp, B.SQL_REDO
from admin.tb_auditoria_15102008 B
select * from V$LOGMNR_CONTENTS
--7. Executar a procudure DBMS_LOGMNR.END_LOGMNR para finalizar a consulta na V$LOGMNR_CONTENTS
EXECUTE DBMS_LOGMNR.END_LOGMNR;
SELECT NAME FROM V$ARCHIVED_LOG WHERE DICTIONARY_BEGIN='YES';
SELECT NAME FROM V$ARCHIVED_LOG WHERE DICTIONARY_END='YES';