dbms_logmnr挖掘归档日志

select thread#,
SEQUENCE#,
REGISTRAR,
APPLIED,
to_char(first_TIME, ‘yyyy-mm-dd-hh24:mi:ss’),
to_char(COMPLETION_TIME, ‘yyyy-mm-dd-hh24:mi:ss’)
from v$archived_log
order by first_TIMe;

1 544 ARCH NO 2017-11-29-10:22:13 2017-11-29-10:22:19
1 545 ARCH NO 2017-11-29-10:22:17 2017-11-29-10:25:01

SQL> select name from v$archived_log where sequence#=544;

NAME

+ORADAT/hw/archivelog/2017_11_29/thread_1_seq_544.1016.961323739

SQL> select name from v$archived_log where sequence#=545;

NAME

+ORADAT/hw/archivelog/2017_11_29/thread_1_seq_545.1014.961323901

execute dbms_logmnr.add_logfile(logfilename=>’+ORADAT/hw/archivelog/2017_11_29/thread_1_seq_544.1016.961323739’,options=>dbms_logmnr.new);
execute dbms_logmnr.add_logfile(logfilename=>’+ORADAT/hw/archivelog/2017_11_29/thread_1_seq_545.1014.961323901’,options=>dbms_logmnr.addfile);
execute dbms_logmnr.start_logmnr(options=>dbms_logmnr.dict_from_online_catalog);
select username,scn,timestamp,sql_redo from v$logmnr_contents where seg_name=upper(‘TEST2’);
execute dbms_logmnr.end_logmnr;

SQL> select count(*) from v$logmnr_contents;

COUNT(*)

  4734

SQL> execute dbms_logmnr.end_logmnr;

PL/SQL procedure successfully completed.

SQL> select count(*) from v l o g m n r c o n t e n t s ; s e l e c t c o u n t ( ) f r o m v logmnr_contents; select count(*) from v logmnr_contents
*
ERROR at line 1:
ORA-01306: dbms_logmnr.start_logmnr() must be invoked before selecting from
v$logmnr_contents

在end_logmnr前备份出来
SQL> create table kkkk tablespace users as select * from v$logmnr_contents;

Table created.

猜你喜欢

转载自blog.csdn.net/qq_41128383/article/details/86476726