Bo's Oracle Station

查看: 2380|回复: 0

活动第19/20次(2018-05-19星期六上下午)

[复制链接]

1005

主题

1469

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
12012
发表于 2018-5-19 09:15:59 | 显示全部楼层 |阅读模式
做实验时,在bcpserver虚拟机的以下目录建选黑的文件:
Screenshot.png

文件内容:
  1. 192.168.0.11  192.168.0.4 192.168.0.8 192.168.0.10  192.168.0.87
复制代码
对自己的环境执行实验破坏,命令是:
  1. [root@station90 ~]# bcl --O11g05 6b
复制代码

删除表空间的恢复,如果不把控制文件restore,只是做了时间点恢复,必然出现uname000X的错误:
  1. RMAN> run {
  2. 2> sql "alter session set nls_Date_format=''YYYY-MM-DD:HH24:MI:SS''";
  3. 3> set until time '2018-05-19:19:44:46';
  4. 4> restore database;
  5. 5> recover database;
  6. 6> }

  7. using target database control file instead of recovery catalog
  8. sql statement: alter session set nls_Date_format=''YYYY-MM-DD:HH24:MI:SS''

  9. executing command: SET until clause

  10. Starting restore at 19-MAY-18
  11. allocated channel: ORA_DISK_1
  12. channel ORA_DISK_1: SID=137 device type=DISK
  13. allocated channel: ORA_DISK_2
  14. channel ORA_DISK_2: SID=12 device type=DISK
  15. allocated channel: ORA_DISK_3
  16. channel ORA_DISK_3: SID=140 device type=DISK
  17. allocated channel: ORA_DISK_4
  18. channel ORA_DISK_4: SID=13 device type=DISK
  19. allocated channel: ORA_DISK_5
  20. channel ORA_DISK_5: SID=141 device type=DISK
  21. allocated channel: ORA_DISK_6
  22. channel ORA_DISK_6: SID=14 device type=DISK
  23. allocated channel: ORA_DISK_7
  24. channel ORA_DISK_7: SID=142 device type=DISK
  25. allocated channel: ORA_DISK_8
  26. channel ORA_DISK_8: SID=15 device type=DISK
  27. flashing back control file to SCN 1115587

  28. RMAN-00571: ===========================================================
  29. RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
  30. RMAN-00571: ===========================================================
  31. RMAN-03002: failure of restore command at 05/19/2018 19:53:33
  32. RMAN-06085: must use SET NEWNAME command to restore datafile /u01/app/oracle/product/11.2.0/dbhome_1/dbs/UNNAMED00004
复制代码
restore point 以及它在数据库化身时间轴上的应用:

  1. select  * from v$flashback_database_stat;

  2. select  * from v$restore_point;

  3. create restore point rsp1;
