设为首页收藏本站

Botang唐波's Oracle Station

查看: 346|回复: 0

活动第28/29次(2018-06-16星期六上下午)

[复制链接]

744

主题

1117

帖子

8077

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
8077
发表于 2018-6-16 10:23:08 | 显示全部楼层 |阅读模式
FROM ACTIVE DATABASE实验:

1. 准备initdbclone1.ora:
  1. db_name=dbclone1
  2. db_domain=example.com
复制代码
2.准备orapwdbclone1:
  1. orapwd file=orapwdbclone1   password=oracle_4U  entries=4
复制代码
3.启动auxiliary实例。(目的地实例

先写/etc/oratab:
  1. +ASM:/u01/app/oracle/product/11.2.0/grid:N
  2. winorcl:/u01/app/oracle/product/11.2.0/dbhome_1:N               # line added by Agent
  3. dbclone1:/u01/app/oracle/product/11.2.0/dbhome_1:N
复制代码
再. oraenv

4.在auxiliary实例的监听器上进行注册:
+ASM的listener.ora:
  1. # listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/grid/network/admin/listener.ora
  2. # Generated by Oracle configuration tools.

  3. SID_LIST_LISTENER =
  4.   (SID_LIST =
  5.     (SID_DESC =
  6.       (GLOBAL_DBNAME = dbclone1.example.com)
  7.       (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
  8.       (SID_NAME = dbclone1)
  9.     )
  10.   )

  11. LISTENER =
  12.   (DESCRIPTION_LIST =
  13.     (DESCRIPTION =
  14.       (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
  15.     )
  16.     (DESCRIPTION =
  17.       (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.87)(PORT = 1521))
  18.     )
  19.   )

  20. ADR_BASE_LISTENER = /u01/app/oracle

  21. ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER = ON
复制代码
5. 分发tnsnames.ora(源头、目的地和第三方控制台,第三方控制台不是必需的,可以用源头和目的地之中的任何一台代替第三方控制台):
  1. ORCL =
  2.   (DESCRIPTION =
  3.     (ADDRESS_LIST =
  4.       (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.86)(PORT = 1521))
  5.     )
  6.     (CONNECT_DATA =
  7.       (SERVER = DEDICATED)
  8.       (SERVICE_NAME = orcl.example.com)
  9.     )
  10.   )


  11. DBCLONE1 =
  12.   (DESCRIPTION =
  13.     (ADDRESS_LIST =
  14.       (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.87)(PORT = 1521))
  15.     )
  16.     (CONNECT_DATA =
  17.       (SERVER = DEDICATED)
  18.       (SERVICE_NAME = dbclone1.example.com)
  19.     )
  20.   )
复制代码
6. 执行duplicate database脚本(代替了第7章中实验11a的操作,如果在本地恢复还是要用11a实验的做法):

在目的地操作系统上建一下adump目录:
  1. mkdir -p /u01/app/oracle/admin/dbclone1/adump
复制代码
  1. run {
  2. duplicate target database to dbclone1
  3. from active database
  4. nofilenamecheck
  5. spfile
  6. set
  7. control_files='+DATA','+FRA'
  8. set
  9. db_file_name_convert='+DATA/orcl/','+DATA/dbclone1/'
  10. set
  11. log_file_name_convert='+DATA/orcl/','+DATA/dbclone1/','+FRA/orcl','+FRA/dbclone1/'
  12. set
  13. audit_file_dest='/u01/app/oracle/admin/dbclone1/adump';
  14. }
复制代码
7. 具体执行命令:
  1. [oracle@station90 ~]$ rman target sys/oracle_4U@orcl auxiliary sys/oracle_4U@dbclone1  cmdfile=dbclone1.rcv
