1. 找到相关时段归档文件
2. 导出生产库的数据字典
3. 传送到测试库上,挖掘
4. 将结果告知客户
-
生产库上:
-
-
找到所需的归档日志
-
col name for a50
-
set pages 100 lin 120
-
select thread#,sequence#,name,to_char(completion_time,'yyyy-mm-dd hh24:mi:ss')riqi from v$archived_log where dest_id=1 and completion_time>sysdate-1 order by 1,2;
-
-
创建数据字典
-
create directory my_dictionary_dir as '/u01/app/oracle/oradata';
-
execute dbms_logmnr_d.build( dictionary_filename=>'dictionary.ora', dictionary_location=>'my_dictionary_dir', options => dbms_logmnr_d.store_in_flat_file);
-
-
将归档文件和数据字典scp到测试库上/home/oracle目录下
-
-
测试库上:
-
-
execute dbms_logmnr.add_logfile( logfilename => '/home/oracle/1_42_1088407163.dbf', options => dbms_logmnr.new);
-
execute dbms_logmnr.add_logfile( logfilename => '/home/oracle/1_43_1088407163.dbf', options => dbms_logmnr.addfile);
-
execute dbms_logmnr.add_logfile( logfilename => '/home/oracle/2_35_1088407163.dbf', options => dbms_logmnr.addfile);
-
execute dbms_logmnr.add_logfile( logfilename => '/home/oracle/2_36_1088407163.dbf', options => dbms_logmnr.addfile);
-
-
alter session set nls_date_format = 'yyyy-mm-dd hh24:mi:ss';
-
-
execute dbms_logmnr.start_logmnr( -
-
dictfilename => '/home/oracle/dictionary.ora', -
-
starttime => '2021-11-24 00:59:53', -
-
endtime => '2021-11-24 06:59:53'-
-
);
-
-- create table logminer1 tablespace users as
-
select username as usr, (xidusn || '.' || xidslt || '.' || xidsqn) as xid, sql_redo, sql_undo from v$logmnr_contents where seg_owner='a';
-
-
execute dbms_logmnr.end_logmnr;
-