Bo's Oracle Station

查看: 1885|回复: 0

课程第15/16/17次(2018-03-14星期三,2018-03-18星期日上下午)

[复制链接]

1005

主题

1469

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
12012
发表于 2018-3-14 20:33:25 | 显示全部楼层 |阅读模式
  1. select  d.CHECKPOINT_CHANGE# ,d.NAME
  2.   from v_$datafile d;
  3.   
  4.   select d.RESETLOGS_CHANGE#,
  5.           d.CHECKPOINT_CHANGE#,
  6.           d.CURRENT_SCN
  7. from v_$database d;

  8. alter tablespace users offline;

  9. alter tablespace users online;

  10. alter system checkpoint;

  11. alter tablespace users read only;

  12. alter tablespace users read write;

  13. ---------------------
  14. alter tablespace users begin backup;

  15. alter tablespace users end backup;
  16. ----------
  17. alter database datafile  '+DATA/orcl/datafile/users.259.816169553' offline;

  18. alter database datafile  '+DATA/orcl/datafile/users.259.816169553' online;

  19. ---------
  20. alter database rename file '+DATA/orcl/datafile/users.259.816169553' to
  21. '+data/orcl/DATAFILE/users.dbf';

  22. alter database datafile  '+DATA/orcl/datafile/users.dbf' online;

  23. recover datafile '+DATA/orcl/datafile/users.dbf';

  24. alter database datafile  '+DATA/orcl/datafile/users.dbf' online;
复制代码
  1. alter tablespace sysaux offline;

  2. select  d.CHECKPOINT_CHANGE# ,d.NAME
  3.   from v_$datafile d;
  4.   
  5.   alter tablespace sysaux online;

  6. alter tablespace system offline;