复制代码
内存脚本的执行全过程(输出):
  1. Recovery Manager: Release 11.2.0.3.0 - Production on Sat Jun 16 10:52:18 2018

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

  3. PL/SQL package SYS.DBMS_BACKUP_RESTORE version 11.02.00.01 in TARGET database is not current
  4. PL/SQL package SYS.DBMS_RCVMAN version 11.02.00.01 in TARGET database is not current
  5. connected to target database: ORCL (DBID=1359978017)
  6. PL/SQL package SYS.DBMS_BACKUP_RESTORE version 11.02.00.01 in AUXILIARY database is not current
  7. PL/SQL package SYS.DBMS_RCVMAN version 11.02.00.01 in AUXILIARY database is not current
  8. connected to auxiliary database: DBCLONE1 (not mounted)

  9. RMAN> exit


  10. Recovery Manager complete.
  11. [oracle@station90 ~]$ rman target sys/oracle_4U@orcl auxiliary sys/oracle_4U@dbclone1  cmdfile=dbclone1.rcv

  12. Recovery Manager: Release 11.2.0.3.0 - Production on Sat Jun 16 10:52:53 2018

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

  14. PL/SQL package SYS.DBMS_BACKUP_RESTORE version 11.02.00.01 in TARGET database is not current
  15. PL/SQL package SYS.DBMS_RCVMAN version 11.02.00.01 in TARGET database is not current
  16. connected to target database: ORCL (DBID=1359978017)
  17. PL/SQL package SYS.DBMS_BACKUP_RESTORE version 11.02.00.01 in AUXILIARY database is not current
  18. PL/SQL package SYS.DBMS_RCVMAN version 11.02.00.01 in AUXILIARY database is not current
  19. connected to auxiliary database: DBCLONE1 (not mounted)

  20. RMAN>     run {
  21. 2>     duplicate target database to dbclone1
  22. 3>     from active database
  23. 4>     nofilenamecheck
  24. 5>     spfile
  25. 6>     set
  26. 7>     control_files='+DATA','+FRA'
  27. 8>     set
  28. 9>     db_file_name_convert='+DATA/orcl/','+DATA/dbclone1/'
  29. 10>     set
  30. 11>     log_file_name_convert='+DATA/orcl/','+DATA/dbclone1/','+FRA/orcl','+FRA/dbclone1/'
  31. 12>     set
  32. 13>     audit_file_dest='/u01/app/oracle/admin/dbclone1/adump';
  33. 14>     }
  34. 15>
  35. Starting Duplicate Db at 16-JUN-18
  36. using target database control file instead of recovery catalog
  37. allocated channel: ORA_AUX_DISK_1
  38. channel ORA_AUX_DISK_1: SID=95 device type=DISK
  39. allocated channel: ORA_AUX_DISK_2
  40. channel ORA_AUX_DISK_2: SID=10 device type=DISK
  41. allocated channel: ORA_AUX_DISK_3
  42. channel ORA_AUX_DISK_3: SID=97 device type=DISK
  43. allocated channel: ORA_AUX_DISK_4
  44. channel ORA_AUX_DISK_4: SID=11 device type=DISK
  45. allocated channel: ORA_AUX_DISK_5
  46. channel ORA_AUX_DISK_5: SID=98 device type=DISK
  47. allocated channel: ORA_AUX_DISK_6
  48. channel ORA_AUX_DISK_6: SID=12 device type=DISK
  49. allocated channel: ORA_AUX_DISK_7
  50. channel ORA_AUX_DISK_7: SID=99 device type=DISK
  51. allocated channel: ORA_AUX_DISK_8
  52. channel ORA_AUX_DISK_8: SID=13 device type=DISK
  53. allocated channel: ORA_AUX_SBT_TAPE_1
  54. channel ORA_AUX_SBT_TAPE_1: SID=100 device type=SBT_TAPE
  55. channel ORA_AUX_SBT_TAPE_1: Oracle Secure Backup
  56. allocated channel: ORA_AUX_SBT_TAPE_2
  57. channel ORA_AUX_SBT_TAPE_2: SID=14 device type=SBT_TAPE
  58. channel ORA_AUX_SBT_TAPE_2: Oracle Secure Backup

  59. contents of Memory Script:
  60. {
  61.    backup as copy reuse
  62.    targetfile  '+DATA/orcl/spfileorcl.ora' auxiliary format
  63. '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/spfiledbclone1.ora'   ;
  64.    sql clone "alter system set spfile= ''/u01/app/oracle/product/11.2.0/dbhome_1/dbs/spfiledbclone1.ora''";
  65. }
  66. executing Memory Script

  67. Starting backup at 16-JUN-18
  68. allocated channel: ORA_DISK_1
  69. channel ORA_DISK_1: SID=75 device type=DISK
  70. allocated channel: ORA_DISK_2
  71. channel ORA_DISK_2: SID=138 device type=DISK
  72. allocated channel: ORA_DISK_3
  73. channel ORA_DISK_3: SID=195 device type=DISK
  74. allocated channel: ORA_DISK_4
  75. channel ORA_DISK_4: SID=11 device type=DISK
  76. allocated channel: ORA_DISK_5
  77. channel ORA_DISK_5: SID=71 device type=DISK
  78. allocated channel: ORA_DISK_6
  79. channel ORA_DISK_6: SID=140 device type=DISK
  80. allocated channel: ORA_DISK_7
  81. channel ORA_DISK_7: SID=200 device type=DISK
  82. allocated channel: ORA_DISK_8
  83. channel ORA_DISK_8: SID=12 device type=DISK
  84. Finished backup at 16-JUN-18

  85. sql statement: alter system set spfile= ''/u01/app/oracle/product/11.2.0/dbhome_1/dbs/spfiledbclone1.ora''

  86. contents of Memory Script:
  87. {
  88.    sql clone "alter system set  db_name =
  89. ''DBCLONE1'' comment=
  90. ''duplicate'' scope=spfile";
  91.    sql clone "alter system set  control_files =
  92. ''+DATA'', ''+FRA'' comment=
  93. '''' scope=spfile";
  94.    sql clone "alter system set  db_file_name_convert =
  95. ''+DATA/orcl/'', ''+DATA/dbclone1/'' comment=
  96. '''' scope=spfile";
  97.    sql clone "alter system set  log_file_name_convert =
  98. ''+DATA/orcl/'', ''+DATA/dbclone1/'', ''+FRA/orcl'', ''+FRA/dbclone1/'' comment=
  99. '''' scope=spfile";
  100.    sql clone "alter system set  audit_file_dest =
  101. ''/u01/app/oracle/admin/dbclone1/adump'' comment=
  102. '''' scope=spfile";
  103.    shutdown clone immediate;
  104.    startup clone nomount;
  105. }
  106. executing Memory Script

  107. sql statement: alter system set  db_name =  ''DBCLONE1'' comment= ''duplicate'' scope=spfile

  108. sql statement: alter system set  control_files =  ''+DATA'', ''+FRA'' comment= '''' scope=spfile

  109. sql statement: alter system set  db_file_name_convert =  ''+DATA/orcl/'', ''+DATA/dbclone1/'' comment= '''' scope=spfile

  110. sql statement: alter system set  log_file_name_convert =  ''+DATA/orcl/'', ''+DATA/dbclone1/'', ''+FRA/orcl'', ''+FRA/dbclone1/'' comment= '''' scope=spfile

  111. sql statement: alter system set  audit_file_dest =  ''/u01/app/oracle/admin/dbclone1/adump'' comment= '''' scope=spfile

  112. Oracle instance shut down

  113. connected to auxiliary database (not started)
  114. Oracle instance started

  115. Total System Global Area     820236288 bytes

  116. Fixed Size                     1339628 bytes
  117. Variable Size                482348820 bytes
  118. Database Buffers             331350016 bytes
  119. Redo Buffers                   5197824 bytes

  120. contents of Memory Script:
  121. {
  122.    sql clone "alter system set  control_files =
  123.   ''+DATA/dbclone1/controlfile/current.266.978979989'', ''+FRA/dbclone1/controlfile/current.320.978979991'' comment=
  124. ''Set by RMAN'' scope=spfile";
  125.    sql clone "alter system set  db_name =
  126. ''ORCL'' comment=
  127. ''Modified by RMAN duplicate'' scope=spfile";
  128.    sql clone "alter system set  db_unique_name =
  129. ''DBCLONE1'' comment=
  130. ''Modified by RMAN duplicate'' scope=spfile";
  131.    shutdown clone immediate;
  132.    startup clone force nomount
  133.    backup as copy current controlfile auxiliary format  '+DATA/dbclone1/controlfile/current.264.978979991';
  134.    restore clone controlfile to  '+FRA/dbclone1/controlfile/current.258.978979991' from
  135. '+DATA/dbclone1/controlfile/current.264.978979991';
  136.    sql clone "alter system set  control_files =
  137.   ''+DATA/dbclone1/controlfile/current.264.978979991'', ''+FRA/dbclone1/controlfile/current.258.978979991'' comment=
  138. ''Set by RMAN'' scope=spfile";
  139.    shutdown clone immediate;
  140.    startup clone nomount;
  141.    alter clone database mount;
  142. }
  143. executing Memory Script

  144. sql statement: alter system set  control_files =   ''+DATA/dbclone1/controlfile/current.266.978979989'', ''+FRA/dbclone1/controlfile/current.320.978979991'' comment= ''Set by RMAN'' scope=spfile

  145. sql statement: alter system set  db_name =  ''ORCL'' comment= ''Modified by RMAN duplicate'' scope=spfile

  146. sql statement: alter system set  db_unique_name =  ''DBCLONE1'' comment= ''Modified by RMAN duplicate'' scope=spfile

  147. Oracle instance shut down

  148. Oracle instance started

  149. Total System Global Area     820236288 bytes

  150. Fixed Size                     1339628 bytes
  151. Variable Size                482348820 bytes
  152. Database Buffers             331350016 bytes
  153. Redo Buffers                   5197824 bytes

  154. Starting backup at 16-JUN-18
  155. using channel ORA_DISK_1
  156. using channel ORA_DISK_2
  157. using channel ORA_DISK_3
  158. using channel ORA_DISK_4
  159. using channel ORA_DISK_5
  160. using channel ORA_DISK_6
  161. using channel ORA_DISK_7
  162. using channel ORA_DISK_8
  163. channel ORA_DISK_1: starting datafile copy
  164. copying current control file
  165. output file name=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_orcl.f tag=TAG20180616T105316 RECID=2 STAMP=978951197
  166. channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
  167. Finished backup at 16-JUN-18

  168. Starting restore at 16-JUN-18
  169. allocated channel: ORA_AUX_DISK_1
  170. channel ORA_AUX_DISK_1: SID=13 device type=DISK
  171. allocated channel: ORA_AUX_DISK_2
  172. channel ORA_AUX_DISK_2: SID=135 device type=DISK
  173. allocated channel: ORA_AUX_DISK_3
  174. channel ORA_AUX_DISK_3: SID=136 device type=DISK
  175. allocated channel: ORA_AUX_DISK_4
  176. channel ORA_AUX_DISK_4: SID=15 device type=DISK
  177. allocated channel: ORA_AUX_DISK_5
  178. channel ORA_AUX_DISK_5: SID=137 device type=DISK
  179. allocated channel: ORA_AUX_DISK_6
  180. channel ORA_AUX_DISK_6: SID=16 device type=DISK
  181. allocated channel: ORA_AUX_DISK_7
  182. channel ORA_AUX_DISK_7: SID=138 device type=DISK
  183. allocated channel: ORA_AUX_DISK_8
  184. channel ORA_AUX_DISK_8: SID=17 device type=DISK
  185. allocated channel: ORA_AUX_SBT_TAPE_1
  186. channel ORA_AUX_SBT_TAPE_1: SID=139 device type=SBT_TAPE
  187. channel ORA_AUX_SBT_TAPE_1: Oracle Secure Backup
  188. allocated channel: ORA_AUX_SBT_TAPE_2
  189. channel ORA_AUX_SBT_TAPE_2: SID=18 device type=SBT_TAPE
  190. channel ORA_AUX_SBT_TAPE_2: Oracle Secure Backup

  191. channel ORA_AUX_DISK_2: skipped, AUTOBACKUP already found
  192. channel ORA_AUX_DISK_3: skipped, AUTOBACKUP already found
  193. channel ORA_AUX_DISK_4: skipped, AUTOBACKUP already found
  194. channel ORA_AUX_DISK_5: skipped, AUTOBACKUP already found
  195. channel ORA_AUX_DISK_6: skipped, AUTOBACKUP already found
  196. channel ORA_AUX_DISK_7: skipped, AUTOBACKUP already found
  197. channel ORA_AUX_DISK_8: skipped, AUTOBACKUP already found
  198. channel ORA_AUX_SBT_TAPE_1: skipped, AUTOBACKUP already found
  199. channel ORA_AUX_SBT_TAPE_2: skipped, AUTOBACKUP already found
  200. channel ORA_AUX_DISK_1: copied control file copy
  201. Finished restore at 16-JUN-18

  202. sql statement: alter system set  control_files =   ''+DATA/dbclone1/controlfile/current.264.978979991'', ''+FRA/dbclone1/controlfile/current.258.978979991'' comment= ''Set by RMAN'' scope=spfile

  203. Oracle instance shut down

  204. connected to auxiliary database (not started)
  205. Oracle instance started

  206. Total System Global Area     820236288 bytes

  207. Fixed Size                     1339628 bytes
  208. Variable Size                482348820 bytes
  209. Database Buffers             331350016 bytes
  210. Redo Buffers                   5197824 bytes

  211. database mounted
  212. RMAN-05529: WARNING: DB_FILE_NAME_CONVERT resulted in invalid ASM names; names changed to disk group only.

  213. contents of Memory Script:
  214. {
  215.    set newname for datafile  1 to
  216. "+data";
  217.    set newname for datafile  2 to
  218. "+data";
  219.    set newname for datafile  3 to
  220. "+data";
  221.    set newname for datafile  4 to
  222. "+data";
  223.    set newname for datafile  5 to
  224. "+data";
  225.    backup as copy reuse
  226.    datafile  1 auxiliary format
  227. "+data"   datafile
  228. 2 auxiliary format
  229. "+data"   datafile
  230. 3 auxiliary format
  231. "+data"   datafile
  232. 4 auxiliary format
  233. "+data"   datafile
  234. 5 auxiliary format
  235. "+data"   ;
  236.    sql 'alter system archive log current';
  237. }
  238. executing Memory Script

  239. executing command: SET NEWNAME

  240. executing command: SET NEWNAME

  241. executing command: SET NEWNAME

  242. executing command: SET NEWNAME

  243. executing command: SET NEWNAME

  244. Starting backup at 16-JUN-18
  245. using channel ORA_DISK_1
  246. using channel ORA_DISK_2
  247. using channel ORA_DISK_3
  248. using channel ORA_DISK_4
  249. using channel ORA_DISK_5
  250. using channel ORA_DISK_6
  251. using channel ORA_DISK_7
  252. using channel ORA_DISK_8
  253. channel ORA_DISK_1: starting datafile copy
  254. input datafile file number=00001 name=+DATA/orcl/datafile/system.256.978643425
  255. channel ORA_DISK_2: starting datafile copy
  256. input datafile file number=00002 name=+DATA/orcl/datafile/sysaux.258.978643425
  257. channel ORA_DISK_3: starting datafile copy
  258. input datafile file number=00003 name=+DATA/orcl/datafile/undotbs1.259.978643423
  259. channel ORA_DISK_4: starting datafile copy
  260. input datafile file number=00005 name=+DATA/orcl/datafile/example.257.978643425
  261. channel ORA_DISK_5: starting datafile copy
  262. input datafile file number=00004 name=+DATA/orcl/datafile/users.265.978645015
  263. output file name=+DATA/dbclone1/datafile/users.259.978980031 tag=TAG20180616T105349
  264. channel ORA_DISK_5: datafile copy complete, elapsed time: 00:00:15
  265. output file name=+DATA/dbclone1/datafile/example.265.978980031 tag=TAG20180616T105349
  266. channel ORA_DISK_4: datafile copy complete, elapsed time: 00:00:45
  267. output file name=+DATA/dbclone1/datafile/undotbs1.267.978980031 tag=TAG20180616T105349
  268. channel ORA_DISK_3: datafile copy complete, elapsed time: 00:01:25
  269. output file name=+DATA/dbclone1/datafile/system.260.978980031 tag=TAG20180616T105349
  270. channel ORA_DISK_1: datafile copy complete, elapsed time: 00:02:09
  271. output file name=+DATA/dbclone1/datafile/sysaux.268.978980031 tag=TAG20180616T105349
  272. channel ORA_DISK_2: datafile copy complete, elapsed time: 00:02:09
  273. Finished backup at 16-JUN-18

  274. sql statement: alter system archive log current

  275. contents of Memory Script:
  276. {
  277.    backup as copy reuse
  278.    archivelog like  "+FRA/orcl/archivelog/2018_06_16/thread_1_seq_4.351.978951273" auxiliary format
  279. "+FRA"   archivelog like
  280. "+FRA/orcl/archivelog/2018_06_16/thread_1_seq_5.352.978951293" auxiliary format
  281. "+FRA"   archivelog like
  282. "+FRA/orcl/archivelog/2018_06_16/thread_1_seq_6.359.978951361" auxiliary format
  283. "+FRA"   ;
  284.    catalog clone start with  "+FRA";
  285.    switch clone datafile all;
  286. }
  287. executing Memory Script

  288. Starting backup at 16-JUN-18
  289. using channel ORA_DISK_1
  290. using channel ORA_DISK_2
  291. using channel ORA_DISK_3
  292. using channel ORA_DISK_4
  293. using channel ORA_DISK_5
  294. using channel ORA_DISK_6
  295. using channel ORA_DISK_7
  296. using channel ORA_DISK_8
  297. channel ORA_DISK_1: starting archived log copy
  298. input archived log thread=1 sequence=4 RECID=105 STAMP=978951276
  299. channel ORA_DISK_2: starting archived log copy
  300. input archived log thread=1 sequence=5 RECID=106 STAMP=978951296
  301. channel ORA_DISK_3: starting archived log copy
  302. input archived log thread=1 sequence=6 RECID=107 STAMP=978951361
  303. output file name=+FRA/dbclone1/archivelog/2018_06_16/thread_1_seq_4.266.978980163 RECID=0 STAMP=0
  304. channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:07
  305. output file name=+FRA/dbclone1/archivelog/2018_06_16/thread_1_seq_5.296.978980163 RECID=0 STAMP=0
  306. channel ORA_DISK_2: archived log copy complete, elapsed time: 00:00:07
  307. output file name=+FRA/dbclone1/archivelog/2018_06_16/thread_1_seq_6.293.978980163 RECID=0 STAMP=0
  308. channel ORA_DISK_3: archived log copy complete, elapsed time: 00:00:07
  309. Finished backup at 16-JUN-18

  310. searching for all files that match the pattern +FRA

  311. List of Files Unknown to the Database
  312. =====================================
  313. File Name: +fra/DBCLONE1/ARCHIVELOG/2018_06_16/thread_1_seq_4.266.978980163
  314. File Name: +fra/DBCLONE1/ARCHIVELOG/2018_06_16/thread_1_seq_5.296.978980163
  315. File Name: +fra/DBCLONE1/ARCHIVELOG/2018_06_16/thread_1_seq_6.293.978980163
  316. File Name: +fra/DBCLONE1/CONTROLFILE/Current.320.978979991
  317. cataloging files...
  318. cataloging done

  319. List of Cataloged Files
  320. =======================
  321. File Name: +fra/DBCLONE1/ARCHIVELOG/2018_06_16/thread_1_seq_4.266.978980163
  322. File Name: +fra/DBCLONE1/ARCHIVELOG/2018_06_16/thread_1_seq_5.296.978980163
  323. File Name: +fra/DBCLONE1/ARCHIVELOG/2018_06_16/thread_1_seq_6.293.978980163

  324. List of Files Which Where Not Cataloged
  325. =======================================
  326. File Name: +fra/DBCLONE1/CONTROLFILE/Current.320.978979991
  327.   RMAN-07517: Reason: The file header is corrupted

  328. datafile 1 switched to datafile copy
  329. input datafile copy RECID=2 STAMP=978980170 file name=+DATA/dbclone1/datafile/system.260.978980031
  330. datafile 2 switched to datafile copy
  331. input datafile copy RECID=3 STAMP=978980170 file name=+DATA/dbclone1/datafile/sysaux.268.978980031
  332. datafile 3 switched to datafile copy
  333. input datafile copy RECID=4 STAMP=978980170 file name=+DATA/dbclone1/datafile/undotbs1.267.978980031
  334. datafile 4 switched to datafile copy
  335. input datafile copy RECID=5 STAMP=978980170 file name=+DATA/dbclone1/datafile/users.259.978980031
  336. datafile 5 switched to datafile copy
  337. input datafile copy RECID=6 STAMP=978980170 file name=+DATA/dbclone1/datafile/example.265.978980031

  338. contents of Memory Script:
  339. {
  340.    set until scn  1161526;
  341.    recover
  342.    clone database
  343.     delete archivelog
  344.    ;
  345. }
  346. executing Memory Script

  347. executing command: SET until clause

  348. Starting recover at 16-JUN-18
  349. allocated channel: ORA_AUX_DISK_1
  350. channel ORA_AUX_DISK_1: SID=135 device type=DISK
  351. allocated channel: ORA_AUX_DISK_2
  352. channel ORA_AUX_DISK_2: SID=15 device type=DISK
  353. allocated channel: ORA_AUX_DISK_3
  354. channel ORA_AUX_DISK_3: SID=14 device type=DISK
  355. allocated channel: ORA_AUX_DISK_4
  356. channel ORA_AUX_DISK_4: SID=137 device type=DISK
  357. allocated channel: ORA_AUX_DISK_5
  358. channel ORA_AUX_DISK_5: SID=138 device type=DISK
  359. allocated channel: ORA_AUX_DISK_6
  360. channel ORA_AUX_DISK_6: SID=139 device type=DISK
  361. allocated channel: ORA_AUX_DISK_7
  362. channel ORA_AUX_DISK_7: SID=18 device type=DISK
  363. allocated channel: ORA_AUX_DISK_8
  364. channel ORA_AUX_DISK_8: SID=140 device type=DISK
  365. allocated channel: ORA_AUX_SBT_TAPE_1
  366. channel ORA_AUX_SBT_TAPE_1: SID=19 device type=SBT_TAPE
  367. channel ORA_AUX_SBT_TAPE_1: Oracle Secure Backup
  368. allocated channel: ORA_AUX_SBT_TAPE_2
  369. channel ORA_AUX_SBT_TAPE_2: SID=141 device type=SBT_TAPE
  370. channel ORA_AUX_SBT_TAPE_2: Oracle Secure Backup

  371. starting media recovery

  372. archived log for thread 1 with sequence 4 is already on disk as file +FRA/dbclone1/archivelog/2018_06_16/thread_1_seq_4.266.978980163
  373. archived log for thread 1 with sequence 5 is already on disk as file +FRA/dbclone1/archivelog/2018_06_16/thread_1_seq_5.296.978980163
  374. archived log for thread 1 with sequence 6 is already on disk as file +FRA/dbclone1/archivelog/2018_06_16/thread_1_seq_6.293.978980163
  375. archived log file name=+FRA/dbclone1/archivelog/2018_06_16/thread_1_seq_4.266.978980163 thread=1 sequence=4
  376. archived log file name=+FRA/dbclone1/archivelog/2018_06_16/thread_1_seq_5.296.978980163 thread=1 sequence=5
  377. archived log file name=+FRA/dbclone1/archivelog/2018_06_16/thread_1_seq_6.293.978980163 thread=1 sequence=6
  378. media recovery complete, elapsed time: 00:00:17
  379. Finished recover at 16-JUN-18
  380. Oracle instance started

  381. Total System Global Area     820236288 bytes

  382. Fixed Size                     1339628 bytes
  383. Variable Size                482348820 bytes
  384. Database Buffers             331350016 bytes
  385. Redo Buffers                   5197824 bytes

  386. contents of Memory Script:
  387. {
  388.    sql clone "alter system set  db_name =
  389. ''DBCLONE1'' comment=
  390. ''Reset to original value by RMAN'' scope=spfile";
  391.    sql clone "alter system reset  db_unique_name scope=spfile";
  392.    shutdown clone immediate;
  393.    startup clone nomount;
  394. }
  395. executing Memory Script

  396. sql statement: alter system set  db_name =  ''DBCLONE1'' comment= ''Reset to original value by RMAN'' scope=spfile

  397. sql statement: alter system reset  db_unique_name scope=spfile

  398. Oracle instance shut down

  399. connected to auxiliary database (not started)
  400. Oracle instance started

  401. Total System Global Area     820236288 bytes

  402. Fixed Size                     1339628 bytes
  403. Variable Size                482348820 bytes
  404. Database Buffers             331350016 bytes
  405. Redo Buffers                   5197824 bytes
  406. sql statement: CREATE CONTROLFILE REUSE SET DATABASE "DBCLONE1" RESETLOGS ARCHIVELOG
  407.   MAXLOGFILES     16
  408.   MAXLOGMEMBERS      3
  409.   MAXDATAFILES      100
  410.   MAXINSTANCES     8
  411.   MAXLOGHISTORY      292
  412. LOGFILE
  413.   GROUP   1 ( '+data', '+fra' ) SIZE 50 M  REUSE,
  414.   GROUP   2 ( '+data', '+fra' ) SIZE 50 M  REUSE,
  415.   GROUP   3 ( '+data', '+fra' ) SIZE 50 M  REUSE
  416. DATAFILE
  417.   '+DATA/dbclone1/datafile/system.260.978980031'
  418. CHARACTER SET AL32UTF8


  419. contents of Memory Script:
  420. {
  421.    set newname for tempfile  1 to
  422. "+data";
  423.    switch clone tempfile all;
  424.    catalog clone datafilecopy  "+DATA/dbclone1/datafile/sysaux.268.978980031",
  425. "+DATA/dbclone1/datafile/undotbs1.267.978980031",
  426. "+DATA/dbclone1/datafile/users.259.978980031",
  427. "+DATA/dbclone1/datafile/example.265.978980031";
  428.    switch clone datafile all;
  429. }
  430. executing Memory Script

  431. executing command: SET NEWNAME

  432. renamed tempfile 1 to +data in control file

  433. cataloged datafile copy
  434. datafile copy file name=+DATA/dbclone1/datafile/sysaux.268.978980031 RECID=1 STAMP=978980209
  435. cataloged datafile copy
  436. datafile copy file name=+DATA/dbclone1/datafile/undotbs1.267.978980031 RECID=2 STAMP=978980209
  437. cataloged datafile copy
  438. datafile copy file name=+DATA/dbclone1/datafile/users.259.978980031 RECID=3 STAMP=978980209
  439. cataloged datafile copy
  440. datafile copy file name=+DATA/dbclone1/datafile/example.265.978980031 RECID=4 STAMP=978980209

  441. datafile 2 switched to datafile copy
  442. input datafile copy RECID=1 STAMP=978980209 file name=+DATA/dbclone1/datafile/sysaux.268.978980031
  443. datafile 3 switched to datafile copy
  444. input datafile copy RECID=2 STAMP=978980209 file name=+DATA/dbclone1/datafile/undotbs1.267.978980031
  445. datafile 4 switched to datafile copy
  446. input datafile copy RECID=3 STAMP=978980209 file name=+DATA/dbclone1/datafile/users.259.978980031
  447. datafile 5 switched to datafile copy
  448. input datafile copy RECID=4 STAMP=978980209 file name=+DATA/dbclone1/datafile/example.265.978980031

  449. contents of Memory Script:
  450. {
  451.    Alter clone database open resetlogs;
  452. }
  453. executing Memory Script

  454. database opened
  455. Finished Duplicate Db at 16-JUN-18

  456. Recovery Manager complete.
  457. [oracle@station90 ~]$
