Recovery Based on log serial numbers based on incomplete recovery of Oracle Database RMAN

Source: Internet
Author: User

I have previously introduced:OracleDatabaseRMAN Incomplete recoveryThis document describes how to restore an Oracle database based on SCN.Log serial number recoveryTo help you.

Log serial number recovery refers to restoring the database to the status of the specified log serial number.

 
 
  1. -- View archived log information
  2. SQL> select * from t_user;
  3. TEXT
  4. --------------------
  5. Java _
  6. Spring _
  7. Spring mvc _
  8. SQL> insert into t_user select 'oracle _ 'from dual;
  9. 1 row created.
  10. SQL> commit;
  11. Commit complete.
  12. SQL> alter system switch logfile;
  13. System altered.
  14. SQL> alter system checkpoint;
  15. System altered.
  16. SQL> select sequence #, name, first_change # from v $ archived_log where status = 'A' order by sequence #;
  17. SEQUENCE # NAME FIRST_CHANGE #
  18. ---------- Certificate ---------------------------------------------------------------------------------------------------------------------------
  19. 1/oracle/10g/oracle/log/archive_log/archive_00000000760487088.arclog 1214497
  20. 1/oracle/10g/oracle/log/archive_log2/archive_1_1_760487088.arclog 1214497
  21. 1/oracle/10g/oracle/product/10.2.0/db_1/flash_recovery_area/ORALIFE/archivelog/20151108_29/o2017mf_000000007 1214498
  22. 5q9bh9d _. arc
  23. 1/oracle/10g/oracle/log/archive_log/archive_00000000760487985.arclog 1214498
  24. 1/oracle/10g/oracle/log/archive_log2/archive_00000000760487985.arclog 1214498
  25. 1/oracle/10g/oracle/product/10.2.0/db_1/flash_recovery_area/ORALIFE/archivelog/20151108_29/o2017mf_000000007 1214497
  26. 5q95ksf _. arc
  27. 6 rows selected.
  28. SQL> insert into t_user select 'oracle _ seq3 'from dual;
  29. 1 row created.
  30. SQL> commit;
  31. Commit complete.
  32. SQL> alter system switch logfile; -- generate an archive log whose log serial number is 2
  33. System altered.
  34. SQL> alter system checkpoint;
  35. System altered.
  36. SQL> select sequence #, name, first_change # from v $ archived_log where status = 'A' order by sequence #;
  37. SEQUENCE # NAME FIRST_CHANGE #
  38. ---------- Certificate ---------------------------------------------------------------------------------------------------------------------------
  39. 1/oracle/10g/oracle/log/archive_log/archive_00000000760487088.arclog 1214497
  40. 1/oracle/10g/oracle/log/archive_log2/archive_1_1_760487088.arclog 1214497
  41. 1/oracle/10g/oracle/product/10.2.0/db_1/flash_recovery_area/ORALIFE/archivelog/20151108_29/o2017mf_000000007 1214497
  42. 5q95ksf _. arc
  43. 1/oracle/10g/oracle/log/archive_log/archive_00000000760487985.arclog 1214498
  44. 1/oracle/10g/oracle/log/archive_log2/archive_00000000760487985.arclog 1214498
  45. 1/oracle/10g/oracle/product/10.2.0/db_1/flash_recovery_area/ORALIFE/archivelog/20151108_29/o2017mf_000000007 1214498
  46. 5q9bh9d _. arc
  47. 2/oracle/10g/oracle/log/archive_log/archive_1_2_760487985.arclog 1216167
  48. SEQUENCE # NAME FIRST_CHANGE #
  49. ---------- Certificate ---------------------------------------------------------------------------------------------------------------------------
  50. 2/oracle/10g/oracle/log/archive_log2/archive_1_2_760487985.arclog 1216167
  51. 2/oracle/10g/oracle/product/10.2.0/db_1/flash_recovery_area/ORALIFE/archivelog/20151108_29/o2017mf_1_2_7 1216167
  52. 5q9cvt1 _. arc
  53. 9 rows selected.
  54. SQL> insert into t_user select 'oracle _ seq3_act 'from dual;
  55. 1 row created.
  56. SQL> commit;
  57. Commit complete.
  58. SQL> alter system switch logfile; -- generate an archive log whose log serial number is 3
  59. System altered.
  60. SQL> alter system checkpoint;
  61. System altered.
  62. SQL> select sequence #, name, first_change # from v $ archived_log where status = 'A' order by sequence #;
  63. SEQUENCE # NAME FIRST_CHANGE #
  64. ---------- Certificate ---------------------------------------------------------------------------------------------------------------------------
  65. 1/oracle/10g/oracle/log/archive_log/archive_00000000760487088.arclog 1214497
  66. 1/oracle/10g/oracle/log/archive_log2/archive_1_1_760487088.arclog 1214497
  67. 1/oracle/10g/oracle/product/10.2.0/db_1/flash_recovery_area/ORALIFE/archivelog/20151108_29/o2017mf_000000007 1214497
  68. 5q95ksf _. arc
  69. 1/oracle/10g/oracle/log/archive_log/archive_00000000760487985.arclog 1214498
  70. 1/oracle/10g/oracle/log/archive_log2/archive_00000000760487985.arclog 1214498
  71. 1/oracle/10g/oracle/product/10.2.0/db_1/flash_recovery_area/ORALIFE/archivelog/20151108_29/o2017mf_000000007 1214498
  72. 5q9bh9d _. arc
  73. 2/oracle/10g/oracle/log/archive_log/archive_1_2_760487985.arclog 1216167
  74. SEQUENCE # NAME FIRST_CHANGE #
  75. ---------- Certificate ---------------------------------------------------------------------------------------------------------------------------
  76. 2/oracle/10g/oracle/log/archive_log2/archive_1_2_760487985.arclog 1216167
  77. 2/oracle/10g/oracle/product/10.2.0/db_1/flash_recovery_area/ORALIFE/archivelog/20151108_29/o2017mf_1_2_7 1216167
  78. 5q9cvt1 _. arc
  79. 3/oracle/10g/oracle/log/archive_log/archive_1_3_760487985.arclog 1216186
  80. 3/oracle/10g/oracle/log/archive_log2/archive_1_3_760487985.arclog 1216186
  81. 3/oracle/10g/oracle/product/10.2.0/db_1/flash_recovery_area/ORALIFE/archivelog/20151108_29/o2017mf_1_3_7 1216186
  82. 5q9f4d6 _. arc
  83. 12 rows selected.
  84. -- Restore to the status when the log serial number is 3
  85. [Oracle @ localhost ~] $ Rman target sys/oracle @ oralife nocatalog
  86. RMAN> run {
  87. Startup force mount;
  88. Set until sequence = 3;
  89. Restore database;
  90. Recover database;
  91. SQL 'alter database open resetlogs ';
  92. }
  93. -- View. The archived log information oracle_seq3_act with the log serial number 3 is not included. That is, the archived log with the log serial number 2 is restored.
  94. SQL> conn sys/oracle @ oralife as sysdba
  95. Connected.
  96. SQL> select * from t_user;
  97. TEXT
  98. --------------------
  99. Java _
  100. Spring _
  101. Oracle _
  102. Oracle_seq3
  103. Spring mvc _

It can be seen that the archived log information oracle_seq3_act with the log serial number 3 is not included, that is, the archived log with the log serial number 2 is restored.

After Incomplete recovery is performed, we recommend that you delete all the earlier backups and back up the database again.

Here is an introduction to Oracle Database RMAN Incomplete recovery and log serial number-based recovery. I hope this introduction will help you gain some benefits!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.