复制代码
复杂的恢复实验的命令和过程:
  1. [oracle@station8 ~]$ rman target /

  2. Recovery Manager: Release 11.2.0.1.0 - Production on Sun Mar 18 17:46:47 2018

  3. Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

  4. connected to target database: STATION8 (DBID=1918600045, not open)

  5. RMAN> recover database;

  6. Starting recover at 18-MAR-18
  7. using target database control file instead of recovery catalog
  8. allocated channel: ORA_DISK_1
  9. channel ORA_DISK_1: SID=200 device type=DISK

  10. starting media recovery
  11. media recovery failed
  12. RMAN-00571: ===========================================================
  13. RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
  14. RMAN-00571: ===========================================================
  15. RMAN-03002: failure of recover command at 03/18/2018 17:46:53
  16. ORA-00283: recovery session canceled due to errors
  17. RMAN-11003: failure during parse/execution of SQL statement: alter database recover if needed
  18. start
  19. ORA-00283: recovery session canceled due to errors
  20. ORA-00313: open failed for members of log group 1 of thread 1
  21. ORA-00312: online log 1 thread 1: '+FRA/station8/onlinelog/group_1.257.971108007'
  22. ORA-17503: ksfdopn:2 Failed to open file +FRA/station8/onlinelog/group_1.257.971108007
  23. ORA-15012: ASM file '+FRA/station8/onlinelog/group_1.257.971108007' does not exist
  24. ORA-00312: online log 1 thread 1: '+DATA/station8/onlinelog/group_1.261.971108005'
  25. ORA-17503: ksfdopn:2 Failed to open file +DATA/station8/online

  26. RMAN> restore database ;

  27. Starting restore at 18-MAR-18
  28. using channel ORA_DISK_1

  29. channel ORA_DISK_1: starting datafile backup set restore
  30. channel ORA_DISK_1: specifying datafile(s) to restore from backup set
  31. channel ORA_DISK_1: restoring datafile 00001 to +DATA/station8/datafile/system.256.966024907
  32. channel ORA_DISK_1: restoring datafile 00002 to +DATA/station8/datafile/sysaux.257.966024907
  33. channel ORA_DISK_1: restoring datafile 00003 to +DATA/station8/datafile/undotbs1.258.966024907
  34. channel ORA_DISK_1: restoring datafile 00004 to +DATA/station8/datafile/users.259.966024907
  35. channel ORA_DISK_1: restoring datafile 00005 to +DATA/station8/datafile/example.266.966025087
  36. channel ORA_DISK_1: reading from backup piece +FRA/station8/backupset/2018_03_18/nnndf0_tag20180318t135033_0.262.971099435
  37. channel ORA_DISK_1: piece handle=+FRA/station8/backupset/2018_03_18/nnndf0_tag20180318t135033_0.262.971099435 tag=TAG20180318T135033
  38. channel ORA_DISK_1: restored backup piece 1
  39. channel ORA_DISK_1: restore complete, elapsed time: 00:01:05
  40. Finished restore at 18-MAR-18

  41. RMAN> recover database;

  42. Starting recover at 18-MAR-18
  43. using channel ORA_DISK_1

  44. starting media recovery

  45. archived log for thread 1 with sequence 13 is already on disk as file +FRA/station8/archivelog/2018_03_18/thread_1_seq_13.264.971103469
  46. archived log for thread 1 with sequence 14 is already on disk as file +FRA/station8/archivelog/2018_03_18/thread_1_seq_14.265.971106935
  47. archived log for thread 1 with sequence 15 is already on disk as file +FRA/station8/archivelog/2018_03_18/thread_1_seq_15.266.971106935
  48. archived log for thread 1 with sequence 16 is already on disk as file +FRA/station8/archivelog/2018_03_18/thread_1_seq_16.267.971106935
  49. archived log for thread 1 with sequence 17 is already on disk as file +FRA/station8/archivelog/2018_03_18/thread_1_seq_17.268.971106935
  50. archived log for thread 1 with sequence 18 is already on disk as file +FRA/station8/archivelog/2018_03_18/thread_1_seq_18.269.971106937
  51. archived log for thread 1 with sequence 19 is already on disk as file +FRA/station8/archivelog/2018_03_18/thread_1_seq_19.270.971106939
  52. archived log for thread 1 with sequence 20 is already on disk as file +FRA/station8/archivelog/2018_03_18/thread_1_seq_20.271.971108005
  53. archived log for thread 1 with sequence 1 is already on disk as file +FRA/station8/archivelog/2018_03_18/thread_1_seq_1.273.971111433
  54. archived log for thread 1 with sequence 2 is already on disk as file +FRA/station8/archivelog/2018_03_18/thread_1_seq_2.274.971111433
  55. archived log for thread 1 with sequence 3 is already on disk as file +FRA/station8/archivelog/2018_03_18/thread_1_seq_3.275.971111435
  56. archived log for thread 1 with sequence 4 is already on disk as file +FRA/station8/archivelog/2018_03_18/thread_1_seq_4.276.971111437
  57. archived log for thread 1 with sequence 5 is already on disk as file +FRA/station8/archivelog/2018_03_18/thread_1_seq_5.277.971111437
  58. archived log for thread 1 with sequence 6 is already on disk as file +FRA/station8/archivelog/2018_03_18/thread_1_seq_6.278.971111439
  59. archived log for thread 1 with sequence 7 is already on disk as file +FRA/station8/archivelog/2018_03_18/thread_1_seq_7.279.971111659
  60. archived log for thread 1 with sequence 8 is already on disk as file +FRA/station8/archivelog/2018_03_18/thread_1_seq_8.280.971111659
  61. archived log for thread 1 with sequence 9 is already on disk as file +FRA/station8/archivelog/2018_03_18/thread_1_seq_9.281.971111659
  62. archived log for thread 1 with sequence 10 is already on disk as file +FRA/station8/archivelog/2018_03_18/thread_1_seq_10.282.971111661
  63. archived log for thread 1 with sequence 11 is already on disk as file +FRA/station8/archivelog/2018_03_18/thread_1_seq_11.283.971111663
  64. archived log for thread 1 with sequence 12 is already on disk as file +FRA/station8/archivelog/2018_03_18/thread_1_seq_12.284.971111663
  65. archived log file name=+FRA/station8/archivelog/2018_03_18/thread_1_seq_13.264.971103469 thread=1 sequence=13
  66. archived log file name=+FRA/station8/archivelog/2018_03_18/thread_1_seq_14.265.971106935 thread=1 sequence=14
  67. archived log file name=+FRA/station8/archivelog/2018_03_18/thread_1_seq_15.266.971106935 thread=1 sequence=15
  68. archived log file name=+FRA/station8/archivelog/2018_03_18/thread_1_seq_16.267.971106935 thread=1 sequence=16
  69. archived log file name=+FRA/station8/archivelog/2018_03_18/thread_1_seq_17.268.971106935 thread=1 sequence=17
  70. archived log file name=+FRA/station8/archivelog/2018_03_18/thread_1_seq_18.269.971106937 thread=1 sequence=18
  71. archived log file name=+FRA/station8/archivelog/2018_03_18/thread_1_seq_19.270.971106939 thread=1 sequence=19
  72. archived log file name=+FRA/station8/archivelog/2018_03_18/thread_1_seq_20.271.971108005 thread=1 sequence=20
  73. archived log file name=+FRA/station8/archivelog/2018_03_18/thread_1_seq_1.273.971111433 thread=1 sequence=1
  74. archived log file name=+FRA/station8/archivelog/2018_03_18/thread_1_seq_2.274.971111433 thread=1 sequence=2
  75. archived log file name=+FRA/station8/archivelog/2018_03_18/thread_1_seq_3.275.971111435 thread=1 sequence=3
  76. archived log file name=+FRA/station8/archivelog/2018_03_18/thread_1_seq_4.276.971111437 thread=1 sequence=4
  77. archived log file name=+FRA/station8/archivelog/2018_03_18/thread_1_seq_5.277.971111437 thread=1 sequence=5
  78. archived log file name=+FRA/station8/archivelog/2018_03_18/thread_1_seq_6.278.971111439 thread=1 sequence=6
  79. archived log file name=+FRA/station8/archivelog/2018_03_18/thread_1_seq_7.279.971111659 thread=1 sequence=7
  80. archived log file name=+FRA/station8/archivelog/2018_03_18/thread_1_seq_8.280.971111659 thread=1 sequence=8
  81. archived log file name=+FRA/station8/archivelog/2018_03_18/thread_1_seq_9.281.971111659 thread=1 sequence=9
  82. archived log file name=+FRA/station8/archivelog/2018_03_18/thread_1_seq_10.282.971111661 thread=1 sequence=10
  83. archived log file name=+FRA/station8/archivelog/2018_03_18/thread_1_seq_11.283.971111663 thread=1 sequence=11
  84. archived log file name=+FRA/station8/archivelog/2018_03_18/thread_1_seq_12.284.971111663 thread=1 sequence=12
  85. RMAN-00571: ===========================================================
  86. RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
  87. RMAN-00571: ===========================================================
  88. RMAN-03002: failure of recover command at 03/18/2018 17:48:46
  89. ORA-00283: recovery session canceled due to errors
  90. RMAN-11003: failure during parse/execution of SQL statement: alter database recover logfile '+FRA/station8/archivelog/2018_03_18/thread_1_seq_12.284.971111663'
  91. ORA-00283: recovery session canceled due to errors
  92. ORA-00313: open failed for members of log group 1 of thread 1
  93. ORA-00312: online log 1 thread 1: '+FRA/station8/onlinelog/group_1.257.971108007'
  94. ORA-17503: ksfdopn:2 Failed to open file +FRA/station8/onlinelog/group_1.257.971108007
  95. ORA-15012: ASM file '+FRA/station8/onlinelog/group_1.257.971108007' does not exist
  96. ORA-00312: online log 1 thread 1: '+DATA/station8/onlinelog/group_1.261.971108005'
  97. ORA-17503: ksfdopn:2 Failed to open file +DATA/station8/online

  98. RMAN> run {
  99. 2> set until sequence 12 thread 1;
  100. 3> recover database;
  101. 4> }

  102. executing command: SET until clause

  103. Starting recover at 18-MAR-18
  104. using channel ORA_DISK_1
  105. RMAN-00571: ===========================================================
  106. RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
  107. RMAN-00571: ===========================================================
  108. RMAN-03002: failure of recover command at 03/18/2018 17:52:18
  109. RMAN-06556: datafile 1 must be restored from backup older than SCN 1311543

  110. RMAN> exit


  111. Recovery Manager complete.
  112. [oracle@station8 ~]$ sqlplus /nolog

  113. SQL*Plus: Release 11.2.0.1.0 Production on Sun Mar 18 17:52:43 2018

  114. Copyright (c) 1982, 2009, Oracle.  All rights reserved.

  115. SQL> conn / as sysdba
  116. Connected.
  117. SQL> recover database;
  118. ORA-00283: recovery session canceled due to errors
  119. ORA-00313: open failed for members of log group 1 of thread 1
  120. ORA-00312: online log 1 thread 1:
  121. '+FRA/station8/onlinelog/group_1.257.971108007'
  122. ORA-17503: ksfdopn:2 Failed to open file
  123. +FRA/station8/onlinelog/group_1.257.971108007
  124. ORA-15012: ASM file '+FRA/station8/onlinelog/group_1.257.971108007' does not
  125. exist
  126. ORA-00312: online log 1 thread 1:
  127. '+DATA/station8/onlinelog/group_1.261.971108005'
  128. ORA-17503: ksfdopn:2 Failed to open file +DATA/station8/online


  129. SQL> recover database until cancel ;
  130. ORA-00279: change 1311548 generated at 03/18/2018 17:14:23 needed for thread 1
  131. ORA-00289: suggestion : +FRA
  132. ORA-00280: change 1311548 for thread 1 is in sequence #13


  133. Specify log: {<RET>=suggested | filename | AUTO | CANCEL}

  134. ORA-00308: cannot open archived log '+FRA'
  135. ORA-17503: ksfdopn:2 Failed to open file +FRA
  136. ORA-15045: ASM file name '+FRA' is not in reference form


  137. SQL> recover database until cancel ;
  138. ORA-00279: change 1311548 generated at 03/18/2018 17:14:23 needed for thread 1
  139. ORA-00289: suggestion : +FRA
  140. ORA-00280: change 1311548 for thread 1 is in sequence #13


  141. Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
  142. cancel
  143. Media recovery cancelled.
  144. SQL> alter database open resetlogs;

  145. Database altered.

  146. SQL> exit
  147. Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
  148. With the Partitioning, Automatic Storage Management, OLAP, Data Mining
  149. and Real Application Testing options
  150. [oracle@station8 ~]$ rman target /

  151. Recovery Manager: Release 11.2.0.1.0 - Production on Sun Mar 18 17:55:35 2018

  152. Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

  153. connected to target database: STATION8 (DBID=1918600045)

  154. RMAN> list incarnation of database ;

  155. using target database control file instead of recovery catalog

  156. List of Database Incarnations
  157. DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
  158. ------- ------- -------- ---------------- --- ---------- ----------
  159. 1       1       STATION8 1918600045       PARENT  1          15-AUG-09
  160. 2       2       STATION8 1918600045       PARENT  945184     21-JAN-18
  161. 3       3       STATION8 1918600045       PARENT  1308049    18-MAR-18
  162. 4       4       STATION8 1918600045       CURRENT 1311549    18-MAR-18

  163. RMAN>
复制代码



回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-3-28 19:51 , Processed in 0.132637 second(s), 24 queries .

快速回复 返回顶部 返回列表