复制代码
8. 在目的地数据库这边,注册:
  1. [oracle@station87 ~]$ crs_stat -t
  2. Name           Type           Target    State     Host        
  3. ------------------------------------------------------------
  4. ora.DATA.dg    ora....up.type ONLINE    ONLINE    station87   
  5. ora.FRA.dg     ora....up.type ONLINE    ONLINE    station87   
  6. ora....ER.lsnr ora....er.type ONLINE    ONLINE    station87   
  7. ora.asm        ora.asm.type   ONLINE    ONLINE    station87   
  8. ora.cssd       ora.cssd.type  ONLINE    ONLINE    station87   
  9. ora.diskmon    ora....on.type ONLINE    ONLINE    station87   
  10. [oracle@station87 ~]$ srvctl add database -d dbclone1 -o /u01/app/oracle/product/11.2.0/dbhome_1   
  11. [oracle@station87 ~]$ crs_stat -t
  12. Name           Type           Target    State     Host        
  13. ------------------------------------------------------------
  14. ora.DATA.dg    ora....up.type ONLINE    ONLINE    station87   
  15. ora.FRA.dg     ora....up.type ONLINE    ONLINE    station87   
  16. ora....ER.lsnr ora....er.type ONLINE    ONLINE    station87   
  17. ora.asm        ora.asm.type   ONLINE    ONLINE    station87   
  18. ora.cssd       ora.cssd.type  ONLINE    ONLINE    station87   
  19. ora....one1.db ora....se.type OFFLINE   OFFLINE               
  20. ora.diskmon    ora....on.type ONLINE    ONLINE    station87   
  21. [oracle@station87 ~]$ srvctl start database -d dbclone1
  22. [oracle@station87 ~]$ crs_stat -t
  23. Name           Type           Target    State     Host        
  24. ------------------------------------------------------------
  25. ora.DATA.dg    ora....up.type ONLINE    ONLINE    station87   
  26. ora.FRA.dg     ora....up.type ONLINE    ONLINE    station87   
  27. ora....ER.lsnr ora....er.type ONLINE    ONLINE    station87   
  28. ora.asm        ora.asm.type   ONLINE    ONLINE    station87   
  29. ora.cssd       ora.cssd.type  ONLINE    ONLINE    station87   
  30. ora....one1.db ora....se.type ONLINE    ONLINE    station87   
  31. ora.diskmon    ora....on.type ONLINE    ONLINE    station87   
  32. [oracle@station87 ~]$
