|
当进行不完全恢复后,可能没达到恢复的要求,这个时候数据库已经被resetlogs方式打开过了,如果在进行不完全恢复前没有对数据库进行全库备份,这个时候又想恢复上一个incarnation的某些数据,在这种场景下就需要进行incarnation穿越,下面来演示下这个场景! 一:准备实验基础数据 1. SQL> create table t043_incarnation(a varchar2(20)) tablespace example; 2. Table created. 3. 4. SQL> insert into t043_incarnation values ('corss successful'); 5. 1 row created. 6. 7. SQL> commit; 8. Commit complete. 9. 10. SQL> create table t043_other (a number) tablespace example; 11. Table created. 12. 13. SQL> insert into t043_other values (1); 14. 1 row created. 15. 16. SQL> insert into t043_other values (2); 17. 1 row created. 18. 19. SQL> commit; 20. Commit complete. 21. 22. SQL> alter system switch logfile; 23. System altered. 24. 25. SQL> insert into t043_other values (3); 26. 1 row created. 27. 28. SQL> alter system switch logfile; 29. System altered. 30. 31. SQL> select sysdate from dual; 32. 33. SYSDATE 34. ------------------- 35. 2011-07-17-21:22:30 36. 37. SQL> truncate table t043_incarnation; 38. Table truncated. 39. 40. SQL> archive log list; 41. Database log mode Archive Mode 42. Automatic archival Enabled 43. Archive destination USE_DB_RECOVERY_FILE_DEST 44. Oldest online log sequence 64 45. Next log sequence to archive 66 46. Current log sequence 66 47. SQL> insert into t043_other values (4); 48. 1 row created. 49. 50. SQL> commit; 51. Commit complete. 52. 53. SQL> alter system switch logfile; 54. System altered. 55. 56. SQL> insert into t043_other values (5); 57. 1 row created. 58. 59. SQL> alter system switch logfile; 60. System altered. 61. 62. SQL> commit; 63. Commit complete. 64. 65. SQL> alter system switch logfile; 66. System altered. 二:删除全部控制文件第67号归档日志文件,这样进行恢复的时候就必须进行不完全恢复 1. [oracle@rhel6 2011_07_17]$ pwd 2. /u01/app/flash_recovery_area/ORA10G/archivelog/2011_07_17 3. [oracle@rhel6 2011_07_17]$ rm -i o1_mf_1_67_725rmcx1_.arc 4. rm: remove regular file `o1_mf_1_67_725rmcx1_.arc' y 5. [oracle@rhel6 2011_07_17]$ rm -rf /u01/app/oradata/ora10g/control0* 6. 7. SQL> shutdown abort; 8. ORACLE instance shut down. 9. SQL> startup 10. ORACLE instance started. 11. 12. Total System Global Area 629145600 bytes 13. Fixed Size 2022824 bytes 14. Variable Size 205521496 bytes 15. Database Buffers 415236096 bytes 16. Redo Buffers 6365184 bytes 17. ORA-00205: error in identifying control file, check alert log for more info 三:使用控制文件二进制自动备份进行恢复,也可以使用trace脚本,由于归档日志丢失的原因,都需要进行不完全恢复 1. RMAN> restore controlfile from autobackup; 2. Starting restore at 2011-07-17-21:28:29 3. using target database control file instead of recovery catalog 4. allocated channel: ORA_DISK_1 5. channel ORA_DISK_1: sid=154 devtype=DISK 6. 7. recovery area destination: /u01/app/flash_recovery_area 8. database name (or database unique name) used for search: ORA10G 9. channel ORA_DISK_1: autobackup found in the recovery area 10. channel ORA_DISK_1: autobackup found: /u01/app/flash_recovery_area/ORA10G/autobackup/2011_07_17/o1_mf_s_756768121_725rhvkf_.bkp 11. channel ORA_DISK_1: control file restore from autobackup complete 12. output filename=/u01/app/oradata/ora10g/control01.ctl 13. output filename=/u01/app/oradata/ora10g/control02.ctl 14. out |