一次失敗的logmnr操作

楊奇龍發表於2010-06-11

SQL> conn system/yang as sysdba
已連線。
SQL> archive log list
資料庫日誌模式            存檔模式
自動存檔             啟用
存檔終點            f:\app\yang\archive2
最早的聯機日誌序列     13
下一個存檔日誌序列   15
當前日誌序列           15
SQL> conn scott/yang
已連線。
SQL> select count(*) from t2;

  COUNT(*)                                                                     
----------                                                                     
         4                                                                     
SQL> drop table t2 purge;
表已刪除。
SQL> drop table t3 purge;
表已刪除。
SQL> create table test as select * from emp;
表已建立。
SQL> select empno,ename,job from test;
     EMPNO ENAME      JOB                                                      
---------- ---------- ---------                                                
      7369 xiaonan    CLERK                                                    
      7499 ALLEN      SALESMAN                                                 
      7521 WARD       SALESMAN                                                 
      7566 JONES      MANAGER                                                  
      7654 MARTIN     SALESMAN                                                 
      7698 BLAKE      MANAGER                                                  
      7782 CLARK      MANAGER                                                  
      7788 SCOTT      ANALYST                                                  
      7839 KING       PRESIDENT                                                
      7844 TURNER     SALESMAN                                                 
      7876 ADAMS      CLERK                                                               7900 JAMES      CLERK                                                    
      7902 FORD       ANALYST                                                  
      7934 MILLER     CLERK                                                    
已選擇14行。                                                
SQL> update test set ename='yangyi' where empno=7369;

已更新 1 行。
SQL> conn system/yang as sysdba
已連線。
SQL> execute dbms_logmnr_d.build('scottemp.ora','f:\dump',dbms_logmnr_d.store_in_flat_file)
BEGIN dbms_logmnr_d.build('scottemp.ora','f:\dump',dbms_logmnr_d.store_in_flat_file); END;

*
第 1 行出現錯誤:
ORA-01336: 無法開啟指定的字典檔案
ORA-29280: 目錄路徑無效
ORA-06512: 在 "SYS.DBMS_LOGMNR_INTERNAL", line 5747
ORA-06512: 在 "SYS.DBMS_LOGMNR_INTERNAL", line 5837
ORA-06512: 在 "SYS.DBMS_LOGMNR_D", line 12
ORA-06512: 在 line 1
SQL> execute dbms_logmnr_d.build('scottemp.ora','f:\app\yang\logminer',dbms_logmnr_d.store_in_flat_file)
PL/SQL 過程已成功完成。
SQL> conn scott/yang
已連線。
SQL> update test set ename='xiaonan' where empno=7369;
已更新 1 行。
SQL> commit;
提交完成。
SQL> update test set ename='yangyi' where empno=7499;
已更新 1 行。
SQL> commit;
提交完成。
SQL> conn system/yang as sysdba
已連線。
SQL> execute dbms_logmnr.add_logfile(logfilename=>'f:\app\yang\archive1\15.log',options=>dbms_logmnr.new)
PL/SQL 過程已成功完成。
SQL> execute dbms_logmnr.add_logfile(logfilename=>'f:\app\yang\archive1\14.log',options=>dbms_logmnr.addfile)
BEGIN dbms_logmnr.add_logfile(logfilename=>'f:\app\yang\archive1\14.log',options=>dbms_logmnr.addfile); END;
*
第 1 行出現錯誤:
ORA-01287: 檔案 f:\app\yang\archive1\14.log 來自於不同的資料庫原型
ORA-06512: 在 "SYS.DBMS_LOGMNR", line 68
ORA-06512: 在 line 1
SQL> execute dbms_logmnr.add_logfile(logfilename=>'f:\app\yang\oradata\oracl\redo03.log',options=>dbms_logmnr.new)
PL/SQL 過程已成功完成。
SQL> execute dbms_logmnr.add_logfile(logfilename=>'f:\app\yang\oradata\oracl\redo02.log',options=>dbms_logmnr.new)
PL/SQL 過程已成功完成。
SQL> execute dbms_logmnr.add_logfile(logfilename=>'f:\app\yang\oradata\oracl\redo02.log',options=>dbms_logmnr.addfile)
BEGIN dbms_logmnr.add_logfile(logfilename=>'f:\app\yang\oradata\oracl\redo02.log',options=>dbms_logmnr.addfile); END;
*
第 1 行出現錯誤:
ORA-01289: 無法新增重複的日誌檔案 f:\app\yang\oradata\oracl\redo02.log
ORA-06512: 在 "SYS.DBMS_LOGMNR", line 68
ORA-06512: 在 line 1
SQL> execute dbms_logmnr.add_logfile(logfilename=>'f:\app\yang\oradata\oracl\redo01.log',options=>dbms_logmnr.addfile)
PL/SQL 過程已成功完成。
SQL> execute dbms_logmnr.start_logmnr(options=>dbms_logmnr.dict_from_online_catalog)
PL/SQL 過程已成功完成。
SQL> col username for a8
SQL> col sql_redo for a60
SQL> select username ,timestamp,sql_redo from v$logmnr_contents where seg_name='TEST';
未選定行
SQL> select group#,status from v$log;

    GROUP# STATUS                                                              
---------- ----------------                                                    
         1 INACTIVE                                                            
         2 INACTIVE                                                            
         3 CURRENT                                                                  SQL> execute dbms_logmnr.add_logfile(logfilename=>'f:\app\yang\oradata\oracl\redo03.log',options=>dbms_logmnr.new)
PL/SQL 過程已成功完成。
SQL> execute dbms_logmnr.start_logmnr(options=>dbms_logmnr.dict_from_online_catalog)
PL/SQL 過程已成功完成。
SQL> col username for a8
SQL> col sql_redo for a60
SQL> select username ,timestamp,sql_redo from v$logmnr_contents where seg_name='TEST';

USERNAME TIMESTAMP                                                             
-------- --------------                                                        
SQL_REDO                                                                       
------------------------------------------------------------                   
UNKNOWN  26-5月 -10                                                            
create table test as select * from emp;                                        
                                                                               
SQL> execute dbms_logmnr.add_logfile(logfilename=>'f:\app\yang\oradata\oracl\redo03.log',options=>dbms_logmnr.new)
PL/SQL 過程已成功完成。
SQL> execute dbms_logmnr.add_logfile(logfilename=>'f:\app\yang\oradata\oracl\redo02.log',options=>dbms_logmnr.addfile)
PL/SQL 過程已成功完成。
SQL> execute dbms_logmnr.add_logfile(logfilename=>'f:\app\yang\oradata\oracl\redo01.log',options=>dbms_logmnr.addfile)
PL/SQL 過程已成功完成。
SQL> execute dbms_logmnr.start_logmnr(options=>dbms_logmnr.dict_from_online_catalog)
PL/SQL 過程已成功完成。
SQL> col username for a8
SQL> col sql_redo for a60
SQL> select username ,timestamp,sql_redo from v$logmnr_contents where seg_name='TEST';
USERNAME TIMESTAMP                                                             
-------- --------------                                                        
SQL_REDO                                                                       
------------------------------------------------------------                   
UNKNOWN  26-5月 -10                                                            
create table test as select * from emp;      ----沒有drop 操作                                   
                                                                               
SQL> execute dbms_logmnr.end_logmnr;

PL/SQL 過程已成功完成。

SQL> spool off

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/22664653/viewspace-665075/,如需轉載,請註明出處,否則將追究法律責任。

相關文章