复制代码

FROM ACTIVE DATABASE实验(源头是ASM目的地是文件系统):

1. 准备initdbclone2.ora:
  1. db_name=dbclone2
  2. db_domain=example.com
复制代码
2.准备orapwdbclone2:
  1. orapwd file=orapwdbclone2   password=oracle_4U  entries=4
复制代码
3.启动auxiliary实例。(目的地实例

先写/etc/oratab:
  1. +ASM:/u01/app/oracle/product/11.2.0/grid:N
  2. winorcl:/u01/app/oracle/product/11.2.0/dbhome_1:N               # line added by Agent
  3. dbclone1:/u01/app/oracle/product/11.2.0/dbhome_1:N
  4. dbclone2:/u01/app/oracle/product/11.2.0/dbhome_1:N
复制代码
再. oraenv

4.在auxiliary实例的监听器上进行注册:
+ASM的listener.ora:
  1. # listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/grid/network/admin/listener.ora
  2. # Generated by Oracle configuration tools.

  3. SID_LIST_LISTENER =
  4.   (SID_LIST =
  5.     (SID_DESC =
  6.       (GLOBAL_DBNAME = dbclone1.example.com)
  7.       (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
  8.       (SID_NAME = dbclone1)
  9.     )
  10.      (SID_DESC =
  11.       (GLOBAL_DBNAME = dbclone2.example.com)
  12.       (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
  13.       (SID_NAME = dbclone2)
  14.      )
  15.   )

  16. LISTENER =
  17.   (DESCRIPTION_LIST =
  18.     (DESCRIPTION =
  19.       (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
  20.     )
  21.     (DESCRIPTION =
  22.       (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.87)(PORT = 1521))
  23.     )
  24.   )

  25. ADR_BASE_LISTENER = /u01/app/oracle

  26. ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER = ON
复制代码
5. 分发tnsnames.ora(源头、目的地和第三方控制台,第三方控制台不是必需的,可以用源头和目的地之中的任何一台代替第三方控制台):
  1. ORCL =
  2.   (DESCRIPTION =
  3.     (ADDRESS_LIST =
  4.       (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.86)(PORT = 1521))
  5.     )
  6.     (CONNECT_DATA =
  7.       (SERVER = DEDICATED)
  8.       (SERVICE_NAME = orcl.example.com)
  9.     )
  10.   )


  11. DBCLONE1 =
  12.   (DESCRIPTION =
  13.     (ADDRESS_LIST =
  14.       (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.87)(PORT = 1521))
  15.     )
  16.     (CONNECT_DATA =
  17.       (SERVER = DEDICATED)
  18.       (SERVICE_NAME = dbclone1.example.com)
  19.     )
  20.   )

  21. DBCLONE2 =
  22.   (DESCRIPTION =
  23.     (ADDRESS_LIST =
  24.       (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.87)(PORT = 1521))
  25.     )
  26.     (CONNECT_DATA =
  27.       (SERVER = DEDICATED)
  28.       (SERVICE_NAME = dbclone2.example.com)
  29.     )
  30.   )
