熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Oracle >> 正文

熱備異常關閉的恢復

2022-06-13   來源: Oracle 

  實驗一熱備異常結束的恢復

  SQL> select substr(name) dname recover fuzzy checkpoint_change#CHECKPOINT_COUNT from v$datafile_header;

  DNAME                                              REC FUZ CHECKPOINT_CHANGE# CHECKPOINT_COUNT

  

  D:\ORACLE\ORADATA\FOX\SYSTEMDBF                 NO  YES                         

  D:\ORACLE\ORADATA\FOX\UNDOTBSDBF                NO  YES                         

  D:\ORACLE\ORADATA\FOX\SYSAUXDBF                 NO  YES                         

  D:\ORACLE\ORADATA\FOX\USERSDBF                  NO  YES                         

  D:\ORACLE\ORADATA\FOX\EXAMPLEDBF                NO  YES                         

  D:\ORACLE\ORADATA\FOX\USERSDBF                  NO  YES                          

  D:\ORACLE\ORADATA\FOX\TESTDBF                   NO  YES                          

  D:\TBS_DBF                                     NO  YES                          

  D:\TBS_DBF                                     NO  YES                          

  D:\ORACLE\ORADATA\FOX\TEST_PERFSTATDBF            NO  YES                         

  已選擇

  SQL> select * from t;

  SCN

  

  

  SQL> insert into t values (dbms_flashbackget_system_change_number);

  已創建

  SQL> select * from t;

  SCN

  

  

  

  SQL> commit;

  提交完成

  SQL> select substr(name) dname recover fuzzy checkpoint_change#CHECKPOINT_COUNT from v$datafile_header;

  DNAME                                              REC FUZ CHECKPOINT_CHANGE# CHECKPOINT_COUNT

  

  D:\ORACLE\ORADATA\FOX\SYSTEMDBF                 NO  YES                         

  D:\ORACLE\ORADATA\FOX\UNDOTBSDBF                NO  YES                         

  D:\ORACLE\ORADATA\FOX\SYSAUXDBF                 NO  YES                         

  D:\ORACLE\ORADATA\FOX\USERSDBF                  NO  YES                         

  D:\ORACLE\ORADATA\FOX\EXAMPLEDBF                NO  YES                         

  D:\ORACLE\ORADATA\FOX\USERSDBF                  NO  YES                          

  D:\ORACLE\ORADATA\FOX\TESTDBF                   NO  YES                          

  D:\TBS_DBF                                     NO  YES                          

  D:\TBS_DBF                                     NO  YES                          

  D:\ORACLE\ORADATA\FOX\TEST_PERFSTATDBF            NO  YES                         

  已選擇

  SQL> select substr(name ) dname CHECKPOINT_CHANGE#LAST_CHANGE# OFFLINE_CHANGE#status from v$datafile;

  DNAME                                              CHECKPOINT_CHANGE# LAST_CHANGE# OFFLINE_CHANGE# STATUS

  

  D:\ORACLE\ORADATA\FOX\SYSTEMDBF                                                  SYSTEM

  D:\ORACLE\ORADATA\FOX\UNDOTBSDBF                                                 ONLINE

  D:\ORACLE\ORADATA\FOX\SYSAUXDBF                                                  ONLINE

  D:\ORACLE\ORADATA\FOX\USERSDBF                                                   ONLINE

  D:\ORACLE\ORADATA\FOX\EXAMPLEDBF                                                 ONLINE

  D:\ORACLE\ORADATA\FOX\USERSDBF                                                         ONLINE

  D:\ORACLE\ORADATA\FOX\TESTDBF                                                    ONLINE

  D:\TBS_DBF                                                                            ONLINE

  D:\TBS_DBF                                                                            ONLINE

  D:\ORACLE\ORADATA\FOX\TEST_PERFSTATDBF                                             ONLINE

  已選擇

  SQL> select checkpoint_change# from v$database;

  CHECKPOINT_CHANGE#

  

  

  熱備前幾個檢查點信息是一致的

  SQL> alter tablespace tbs_test begin backup;

  表空間已更改

  SQL> select checkpoint_change# from v$database;

  CHECKPOINT_CHANGE#

  

  

  熱備啟動後可以看到tbs_test空間的兩個數據文件檢查點比其他文件大因為在熱備啟動的時候對這兩個文件做了檢查點

  SQL> select substr(name ) dname CHECKPOINT_CHANGE#LAST_CHANGE# OFFLINE_CHANGE#status from v$datafile;

  DNAME                                              CHECKPOINT_CHANGE# LAST_CHANGE# OFFLINE_CHANGE# STATUS

  

  D:\ORACLE\ORADATA\FOX\SYSTEMDBF                                                  SYSTEM

  D:\ORACLE\ORADATA\FOX\UNDOTBSDBF                                                 ONLINE

  D:\ORACLE\ORADATA\FOX\SYSAUXDBF                                                  ONLINE

  D:\ORACLE\ORADATA\FOX\USERSDBF                                                   ONLINE

  D:\ORACLE\ORADATA\FOX\EXAMPLEDBF                                                 ONLINE

  D:\ORACLE\ORADATA\FOX\USERSDBF                                                         ONLINE

  D:\ORACLE\ORADATA\FOX\TESTDBF                                                    ONLINE

  D:\TBS_DBF                                                                            ONLINE

  D:\TBS_DBF                                                                            ONLINE

  D:\ORACLE\ORADATA\FOX\TEST_PERFSTATDBF                                             ONLINE

  已選擇

  SQL> select substr(name) dname recover fuzzy checkpoint_change#CHECKPOINT_COUNT from v$datafile_header;

  DNAME                                              REC FUZ CHECKPOINT_CHANGE# CHECKPOINT_COUNT

  

  D:\ORACLE\ORADATA\FOX\SYSTEMDBF                 NO  YES                         

  D:\ORACLE\ORADATA\FOX\UNDOTBSDBF                NO  YES                         

  D:\ORACLE\ORADATA\FOX\SYSAUXDBF                 NO  YES                         

  D:\ORACLE\ORADATA\FOX\USERSDBF                  NO  YES                         

  D:\ORACLE\ORADATA\FOX\EXAMPLEDBF                NO  YES                         

  D:\ORACLE\ORADATA\FOX\USERSDBF                  NO  YES                          

  D:\ORACLE\ORADATA\FOX\TESTDBF                   NO  YES                          

  D:\TBS_DBF                                     NO  YES                          

  D:\TBS_DBF                                     NO  YES                          

  D:\ORACLE\ORADATA\FOX\TEST_PERFSTATDBF            NO  YES                         

  已選擇

  SQL> host copy D:\TBS_DBF to D:\TBS_DBFbak

  SQL> host copy D:\TBS_DBF to D:\TBS_DBFbak;

  SQL> host copy D:\TBS_DBF  D:\TBS_DBFbak;

  SQL> host copy D:\TBS_DBF  D:\TBS_DBFbak

  SQL> host copy D:\TBS_DBF  D:\TBS_DBFbak

  SQL> shutdown abort

  ORACLE 例程已經關閉

  SQL> startup mount

  ORA: obsolete and/or deprecated parameter(s) specified

  ORACLE 例程已經啟動

  Total System Global Area  bytes

  Fixed Size                  bytes

  Variable Size             bytes

  Database Buffers          bytes

  Redo Buffers                bytes

  數據庫裝載完畢

  shutdown abort沒有做檢查點所有可以看到再次mount後檢查點還是和關閉前保持一致

  CHECKPOINT_CHANGE#不一致這個是需要恢復的

  V$RECOVER_FILE裡有但V$DATAFILE_HEADER裡沒有提示rec=yes

  這是因為兩個的信息來自不同的地方

  需要恢復這個信息V$RECOVER_FILE來自控制文件的知道了但V$DATAFILE_HEADER來自數據文件頭的還不知道

  SQL> select substr(name) dname recover fuzzy checkpoint_change#CHECKPOINT_COUNT from v$datafile_header;

  DNAME                                              REC FUZ CHECKPOINT_CHANGE# CHECKPOINT_COUNT

  

  D:\ORACLE\ORADATA\FOX\SYSTEMDBF                 NO  YES                         

  D:\ORACLE\ORADATA\FOX\UNDOTBSDBF                NO  YES                         

  D:\ORACLE\ORADATA\FOX\SYSAUXDBF                 NO  YES                         

  D:\ORACLE\ORADATA\FOX\USERSDBF                  NO  YES                         

  D:\ORACLE\ORADATA\FOX\EXAMPLEDBF                NO  YES                         

  D:\ORACLE\ORADATA\FOX\USERSDBF                  NO  YES                          

  D:\ORACLE\ORADATA\FOX\TESTDBF                   NO  YES                          

  D:\TBS_DBF                                     NO  YES                          

  D:\TBS_DBF                                     NO  YES                          

  D:\ORACLE\ORADATA\FOX\TEST_PERFSTATDBF            NO  YES                         

  已選擇

  SQL> select substr(name ) dname CHECKPOINT_CHANGE#LAST_CHANGE# OFFLINE_CHANGE#status from v$datafile;

  DNAME                                              CHECKPOINT_CHANGE# LAST_CHANGE# OFFLINE_CHANGE# STATUS

  

  D:\ORACLE\ORADATA\FOX\SYSTEMDBF                                                  SYSTEM

  D:\ORACLE\ORADATA\FOX\UNDOTBSDBF                                                 ONLINE

  D:\ORACLE\ORADATA\FOX\SYSAUXDBF                                                  ONLINE

  D:\ORACLE\ORADATA\FOX\USERSDBF                                                   ONLINE

  D:\ORACLE\ORADATA\FOX\EXAMPLEDBF                                                 ONLINE

  D:\ORACLE\ORADATA\FOX\USERSDBF                                                         ONLINE

  D:\ORACLE\ORADATA\FOX\TESTDBF                                                    ONLINE

  D:\TBS_DBF                                                                            ONLINE

  D:\TBS_DBF                                                                            ONLINE

  D:\ORACLE\ORADATA\FOX\TEST_PERFSTATDBF                                             ONLINE

  已選擇

  SQL> select * from v$recover_file;

  FILE# ONLINE  ONLINE_ ERROR           CHANGE# TIME

  

   ONLINE  ONLINE                 

   ONLINE  ONLINE                 

  SQL> select * from v$backup;

  FILE# STATUS                CHANGE# TIME

  

   NOT ACTIVE           

   NOT ACTIVE           

   NOT ACTIVE           

   NOT ACTIVE           

   NOT ACTIVE           

   NOT ACTIVE           

   NOT ACTIVE           

   ACTIVE               

   ACTIVE               

   NOT ACTIVE           

  已選擇

  SQL> alter database end backup;

  數據庫已更改

  結束熱備後系統自動恢復了

  SQL> select * from v$recover_file;

  未選定行

  SQL> select substr(name ) dname CHECKPOINT_CHANGE#LAST_CHANGE# OFFLINE_CHANGE#status from v$datafile;

  DNAME                                              CHECKPOINT_CHANGE# LAST_CHANGE# OFFLINE_CHANGE# STATUS

  

  D:\ORACLE\ORADATA\FOX\SYSTEMDBF                                                  SYSTEM

  D:\ORACLE\ORADATA\FOX\UNDOTBSDBF                                                 ONLINE

  D:\ORACLE\ORADATA\FOX\SYSAUXDBF                                                  ONLINE

  D:\ORACLE\ORADATA\FOX\USERSDBF                                                   ONLINE

  D:\ORACLE\ORADATA\FOX\EXAMPLEDBF                                                 ONLINE

  D:\ORACLE\ORADATA\FOX\USERSDBF                                                         ONLINE

  D:\ORACLE\ORADATA\FOX\TESTDBF                                                    ONLINE

  D:\TBS_DBF                                                                            ONLINE

  D:\TBS_DBF                                                                            ONLINE

  D:\ORACLE\ORADATA\FOX\TEST_PERFSTATDBF                                             ONLINE

  已選擇

  SQL> select substr(name) dname recover fuzzy checkpoint_change#CHECKPOINT_COUNT from v$datafile_header;

  DNAME                                              REC FUZ CHECKPOINT_CHANGE# CHECKPOINT_COUNT

  

  D:\ORACLE\ORADATA\FOX\SYSTEMDBF                 NO  YES                         

  D:\ORACLE\ORADATA\FOX\UNDOTBSDBF                NO  YES                         

  D:\ORACLE\ORADATA\FOX\SYSAUXDBF                 NO  YES                         

  D:\ORACLE\ORADATA\FOX\USERSDBF                  NO  YES                         

  D:\ORACLE\ORADATA\FOX\EXAMPLEDBF                NO  YES                         

  D:\ORACLE\ORADATA\FOX\USERSDBF                  NO  YES                          

  D:\ORACLE\ORADATA\FOX\TESTDBF                   NO  YES                          

  D:\TBS_DBF                                     NO  YES                          

  D:\TBS_DBF                                     NO  YES                          

  D:\ORACLE\ORADATA\FOX\TEST_PERFSTATDBF            NO  YES                         

  已選擇

  SQL> alter database open;

  數據庫已更改

  打開數據庫所有檢查點一致cnt加了(open加切歸檔+

  SQL> select substr(name ) dname CHECKPOINT_CHANGE#LAST_CHANGE# OFFLINE_CHANGE#status from v$datafile;

  DNAME                                              CHECKPOINT_CHANGE# LAST_CHANGE# OFFLINE_CHANGE# STATUS

  

  D:\ORACLE\ORADATA\FOX\SYSTEMDBF                                                  SYSTEM

  D:\ORACLE\ORADATA\FOX\UNDOTBSDBF                                                 ONLINE

  D:\ORACLE\ORADATA\FOX\SYSAUXDBF                                                  ONLINE

  D:\ORACLE\ORADATA\FOX\USERSDBF                                                   ONLINE

  D:\ORACLE\ORADATA\FOX\EXAMPLEDBF                                                 ONLINE

  D:\ORACLE\ORADATA\FOX\USERSDBF                                                         ONLINE

  D:\ORACLE\ORADATA\FOX\TESTDBF                                                    ONLINE

  D:\TBS_DBF                                                                            ONLINE

  D:\TBS_DBF                                                                            ONLINE

  D:\ORACLE\ORADATA\FOX\TEST_PERFSTATDBF                                             ONLINE

  已選擇

  SQL> select substr(name) dname recover fuzzy checkpoint_change#CHECKPOINT_COUNT from v$datafile_header;

  DNAME                                              REC FUZ CHECKPOINT_CHANGE# CHECKPOINT_COUNT

  

  D:\ORACLE\ORADATA\FOX\SYSTEMDBF                 NO  YES                         

  D:\ORACLE\ORADATA\FOX\UNDOTBSDBF                NO  YES                         

  D:\ORACLE\ORADATA\FOX\SYSAUXDBF                 NO  YES                         

  D:\ORACLE\ORADATA\FOX\USERSDBF                  NO  YES                         

  D:\ORACLE\ORADATA\FOX\EXAMPLEDBF                NO  YES                         

  D:\ORACLE\ORADATA\FOX\USERSDBF                  NO  YES                          

  D:\ORACLE\ORADATA\FOX\TESTDBF                   NO  YES                          

  D:\TBS_DBF                                     NO  YES                          

  D:\TBS_DBF                                     NO  YES                          

  D:\ORACLE\ORADATA\FOX\TEST_PERFSTATDBF            NO  YES                         

  已選擇

  SQL> spool off

  實驗二熱備後異常關閉用舊備份還原

  SQL>  select * from v$log;

  GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS           FIRST_CHANGE# FIRST_TIME

  

                                  YES INACTIVE              

                                  NO  CURRENT               

                                  YES INACTIVE              

  SQL> select * from t;

  SCN

  

  

  

  SQL> select substr(name) dname recover fuzzy checkpoint_change#CHECKPOINT_COUNT from v$datafile_header;

  DNAME   REC FUZ CHECKPOINT_CHANGE# CHECKPOINT_COUNT

  

  D:\ORACLE\ORADATA\FOX\SYSTEMDBF                 NO  YES                         

  D:\ORACLE\ORADATA\FOX\UNDOTBSDBF                NO  YES                         

  D:\ORACLE\ORADATA\FOX\SYSAUXDBF                 NO  YES                         

  D:\ORACLE\ORADATA\FOX\USERSDBF                  NO  YES                         

  D:\ORACLE\ORADATA\FOX\EXAMPLEDBF                NO  YES                         

  D:\ORACLE\ORADATA\FOX\USERSDBF                  NO  YES                          

  D:\ORACLE\ORADATA\FOX\TESTDBF                   NO  YES                          

  D:\TBS_DBF   NO  YES                          

  D:\TBS_DBF   NO  YES                          

  D:\ORACLE\ORADATA\FOX\TEST_PERFSTATDBF            NO  YES                         

  已選擇

  SQL> select substr(name ) dname CHECKPOINT_CHANGE#LAST_CHANGE# OFFLINE_CHANGE#status from v$datafile;

  DNAME   CHECKPOINT_CHANGE# LAST_CHANGE# OFFLINE_CHANGE# STATUS

  

  D:\ORACLE\ORADATA\FOX\SYSTEMDBF                                                  SYSTEM

  D:\ORACLE\ORADATA\FOX\UNDOTBSDBF                                                 ONLINE

  D:\ORACLE\ORADATA\FOX\SYSAUXDBF                                                  ONLINE

  D:\ORACLE\ORADATA\FOX\USERSDBF                                                   ONLINE

  D:\ORACLE\ORADATA\FOX\EXAMPLEDBF                                                 ONLINE

  D:\ORACLE\ORADATA\FOX\USERSDBF                                                         ONLINE

  D:\ORACLE\ORADATA\FOX\TESTDBF                                                    ONLINE

  D:\TBS_DBF                            ONLINE

  D:\TBS_DBF                            ONLINE

  D:\ORACLE\ORADATA\FOX\TEST_PERFSTATDBF                                             ONLINE

  已選擇

  SQL> alter tablespace tbs_test begin backup;

  表空間已更改

  SQL> select substr(name ) dname CHECKPOINT_CHANGE#LAST_CHANGE# OFFLINE_CHANGE#status from v$datafile;

  DNAME   CHECKPOINT_CHANGE# LAST_CHANGE# OFFLINE_CHANGE# STATUS

  

  D:\ORACLE\ORADATA\FOX\SYSTEMDBF                                                  SYSTEM

  D:\ORACLE\ORADATA\FOX\UNDOTBSDBF                                                 ONLINE

  D:\ORACLE\ORADATA\FOX\SYSAUXDBF                                                  ONLINE

  D:\ORACLE\ORADATA\FOX\USERSDBF                                                   ONLINE

  D:\ORACLE\ORADATA\FOX\EXAMPLEDBF                                                 ONLINE

  D:\ORACLE\ORADATA\FOX\USERSDBF                                                         ONLINE

  D:\ORACLE\ORADATA\FOX\TESTDBF                                                    ONLINE

  D:\TBS_DBF                            ONLINE

  D:\TBS_DBF                            ONLINE

  D:\ORACLE\ORADATA\FOX\TEST_PERFSTATDBF                                             ONLINE

  已選擇

  SQL> select substr(name) dname recover fuzzy checkpoint_change#CHECKPOINT_COUNT from v$datafile_header;

  DNAME   REC FUZ CHECKPOINT_CHANGE# CHECKPOINT_COUNT

  

  D:\ORACLE\ORADATA\FOX\SYSTEMDBF                 NO  YES                         

  D:\ORACLE\ORADATA\FOX\UNDOTBSDBF                NO  YES                         

  D:\ORACLE\ORADATA\FOX\SYSAUXDBF                 NO  YES                         

  D:\ORACLE\ORADATA\FOX\USERSDBF                  NO  YES                         

  D:\ORACLE\ORADATA\FOX\EXAMPLEDBF                NO  YES                         

  D:\ORACLE\ORADATA\FOX\USERSDBF                  NO  YES                          

  D:\ORACLE\ORADATA\FOX\TESTDBF                   NO  YES                          

  D:\TBS_DBF   NO  YES                          

  D:\TBS_DBF   NO  YES                          

  D:\ORACLE\ORADATA\FOX\TEST_PERFSTATDBF            NO  YES                         

  已選擇

  SQL>  select * from v$log;

  GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS           FIRST_CHANGE# FIRST_TIME

  

                                  YES INACTIVE              

                                  NO  CURRENT               

                                  YES INACTIVE              

  SQL> shutdown abort

  ORACLE 例程已經關閉

  SQL> startup mount;

  ORA: obsolete and/or deprecated parameter(s) specified

  ORACLE 例程已經啟動

  Total System Global Area  bytes

  Fixed Size                  bytes

  Variable Size             bytes

  Database Buffers          bytes

  Redo Buffers                bytes

  數據庫裝載完畢

  SQL>  select * from v$log;

  GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS           FIRST_CHANGE# FIRST_TIME

  

                                  YES INACTIVE              

                                  YES INACTIVE              

                                  NO  CURRENT               

  SQL> select substr(name) dname recover fuzzy checkpoint_change#CHECKPOINT_COUNT from v$datafile_header;

  DNAME   REC FUZ CHECKPOINT_CHANGE# CHECKPOINT_COUNT

  

  D:\ORACLE\ORADATA\FOX\SYSTEMDBF                 NO  YES                         

  D:\ORACLE\ORADATA\FOX\UNDOTBSDBF                NO  YES                         

  D:\ORACLE\ORADATA\FOX\SYSAUXDBF                 NO  YES                         

  D:\ORACLE\ORADATA\FOX\USERSDBF                  NO  YES                         

  D:\ORACLE\ORADATA\FOX\EXAMPLEDBF                NO  YES                         

  D:\ORACLE\ORADATA\FOX\USERSDBF                  NO  YES                          

  D:\ORACLE\ORADATA\FOX\TESTDBF                   NO  YES                          

  D:\TBS_DBF   NO  YES                          

  D:\TBS_DBF   NO  YES                          

  D:\ORACLE\ORADATA\FOX\TEST_PERFSTATDBF            NO  YES                         

  已選擇

  SQL> select substr(name ) dname CHECKPOINT_CHANGE#LAST_CHANGE# OFFLINE_CHANGE#status from v$datafile;

  DNAME   CHECKPOINT_CHANGE# LAST_CHANGE# OFFLINE_CHANGE# STATUS

  

  D:\ORACLE\ORADATA\FOX\SYSTEMDBF                                                  SYSTEM

  D:\ORACLE\ORADATA\FOX\UNDOTBSDBF                                                 ONLINE

  D:\ORACLE\ORADATA\FOX\SYSAUXDBF                                                  ONLINE

  D:\ORACLE\ORADATA\FOX\USERSDBF                                                   ONLINE

  D:\ORACLE\ORADATA\FOX\EXAMPLEDBF                                                 ONLINE

  D:\ORACLE\ORADATA\FOX\USERSDBF                                                         ONLINE

  D:\ORACLE\ORADATA\FOX\TESTDBF                                                    ONLINE

  D:\TBS_DBF                            ONLINE

  D:\TBS_DBF                            ONLINE

  D:\ORACLE\ORADATA\FOX\TEST_PERFSTATDBF                                             ONLINE

  已選擇

  SQL> select * from v$recover_file;

  FILE# ONLINE  ONLINE_ ERROR                CHANGE# TIME

  

   ONLINE  ONLINE                      

   ONLINE  ONLINE                      

  SQL> select * from v$backup;

  FILE# STATUS                CHANGE# TIME

  

   NOT ACTIVE           

   NOT ACTIVE           

   NOT ACTIVE           

   NOT ACTIVE           

   NOT ACTIVE           

   NOT ACTIVE           

   NOT ACTIVE           

   ACTIVE               

   ACTIVE               

   NOT ACTIVE           

  已選擇

  SQL> host cp D:\TBS_DBFbak D:\TBS_DBF;

  SQL> host copy D:\TBS_DBFbak D:\TBS_DBF;

  SQL> host copy D:\TBS_DBFbak D:\TBS_DBF;

  SQL> alter database open;

  alter database open

  *

  第 行出現錯誤:

  ORA: 文件 需要介質恢復

  ORA: 數據文件 : D:\TBS_DBF

  SQL> select * from v$backup;

  FILE# STATUS                CHANGE# TIME

  

   NOT ACTIVE           

   NOT ACTIVE           

   NOT ACTIVE           

   NOT ACTIVE           

   NOT ACTIVE           

   NOT ACTIVE           

   NOT ACTIVE           

   ACTIVE               

   ACTIVE               

   NOT ACTIVE           

  已選擇

  SQL> select substr(name ) dname CHECKPOINT_CHANGE#LAST_CHANGE# OFFLINE_CHANGE#status from v$datafile;

  DNAME   CHECKPOINT_CHANGE# LAST_CHANGE# OFFLINE_CHANGE# STATUS

  

  D:\ORACLE\ORADATA\FOX\SYSTEMDBF                                                  SYSTEM

  D:\ORACLE\ORADATA\FOX\UNDOTBSDBF                                                 ONLINE

  D:\ORACLE\ORADATA\FOX\SYSAUXDBF                                                  ONLINE

  D:\ORACLE\ORADATA\FOX\USERSDBF                                                   ONLINE

  D:\ORACLE\ORADATA\FOX\EXAMPLEDBF                                                 ONLINE

  D:\ORACLE\ORADATA\FOX\USERSDBF                                                         ONLINE

  D:\ORACLE\ORADATA\FOX\TESTDBF                                                    ONLINE

  D:\TBS_DBF                            ONLINE

  D:\TBS_DBF                            ONLINE

  D:\ORACLE\ORADATA\FOX\TEST_PERFSTATDBF                                             ONLINE

  已選擇

  SQL> select substr(name) dname recover fuzzy checkpoint_change#CHECKPOINT_COUNT from v$datafile_header;

  DNAME   REC FUZ CHECKPOINT_CHANGE# CHECKPOINT_COUNT

  

  D:\ORACLE\ORADATA\FOX\SYSTEMDBF                 NO  YES                         

  D:\ORACLE\ORADATA\FOX\UNDOTBSDBF                NO  YES                         

  D:\ORACLE\ORADATA\FOX\SYSAUXDBF                 NO  YES                         

  D:\ORACLE\ORADATA\FOX\USERSDBF                  NO  YES                         

  D:\ORACLE\ORADATA\FOX\EXAMPLEDBF                NO  YES                         

  D:\ORACLE\ORADATA\FOX\USERSDBF                  NO  YES                          

  D:\ORACLE\ORADATA\FOX\TESTDBF                   NO  YES                          

  D:\TBS_DBF   YES YES                          

  D:\TBS_DBF   YES YES                          

  D:\ORACLE\ORADATA\FOX\TEST_PERFSTATDBF            NO  YES                         

  已選擇

  通過比對檢查點計數發現是舊的文件不允許通過結束熱備來恢復

  通過比對數據文件和數據文件頭的檢查點也能發現文件是舊的備份

  SQL> alter database end backup;

  alter database end backup

  *

  第 行出現錯誤:

  ORA: END BACKUP 對 文件失敗而對 成功

  ORA: 數據庫文件 驗證失敗

  ORA: 數據文件 : D:\TBS_DBF

  ORA: 數據文件是舊的版本 不能訪問當前版本

  ORA: 數據庫文件 驗證失敗

  ORA: 數據文件 : D:\TBS_DBF

  ORA: 數據文件是舊的版本 不能訪問當前版本

  SQL> recover database;

  完成介質恢復

  SQL> select substr(name) dname recover fuzzy checkpoint_change#CHECKPOINT_COUNT from v$datafile_header;

  DNAME   REC FUZ CHECKPOINT_CHANGE# CHECKPOINT_COUNT

  

  D:\ORACLE\ORADATA\FOX\SYSTEMDBF                 NO  NO                          

  D:\ORACLE\ORADATA\FOX\UNDOTBSDBF                NO  NO                          

  D:\ORACLE\ORADATA\FOX\SYSAUXDBF                 NO  NO                          

  D:\ORACLE\ORADATA\FOX\USERSDBF                  NO  NO                          

  D:\ORACLE\ORADATA\FOX\EXAMPLEDBF                NO  NO                          

  D:\ORACLE\ORADATA\FOX\USERSDBF                  NO  NO                           

  D:\ORACLE\ORADATA\FOX\TESTDBF                   NO  NO                           

  D:\TBS_DBF   NO  NO                           

  D:\TBS_DBF   NO  NO                           

  D:\ORACLE\ORADATA\FOX\TEST_PERFSTATDBF            NO  NO                          

  已選擇

  SQL> select substr(name ) dname CHECKPOINT_CHANGE#LAST_CHANGE# OFFLINE_CHANGE#status from v$datafile;

  DNAME   CHECKPOINT_CHANGE# LAST_CHANGE# OFFLINE_CHANGE# STATUS

  

  D:\ORACLE\ORADATA\FOX\SYSTEMDBF                                           SYSTEM

  D:\ORACLE\ORADATA\FOX\UNDOTBSDBF                                          ONLINE

  D:\ORACLE\ORADATA\FOX\SYSAUXDBF                                           ONLINE

  D:\ORACLE\ORADATA\FOX\USERSDBF                                            ONLINE

  D:\ORACLE\ORADATA\FOX\EXAMPLEDBF                                          ONLINE

  D:\ORACLE\ORADATA\FOX\USERSDBF                                                  ONLINE

  D:\ORACLE\ORADATA\FOX\TESTDBF                                             ONLINE

  D:\TBS_DBF                     ONLINE

  D:\TBS_DBF                     ONLINE

  D:\ORACLE\ORADATA\FOX\TEST_PERFSTATDBF                                      ONLINE

  已選擇

  SQL> select * from v$backup;

  FILE# STATUS                CHANGE# TIME

  

   NOT ACTIVE           

   NOT ACTIVE           

   NOT ACTIVE           

   NOT ACTIVE           

   NOT ACTIVE           

   NOT ACTIVE           

   NOT ACTIVE           

   NOT ACTIVE           

   NOT ACTIVE           

   NOT ACTIVE           

  已選擇

  SQL> select * from v$recover_file;

  未選定行

  SQL> select * from v$log;

  GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS           FIRST_CHANGE# FIRST_TIME

  

                                  YES INACTIVE              

                                  YES INACTIVE              

                                  NO  CURRENT               

  數據庫打開檢查點計數+log發生了切換

  SQL> alter database open;

  數據庫已更改

  SQL> select * from v$log;

  GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS           FIRST_CHANGE# FIRST_TIME

  

                                  YES INACTIVE              

                                  YES INACTIVE              

                                  NO  CURRENT               

  SQL> select substr(name ) dname CHECKPOINT_CHANGE#LAST_CHANGE# OFFLINE_CHANGE#status from v$datafile;

  DNAME   CHECKPOINT_CHANGE# LAST_CHANGE# OFFLINE_CHANGE# STATUS

  

  D:\ORACLE\ORADATA\FOX\SYSTEMDBF                                                  SYSTEM

  D:\ORACLE\ORADATA\FOX\UNDOTBSDBF                                                 ONLINE

  D:\ORACLE\ORADATA\FOX\SYSAUXDBF                                                  ONLINE

  D:\ORACLE\ORADATA\FOX\USERSDBF                                                   ONLINE

  D:\ORACLE\ORADATA\FOX\EXAMPLEDBF                                                 ONLINE

  D:\ORACLE\ORADATA\FOX\USERSDBF                                                         ONLINE

  D:\ORACLE\ORADATA\FOX\TESTDBF                                                    ONLINE

  D:\TBS_DBF                            ONLINE

  D:\TBS_DBF                            ONLINE

  D:\ORACLE\ORADATA\FOX\TEST_PERFSTATDBF                                             ONLINE

  已選擇

  SQL> select substr(name) dname recover fuzzy checkpoint_change#CHECKPOINT_COUNT from v$datafile_header;

  DNAME   REC FUZ CHECKPOINT_CHANGE# CHECKPOINT_COUNT

  

  D:\ORACLE\ORADATA\FOX\SYSTEMDBF                 NO  YES                         

  D:\ORACLE\ORADATA\FOX\UNDOTBSDBF                NO  YES                         

  D:\ORACLE\ORADATA\FOX\SYSAUXDBF                 NO  YES                         

  D:\ORACLE\ORADATA\FOX\USERSDBF                  NO  YES                         

  D:\ORACLE\ORADATA\FOX\EXAMPLEDBF                NO  YES                         

  D:\ORACLE\ORADATA\FOX\USERSDBF                  NO  YES                          

  D:\ORACLE\ORADATA\FOX\TESTDBF                   NO  YES                          

  D:\TBS_DBF   NO  YES                          

  D:\TBS_DBF   NO  YES                          

  D:\ORACLE\ORADATA\FOX\TEST_PERFSTATDBF            NO  YES                         

  已選擇

  SQL>  select * from v$log;

  GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS           FIRST_CHANGE# FIRST_TIME

  

                                  YES INACTIVE              

                                  YES INACTIVE              

                                  NO  CURRENT                SQL> select * from t;

  SCN

  

  

  

  SQL> spool off


From:http://tw.wingwit.com/Article/program/Oracle/201311/17529.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.