SQL> select group#,members,status from v$log;
GROUP# MEMBERS
STATUS
---------- ---------- ----------------
1 1
ACTIVE
2 1
CURRENT
3 1
INACTIVE
|
SQL> alter system switch logfile;
SQL> select group#,members,status from v$log;
GROUP# MEMBERS
STATUS
---------- ---------- ----------------
1 1
INACTIVE
2 1
ACTIVE
3 1
CURRENT
|
SQL> archive log list
Database log mode Archive Mode
Automatic archival
Enabled
Archive destination
/u01/oradata/denver/archive
Oldest online log sequence
16
Next log sequence to archive
18
Current log sequence
18
SQL> ! ls /u01/oradata/denver/archive
1_10.dbf 1_12.dbf 1_14.dbf 1_16.dbf 1_1.dbf 1_3.dbf 1_5.dbf 1_7.dbf 1_9.dbf
1_11.dbf 1_13.dbf 1_15.dbf 1_17.dbf 1_2.dbf 1_4.dbf 1_6.dbf 1_8.dbf
|
SQL> alter system switch logfile;
System altered.
SQL> archive log list
Database log mode Archive Mode
Automatic archival
Enabled
Archive destination
/u01/oradata/denver/archive
Oldest online log sequence
17
Next log sequence to archive
19
Current log sequence
19
SQL> ! ls /u01/oradata/denver/archive
1_10.dbf 1_12.dbf 1_14.dbf 1_16.dbf 1_18.dbf 1_2.dbf 1_4.dbf 1_6.dbf 1_8.dbf
1_11.dbf 1_13.dbf 1_15.dbf 1_17.dbf 1_1.dbf 1_3.dbf 1_5.dbf 1_7.dbf 1_9.dbf
|
SQL> select * from t;
I V
---------- ---------
----------------
-
1 2
3 4
15 10
|
[oracle@oracle ~]$ pwd
/home/oracle
[oracle@oracle ~]$ mkdir utlfile
|
SQL> alter system set utl_file_dir='/home/oracle/utlfile' scope=spfile;
SQL> shutdown immediate
SQL> startup
|
SQL> @$ORACLE_HOME/rdbms/admin/dbmslm.sql
Package created.
Grant succeeded.
SQL> @$ORACLE_HOME/rdbms/admin/dbmslmd.sql
Package created.
|
SQL> execute dbms_logmnr_d.build('dirt.ora','/home/oracle/utlfile',dbms_logmnr_d.store_in_flat_file)
PL/SQL procedure successfully completed.
|
SQL> update t set i=100 where v=2;
SQL> update t set v=0 where i=15;
SQL> commit;
SQL> select * from t;
I V
---------- ----------
100 2
3 4
15 0
|
SQL> alter system switch logfile;
SQL> ! ls /u01/oradata/denver/archive
1_10.dbf 1_13.dbf 1_16.dbf 1_19.dbf 1_3.dbf 1_6.dbf 1_9.dbf
1_11.dbf 1_14.dbf 1_17.dbf 1_1.dbf 1_4.dbf 1_7.dbf
1_12.dbf 1_15.dbf 1_18.dbf 1_2.dbf 1_5.dbf 1_8.dbf
|
SQL> execute dbms_logmnr.add_logfile('/u01/oradata/denver/archive/1_19.dbf',dbms_logmnr.new);
PL/SQL procedure successfully completed.
#
如果要添加更多的日志
execute dbms_logmnr.add_logfile('/u01/oradata/denver/archive/1_19.dbf',dbms_logmnr.
addfile
);
#
查看添加的日志
SQL> select * from v$logmnr_logs;
|
SQL> execute dbms_logmnr.start_logmnr(dictfilename=>'/home/oracle/utlfile/dirt.ora')
PL/SQL procedure successfully completed.
|
SQL> col seg_name format a10
SQL> col sql_redo format a55
SQL> select seg_name,sql_redo,timestamp from v$logmnr_contents where seg_name='T';
SEG_NAME SQL_REDO TIMESTAMP
---------- ------------------------------------------------------- ---------
-----------------------------------------------
T update "SYS"."T" set "I" = '100' where "I" = '1' and RO 05-MAY-09
WID = 'AAAHwwAABAAALmaAAA';
T update "SYS"."T" set "V" = '0' where "V" = '10' and ROW 05-MAY-09
ID = 'AAAHwwAABAAALmaAAC';
|
SQL> execute dbms_logmnr.end_logmnr;
PL/SQL procedure successfully completed.
|