复制代码
6. 执行duplicate database脚本(代替了第7章中实验11a的操作,如果在本地恢复还是要用11a实验的做法):

在目的地操作系统上建一下adump目录:
  1. mkdir -p /u01/app/oracle/admin/dbclone2/adump
  2. mkdir -p /u01/app/oracle/oradata/dbclone2
  3. mkdir -p /u01/app/oracle/fast_recovery_area
复制代码
顺便测试一下:选一部份表空间,不选另外一部分表空间:
  1. SQL> conn / as sysdba
  2. Connected.
  3. SQL> select  tablespacE_name from dba_tablespaces;

  4. TABLESPACE_NAME
  5. ------------------------------
  6. SYSTEM
  7. SYSAUX
  8. UNDOTBS1
  9. TEMP
  10. USERS
  11. EXAMPLE

  12. 6 rows selected.

  13. SQL> create tablespace tbs1 datafile size 5M   ;

  14. Tablespace created.

  15. SQL> create tablespace tbs2 datafile size 5M   ;

  16. Tablespace created.

  17. SQL> create table t1(a number)  tablespace  tbs1;

  18. Table created.

  19. SQL> insert into t1 values(1)  ;

  20. 1 row created.

  21. SQL> commit;

  22. Commit complete.

  23. SQL> create table hr.t2(a number)  tablespace  tbs2;

  24. Table created.

  25. SQL> insert into hr.t2 values (1) ;

  26. 1 row created.

  27. SQL> commit;

  28. Commit complete.

  29. SQL>