复制代码
  1. [root@station90 ~]# ssh station87
  2. Last login: Sat May 19 23:30:16 2018 from station90.example.com
  3. [root@station87 ~]# su - oracle
  4. [oracle@station87 ~]$ sqlplus /nolog

  5. SQL*Plus: Release 11.2.0.1.0 Production on Sat May 19 23:55:54 2018

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

  7. SQL> exit
  8. [oracle@station87 ~]$ rman target /

  9. Recovery Manager: Release 11.2.0.1.0 - Production on Sat May 19 23:56:02 2018

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

  11. connected to target database: ORCL (DBID=1359978017)

  12. RMAN> list incarnation of database;

  13. using target database control file instead of recovery catalog

  14. List of Database Incarnations
  15. DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
  16. ------- ------- -------- ---------------- --- ---------- ----------
  17. 1       1       ORCL     1359978017       PARENT  1          13-AUG-09
  18. 2       2       ORCL     1359978017       PARENT  754488     22-NOV-13
  19. 3       3       ORCL     1359978017       PARENT  1108732    19-MAY-18
  20. 4       4       ORCL     1359978017       PARENT  1121631    19-MAY-18
  21. 5       5       ORCL     1359978017       ORPHAN  1144059    19-MAY-18
  22. 6       6       ORCL     1359978017       CURRENT 1144059    19-MAY-18

  23. RMAN> shutdown abort

  24. Oracle instance shut down

  25. RMAN> startup mount

  26. connected to target database (not started)
  27. Oracle instance started
  28. database mounted

  29. Total System Global Area     820236288 bytes

  30. Fixed Size                     1339628 bytes
  31. Variable Size                587206420 bytes
  32. Database Buffers             226492416 bytes
  33. Redo Buffers                   5197824 bytes

  34. RMAN> exit


  35. Recovery Manager complete.
  36. [oracle@station87 ~]$ sqlplus /nolog

  37. SQL*Plus: Release 11.2.0.1.0 Production on Sat May 19 23:57:20 2018

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

  39. SQL> flashback database to restore point rsp1;
  40. SP2-0640: Not connected
  41. SQL> conn / as sysdba
  42. Connected.
  43. SQL>  flashback database to restore point rsp1;

  44. Flashback complete.

  45. SQL> alter database open resetlogs;

  46. Database altered.

  47. SQL> exit
  48. Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
  49. With the Partitioning, Automatic Storage Management, OLAP, Data Mining
  50. and Real Application Testing options
  51. [oracle@station87 ~]$ rman target /

  52. Recovery Manager: Release 11.2.0.1.0 - Production on Sat May 19 23:58:17 2018

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

  54. connected to target database: ORCL (DBID=1359978017)

  55. RMAN> list incarnation of database;

  56. using target database control file instead of recovery catalog

  57. List of Database Incarnations
  58. DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
  59. ------- ------- -------- ---------------- --- ---------- ----------
  60. 1       1       ORCL     1359978017       PARENT  1          13-AUG-09
  61. 2       2       ORCL     1359978017       PARENT  754488     22-NOV-13
  62. 3       3       ORCL     1359978017       PARENT  1108732    19-MAY-18
  63. 4       4       ORCL     1359978017       PARENT  1121631    19-MAY-18
  64. 5       5       ORCL     1359978017       ORPHAN  1144059    19-MAY-18
  65. 6       6       ORCL     1359978017       PARENT  1144059    19-MAY-18
  66. 7       7       ORCL     1359978017       CURRENT 1144593    19-MAY-18

  67. RMAN> exit


  68. Recovery Manager complete.
  69. [oracle@station87 ~]$ sqlplus /nolog

  70. SQL*Plus: Release 11.2.0.1.0 Production on Sat May 19 23:59:21 2018

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

  72. SQL> conn / as sysdba
  73. Connected.
  74. SQL> alter database flashback off;

  75. Database altered.

  76. SQL> shutdown abort
  77. ORACLE instance shut down.
  78. SQL> startup mount
  79. ORACLE instance started.

  80. Total System Global Area  820236288 bytes
  81. Fixed Size                    1339628 bytes
  82. Variable Size                  587206420 bytes
  83. Database Buffers          226492416 bytes
  84. Redo Buffers                    5197824 bytes
  85. Database mounted.
  86. SQL> exit
  87. Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
  88. With the Partitioning, Automatic Storage Management, OLAP, Data Mining
  89. and Real Application Testing options
  90. [oracle@station87 ~]$ rman target /

  91. Recovery Manager: Release 11.2.0.1.0 - Production on Sun May 20 00:00:38 2018

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

  93. connected to target database: ORCL (DBID=1359978017, not open)

  94. RMAN> run {
  95. 2> set until restore point rsp1;
  96. 3> restore database;
  97. 4> recover database;
  98. 5> }

  99. executing command: SET until clause

  100. Starting restore at 20-MAY-18
  101. using target database control file instead of recovery catalog
  102. RMAN-00571: ===========================================================
  103. RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
  104. RMAN-00571: ===========================================================
  105. RMAN-03002: failure of restore command at 05/20/2018 00:01:01
  106. RMAN-20208: UNTIL CHANGE is before RESETLOGS change

  107. RMAN> list incarnation of database;


  108. List of Database Incarnations
  109. DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
  110. ------- ------- -------- ---------------- --- ---------- ----------
  111. 1       1       ORCL     1359978017       PARENT  1          13-AUG-09
  112. 2       2       ORCL     1359978017       PARENT  754488     22-NOV-13
  113. 3       3       ORCL     1359978017       PARENT  1108732    19-MAY-18
  114. 4       4       ORCL     1359978017       PARENT  1121631    19-MAY-18
  115. 5       5       ORCL     1359978017       ORPHAN  1144059    19-MAY-18
  116. 6       6       ORCL     1359978017       PARENT  1144059    19-MAY-18
  117. 7       7       ORCL     1359978017       CURRENT 1144593    19-MAY-18

  118. RMAN> reset database to incarnation 6;

  119. database reset to incarnation 6

  120. RMAN> list incarnation of database;


  121. List of Database Incarnations
  122. DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
  123. ------- ------- -------- ---------------- --- ---------- ----------
  124. 1       1       ORCL     1359978017       PARENT  1          13-AUG-09
  125. 2       2       ORCL     1359978017       PARENT  754488     22-NOV-13
  126. 3       3       ORCL     1359978017       PARENT  1108732    19-MAY-18
  127. 4       4       ORCL     1359978017       PARENT  1121631    19-MAY-18
  128. 5       5       ORCL     1359978017       ORPHAN  1144059    19-MAY-18
  129. 6       6       ORCL     1359978017       CURRENT 1144059    19-MAY-18
  130. 7       7       ORCL     1359978017       ORPHAN  1144593    19-MAY-18

  131. RMAN> run {
  132. 2> set until restore point rsp1;
  133. 3> restore database;
  134. 4> recover database;
  135. 5> }

  136. executing command: SET until clause

  137. Starting restore at 20-MAY-18
  138. allocated channel: ORA_DISK_1
  139. channel ORA_DISK_1: SID=14 device type=DISK
  140. allocated channel: ORA_DISK_2
  141. channel ORA_DISK_2: SID=136 device type=DISK
  142. allocated channel: ORA_DISK_3
  143. channel ORA_DISK_3: SID=15 device type=DISK
  144. allocated channel: ORA_DISK_4
  145. channel ORA_DISK_4: SID=137 device type=DISK
  146. allocated channel: ORA_DISK_5
  147. channel ORA_DISK_5: SID=16 device type=DISK
  148. allocated channel: ORA_DISK_6
  149. channel ORA_DISK_6: SID=138 device type=DISK
  150. allocated channel: ORA_DISK_7
  151. channel ORA_DISK_7: SID=17 device type=DISK
  152. allocated channel: ORA_DISK_8
  153. channel ORA_DISK_8: SID=139 device type=DISK

  154. channel ORA_DISK_1: starting datafile backup set restore
  155. channel ORA_DISK_1: specifying datafile(s) to restore from backup set
  156. channel ORA_DISK_1: restoring datafile 00003 to +DATA/orcl/datafile/undotbs1.259.976558179
  157. channel ORA_DISK_1: reading from backup piece +FRA/orcl/backupset/2018_05_19/nnndf0_tag20180519t191110_0.301.976561875
  158. channel ORA_DISK_2: starting datafile backup set restore
  159. channel ORA_DISK_2: specifying datafile(s) to restore from backup set
  160. channel ORA_DISK_2: restoring datafile 00004 to +DATA/orcl/datafile/users.265.976575785
  161. channel ORA_DISK_2: reading from backup piece +FRA/orcl/backupset/2018_05_19/nnndf0_tag20180519t191110_0.298.976561883
  162. channel ORA_DISK_3: starting datafile backup set restore
  163. channel ORA_DISK_3: specifying datafile(s) to restore from backup set
  164. channel ORA_DISK_3: restoring datafile 00005 to +DATA/orcl/datafile/example.257.976558179
  165. channel ORA_DISK_3: reading from backup piece +FRA/orcl/backupset/2018_05_19/nnndf0_tag20180519t191110_0.299.976561877
  166. channel ORA_DISK_4: starting datafile backup set restore
  167. channel ORA_DISK_4: specifying datafile(s) to restore from backup set
  168. channel ORA_DISK_4: restoring datafile 00002 to +DATA/orcl/datafile/sysaux.258.976558179
  169. channel ORA_DISK_4: reading from backup piece +FRA/orcl/backupset/2018_05_19/nnndf0_tag20180519t191110_0.302.976561873
  170. channel ORA_DISK_5: starting datafile backup set restore
  171. channel ORA_DISK_5: specifying datafile(s) to restore from backup set
  172. channel ORA_DISK_5: restoring datafile 00001 to +DATA/orcl/datafile/system.256.976558181
  173. channel ORA_DISK_5: reading from backup piece +FRA/orcl/backupset/2018_05_19/nnndf0_tag20180519t191110_0.300.976561871
  174. channel ORA_DISK_2: piece handle=+FRA/orcl/backupset/2018_05_19/nnndf0_tag20180519t191110_0.298.976561883 tag=TAG20180519T191110
  175. channel ORA_DISK_2: restored backup piece 1
  176. channel ORA_DISK_2: restore complete, elapsed time: 00:00:03
  177. channel ORA_DISK_3: piece handle=+FRA/orcl/backupset/2018_05_19/nnndf0_tag20180519t191110_0.299.976561877 tag=TAG20180519T191110
  178. channel ORA_DISK_3: restored backup piece 1
  179. channel ORA_DISK_3: restore complete, elapsed time: 00:00:37
  180. channel ORA_DISK_1: piece handle=+FRA/orcl/backupset/2018_05_19/nnndf0_tag20180519t191110_0.301.976561875 tag=TAG20180519T191110
  181. channel ORA_DISK_1: restored backup piece 1
  182. channel ORA_DISK_1: restore complete, elapsed time: 00:00:47
  183. channel ORA_DISK_4: piece handle=+FRA/orcl/backupset/2018_05_19/nnndf0_tag20180519t191110_0.302.976561873 tag=TAG20180519T191110
  184. channel ORA_DISK_4: restored backup piece 1
  185. channel ORA_DISK_4: restore complete, elapsed time: 00:01:37
  186. channel ORA_DISK_5: piece handle=+FRA/orcl/backupset/2018_05_19/nnndf0_tag20180519t191110_0.300.976561871 tag=TAG20180519T191110
  187. channel ORA_DISK_5: restored backup piece 1
  188. channel ORA_DISK_5: restore complete, elapsed time: 00:01:56
  189. Finished restore at 20-MAY-18

  190. Starting recover at 20-MAY-18
  191. using channel ORA_DISK_1
  192. using channel ORA_DISK_2
  193. using channel ORA_DISK_3
  194. using channel ORA_DISK_4
  195. using channel ORA_DISK_5
  196. using channel ORA_DISK_6
  197. using channel ORA_DISK_7
  198. using channel ORA_DISK_8

  199. starting media recovery

  200. archived log for thread 1 with sequence 1 is already on disk as file +FRA/orcl/archivelog/2018_05_19/thread_1_seq_1.285.976563839
  201. archived log for thread 1 with sequence 2 is already on disk as file +FRA/orcl/archivelog/2018_05_19/thread_1_seq_2.284.976563839
  202. archived log for thread 1 with sequence 3 is already on disk as file +FRA/orcl/archivelog/2018_05_19/thread_1_seq_3.282.976563839
  203. archived log for thread 1 with sequence 4 is already on disk as file +FRA/orcl/archivelog/2018_05_19/thread_1_seq_4.281.976563843
  204. archived log for thread 1 with sequence 5 is already on disk as file +FRA/orcl/archivelog/2018_05_19/thread_1_seq_5.280.976563845
  205. archived log for thread 1 with sequence 6 is already on disk as file +FRA/orcl/archivelog/2018_05_19/thread_1_seq_6.277.976575919
  206. archived log for thread 1 with sequence 7 is already on disk as file +FRA/orcl/archivelog/2018_05_19/thread_1_seq_7.275.976575917
  207. archived log for thread 1 with sequence 1 is already on disk as file +FRA/orcl/archivelog/2018_05_19/thread_1_seq_1.283.976577949
  208. archived log for thread 1 with sequence 2 is already on disk as file +FRA/orcl/archivelog/2018_05_19/thread_1_seq_2.308.976577967
  209. archived log for thread 1 with sequence 3 is already on disk as file +FRA/orcl/archivelog/2018_05_19/thread_1_seq_3.307.976577967
  210. archived log for thread 1 with sequence 4 is already on disk as file +FRA/orcl/archivelog/2018_05_19/thread_1_seq_4.306.976577971
  211. archived log for thread 1 with sequence 1 is already on disk as file +FRA/orcl/archivelog/2018_05_19/thread_1_seq_1.269.976579079
  212. archived log file name=+FRA/orcl/archivelog/2018_05_19/thread_1_seq_1.285.976563839 thread=1 sequence=1
  213. archived log file name=+FRA/orcl/archivelog/2018_05_19/thread_1_seq_2.284.976563839 thread=1 sequence=2
  214. archived log file name=+FRA/orcl/archivelog/2018_05_19/thread_1_seq_3.282.976563839 thread=1 sequence=3
  215. archived log file name=+FRA/orcl/archivelog/2018_05_19/thread_1_seq_4.281.976563843 thread=1 sequence=4
  216. archived log file name=+FRA/orcl/archivelog/2018_05_19/thread_1_seq_5.280.976563845 thread=1 sequence=5
  217. archived log file name=+FRA/orcl/archivelog/2018_05_19/thread_1_seq_6.277.976575919 thread=1 sequence=6
  218. archived log file name=+FRA/orcl/archivelog/2018_05_19/thread_1_seq_7.275.976575917 thread=1 sequence=7
  219. archived log file name=+FRA/orcl/archivelog/2018_05_19/thread_1_seq_1.283.976577949 thread=1 sequence=1
  220. archived log file name=+FRA/orcl/archivelog/2018_05_19/thread_1_seq_2.308.976577967 thread=1 sequence=2
  221. archived log file name=+FRA/orcl/archivelog/2018_05_19/thread_1_seq_3.307.976577967 thread=1 sequence=3
  222. archived log file name=+FRA/orcl/archivelog/2018_05_19/thread_1_seq_4.306.976577971 thread=1 sequence=4
  223. archived log file name=+FRA/orcl/archivelog/2018_05_19/thread_1_seq_1.269.976579079 thread=1 sequence=1
  224. media recovery complete, elapsed time: 00:00:05
  225. Finished recover at 20-MAY-18

  226. RMAN> alter database open resetlogs;

  227. database opened

  228. RMAN>
复制代码
保障闪回还原点:
  1. select  * from v$flashback_database_stat;

  2. select  * from v$restore_point;

  3. create restore point rsp1;

  4. create restore point rsp2 guarantee flashback database;

  5. select  * from v$restore_point;
复制代码







回复

使用道具 举报

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

本版积分规则

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-11-21 22:36 , Processed in 0.090331 second(s), 28 queries .

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