复制代码
对排除的表空间一定要做“自包含 集检查”:
  1. SQL> exec dbms_tts.TRANSPORT_SET_CHECK('tbs1,tbs2');

  2. PL/SQL procedure successfully completed.


  3. SQL> select * from transport_set_violations;

  4. VIOLATIONS
  5. --------------------------------------------------------------------------------
  6. ORA-39917: SYS owned object T1 in tablespace TBS1 not allowed in pluggable set
复制代码
处理办法都是“移走”:
  1. SQL> alter table T1  move tablespace system;

  2. Table altered.
复制代码
  1. run{
  2. duplicate target database to dbclone2
  3. from active database
  4. nofilenamecheck
  5. skip tablespace 'TBS1','TBS2'
  6. spfile
  7. set
  8. control_files='/u01/app/oracle/oradata/dbclone2/control01.ctl','/u01/app/oracle/oradata/dbclone2/control02.ctl','/u01/app/oracle/oradata/dbclone2/control03.ctl'
  9. set
  10. db_file_name_convert='+DATA/orcl/datafile/example.257.978643425','/u01/app/oracle/oradata/dbclone2/example01.dbf','+DATA/orcl/datafile/users.265.978645015','/u01/app/oracle/oradata/dbclone2/users01.dbf','+DATA/orcl/datafile/undotbs1.259.978643423','/u01/app/oracle/oradata/dbclone2/undotbs01.dbf','+DATA/orcl/datafile/sysaux.258.978643425','/u01/app/oracle/oradata/dbclone2/sysaux01.dbf','+DATA/orcl/datafile/system.256.978643425','/u01/app/oracle/oradata/dbclone2/system01.dbf'
  11. set
  12. log_file_name_convert='+DATA/orcl/onlinelog/group_1.261.978643689','/u01/app/oracle/oradata/dbclone2/redo01a.log','+FRA/orcl/onlinelog/group_1.257.978643689','/u01/app/oracle/oradata/dbclone2/redo01b.log','+DATA/orcl/onlinelog/group_3.263.978643691','/u01/app/oracle/oradata/dbclone2/redo03a.log','+FRA/orcl/onlinelog/group_3.259.978643691','/u01/app/oracle/oradata/dbclone2/redo03b.log','+DATA/orcl/onlinelog/group_2.262.978643689','/u01/app/oracle/oradata/dbclone2/redo02a.log','+FRA/orcl/onlinelog/group_2.258.978643691','/u01/app/oracle/oradata/dbclone2/redo02b.log'
  13. set
  14. audit_file_dest='/u01/app/oracle/admin/dbclone2/adump'
  15. set
  16. db_create_file_dest=''
  17. set
  18. db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
  19. set
  20. memory_target='2G'
  21. ;
  22. }
复制代码
  1. rman target sys/oracle_4U@orcl auxiliary sys/oracle_4U@dbclone2 cmdfile=dbclone2.rcv
复制代码

BACKUP LOCATION实验:

1. 准备initdbclone3.ora:
  1. db_name=dbclone3
  2. db_domain=example.com
复制代码
2.准备orapwdbclone3:
  1. orapwd file=orapwdbclone3   password=oracle_4U  entries=4
复制代码
3.启动auxiliary实例。(目的地实例

先写/etc/oratab:
  1. +ASM:/u01/app/oracle/product/11.2.0/grid:N
  2. winorcl:/u01/app/oracle/product/11.2.0/dbhome_1:N               # line added by Agent
  3. dbclone1:/u01/app/oracle/product/11.2.0/dbhome_1:N
  4. dbclone2:/u01/app/oracle/product/11.2.0/dbhome_1:N
  5. dbclone3:/u01/app/oracle/product/11.2.0/dbhome_1:N
复制代码
再. oraenv

4.在auxiliary实例的监听器上进行注册:
+ASM的listener.ora:
  1. # listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/grid/network/admin/listener.ora
  2. # Generated by Oracle configuration tools.

  3. SID_LIST_LISTENER =
  4.   (SID_LIST =
  5.      (SID_DESC =
  6.       (GLOBAL_DBNAME = dbclone1.example.com)
  7.       (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
  8.       (SID_NAME = dbclone1)
  9.     )
  10.      (SID_DESC =
  11.       (GLOBAL_DBNAME = dbclone2.example.com)
  12.       (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
  13.       (SID_NAME = dbclone2)
  14.      )
  15.      (SID_DESC =
  16.       (GLOBAL_DBNAME = dbclone3.example.com)
  17.       (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
  18.       (SID_NAME = dbclone3)
  19.      )
  20.   )

  21. LISTENER =
  22.   (DESCRIPTION_LIST =
  23.     (DESCRIPTION =
  24.       (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
  25.     )
  26.     (DESCRIPTION =
  27.       (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.87)(PORT = 1521))
  28.     )
  29.   )

  30. ADR_BASE_LISTENER = /u01/app/oracle

  31. ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER = ON
复制代码
5. 分发tnsnames.ora(源头、目的地和第三方控制台,第三方控制台不是必需的,可以用源头和目的地之中的任何一台代替第三方控制台):
  1. ORCL =
  2.   (DESCRIPTION =
  3.     (ADDRESS_LIST =
  4.       (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.86)(PORT = 1521))
  5.     )
  6.     (CONNECT_DATA =
  7.       (SERVER = DEDICATED)
  8.       (SERVICE_NAME = orcl.example.com)
  9.     )
  10.   )


  11. DBCLONE1 =
  12.   (DESCRIPTION =
  13.     (ADDRESS_LIST =
  14.       (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.87)(PORT = 1521))
  15.     )
  16.     (CONNECT_DATA =
  17.       (SERVER = DEDICATED)
  18.       (SERVICE_NAME = dbclone1.example.com)
  19.     )
  20.   )

  21. DBCLONE2 =
  22.   (DESCRIPTION =
  23.     (ADDRESS_LIST =
  24.       (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.87)(PORT = 1521))
  25.     )
  26.     (CONNECT_DATA =
  27.       (SERVER = DEDICATED)
  28.       (SERVICE_NAME = dbclone2.example.com)
  29.     )
  30.   )

  31. DBCLONE3 =
  32.   (DESCRIPTION =
  33.     (ADDRESS_LIST =
  34.       (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.87)(PORT = 1521))
  35.     )
  36.     (CONNECT_DATA =
  37.       (SERVER = DEDICATED)
  38.       (SERVICE_NAME = dbclone3.example.com)
  39.     )
  40.   )
复制代码
6. 执行duplicate database脚本(代替了第7章中实验11a的操作,如果在本地恢复还是要用11a实验的做法):

在目的地操作系统上建一下adump目录:
  1. mkdir -p /u01/app/oracle/admin/dbclone3/adump
复制代码
7. 在源头和目的地机器上都建一个相同的目录:
  1. mkdir /home/oracle/backup
复制代码
8. 在源头数据库上做备份(源头备份做完后,可以关闭):run {
  1. allocate channel  c1 device type disk format '/home/oracle/backup/%U';
  2. allocate channel  c2 device type disk format '/home/oracle/backup/%U';
  3. allocate channel  c3 device type disk format '/home/oracle/backup/%U';
  4. allocate channel  c4 device type disk format '/home/oracle/backup/%U';
  5. allocate channel  c5 device type disk format '/home/oracle/backup/%U';
  6. allocate channel  c6 device type disk format '/home/oracle/backup/%U';
  7. allocate channel  c7 device type disk format '/home/oracle/backup/%U';
  8. allocate channel  c8 device type disk format '/home/oracle/backup/%U';
  9. backup database plus archivelog force;
  10. backup spfile;
  11. backup current controlfile;
  12. }
复制代码
以上脚本结束后,把源头/home/oracle/backup/*传送到目的地/home/oracle/backup/
  1. [oracle@station86 backup]$ scp * station87:/home/oracle/backup/
  2. The authenticity of host 'station87 (192.168.0.87)' can't be established.
  3. RSA key fingerprint is 3c:21:7a:9c:cd:d9:41:16:75:08:fe:16:4d:37:54:5b.
  4. Are you sure you want to continue connecting (yes/no)? yes
  5. Warning: Permanently added 'station87,192.168.0.87' (RSA) to the list of known hosts.
  6. oracle@station87's password:
  7. 2et5jl2p_1_1                                                                                        100%   21MB  21.3MB/s   00:00   
  8. 2ft5jl2p_1_1                                                                                        100%   43MB  21.7MB/s   00:02   
  9. 2gt5jl2q_1_1                                                                                        100%   46MB  45.9MB/s   00:01   
  10. 2ht5jl2r_1_1                                                                             
复制代码
顺便试一下新语法,老的语法供参考和显式分配通道:
  1. run{
  2. duplicate target database to mydb
  3. backup location '/home/oracle/backup'
  4. nofilenamecheck
  5. spfile
  6. set
  7. control_files='/u01/app/oracle/oradata/mydb/control01.ctl','/u01/app/oracle/oradata/db11g/control02.ctl','/u01/app/oracle/oradata/db11g/control03.ctl'
  8. set
  9. db_file_name_convert='+DATA/orcl/datafile/example.258.880451611','/u01/app/oracle/oradata/db11g/example01.dbf','+DATA/orcl/datafile/users.259.880451615','/u01/app/oracle/oradata/db11g/users01.dbf','+DATA/orcl/datafile/undotbs1.256.880451607','/u01/app/oracle/oradata/db11g/undotbs01.dbf','+DATA/orcl/datafile/sysaux.257.880451605','/u01/app/oracle/oradata/db11g/sysaux01.dbf','+DATA/orcl/datafile/system.265.880451605','/u01/app/oracle/oradata/db11g/system01.dbf'
  10. set
  11. log_file_name_convert='+DATA/orcl/onlinelog/group_1.270.880453135','/u01/app/oracle/oradata/db11g/redo01a.log','+FRA/orcl/onlinelog/group_1.276.880453137','/u01/app/oracle/oradata/db11g/redo01b.log','+DATA/orcl/onlinelog/group_3.272.880453141','/u01/app/oracle/oradata/db11g/redo03a.log','+FRA/orcl/onlinelog/group_3.274.880453141','/u01/app/oracle/oradata/db11g/redo03b.log','+DATA/orcl/onlinelog/group_2.271.880453137','/u01/app/oracle/oradata/db11g/redo02a.log','+FRA/orcl/onlinelog/group_2.275.880453139','/u01/app/oracle/oradata/db11g/redo02b.log'
  12. set
  13. audit_file_dest='/u01/app/oracle/admin/mydb/adump'
  14. set
  15. db_create_file_dest=''
  16. set
  17. db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'
  18. }
复制代码

新的语法:

在目的地机器上创建/u01/app/oracle/oradata/dbclone3
  1. run {
  2. allocate  auxiliary channel c1 device type disk;
  3. allocate  auxiliary channel c2 device type disk;
  4. allocate  auxiliary channel c3 device type disk;
  5. allocate  auxiliary channel c4 device type disk;
  6. allocate  auxiliary channel c5 device type disk;
  7. allocate  auxiliary channel c6 device type disk;
  8. allocate  auxiliary channel c7 device type disk;
  9. allocate  auxiliary channel c8 device type disk;
  10. duplicate database to dbclone3
  11. backup location '/home/oracle/backup'
  12. nofilenamecheck  
  13. db_file_name_convert '+DATA/orcl/datafile/example.257.978643425','/u01/app/oracle/oradata/dbclone3/example01.dbf','+DATA/orcl/datafile/users.265.978645015','/u01/app/oracle/oradata/dbclone3/users01.dbf','+DATA/orcl/datafile/undotbs1.259.978643423','/u01/app/oracle/oradata/dbclone3/undotbs01.dbf','+DATA/orcl/datafile/sysaux.258.978643425','/u01/app/oracle/oradata/dbclone3/sysaux01.dbf','+DATA/orcl/datafile/system.256.978643425','/u01/app/oracle/oradata/dbclone3/system01.dbf'
  14. logfile
  15. group 1 ('/u01/app/oracle/oradata/dbclone3/redo01a.log','/u01/app/oracle/oradata/dbclone3/redo01b.log') size 50M,
  16. group 2 ('/u01/app/oracle/oradata/dbclone3/redo02a.log','/u01/app/oracle/oradata/dbclone3/redo02b.log') size 50M,
  17. group 3 ('/u01/app/oracle/oradata/dbclone3/redo03a.log','/u01/app/oracle/oradata/dbclone3/redo03b.log') size 50M
  18. spfile
  19. set
  20. control_files='/u01/app/oracle/oradata/dbclone3/control01.ctl','/u01/app/oracle/oradata/dbclone3/control02.ctl','/u01/app/oracle/oradata/dbclone3/control03.ctl'
  21. set
  22. audit_file_dest='/u01/app/oracle/admin/dbclone3/adump'
  23. set
  24. db_create_file_dest=''
  25. set
  26. db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
  27. ;
  28. }
复制代码
在1Z0-052第18章/1Z0-053第9章之前,数据库里没有物理和逻辑坏块:
physical-block11.2.0.1.sh.zip (645 Bytes, 下载次数: 184)
回复

使用道具 举报

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

本版积分规则

QQ|手机版|Botang唐波's Oracle Station   

GMT+8, 2018-11-18 02:20 , Processed in 0.199217 second(s), 27 queries .

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