设为首页收藏本站

Botang唐波's Oracle Station

查看: 73|回复: 0

课程第19次(2018-07-19星期四)

[复制链接]

708

主题

1070

帖子

7759

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
7759
发表于 2018-7-19 19:27:57 | 显示全部楼层 |阅读模式
  1. [oracle@station87 ~]$ rman target /

  2. Recovery Manager: Release 11.2.0.1.0 - Production on Thu Jul 19 19:18:28 2018

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

  4. connected to target database: UTFORCL (DBID=454057935)

  5. RMAN> list incarnation of database;

  6. using target database control file instead of recovery catalog

  7. List of Database Incarnations
  8. DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
  9. ------- ------- -------- ---------------- --- ---------- ----------
  10. 1       1       UTFORCL  454057935        PARENT  940976     2013-06-29:23:35:45
  11. 2       2       UTFORCL  454057935        CURRENT 1037166    2018-07-17:21:42:43

  12. RMAN> exit
复制代码
  1. [oracle@station87 dbs]$ nid  target=sys/oracle_4U  DBNAME=myorcl

  2. DBNEWID: Release 11.2.0.1.0 - Production on Thu Jul 19 19:24:26 2018

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

  4. Connected to database UTFORCL (DBID=454057935)

  5. NID-00121: Database should not be open


  6. Change of database name failed during validation - database is intact.
  7. DBNEWID - Completed with validation errors.

复制代码
  1. [oracle@station87 dbs]$ sqlplus /nolog

  2. SQL*Plus: Release 11.2.0.1.0 Production on Thu Jul 19 19:24:32 2018

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

  4. SQL> conn / as sysdba
  5. Connected.
  6. SQL> shutdown immediate
  7. Database closed.
  8. Database dismounted.
  9. ORACLE instance shut down.
  10. SQL> startup mount
  11. ORACLE instance started.

  12. Total System Global Area  857903104 bytes
  13. Fixed Size                    1339880 bytes
  14. Variable Size                  566234648 bytes
  15. Database Buffers          285212672 bytes
  16. Redo Buffers                    5115904 bytes
  17. Database mounted.
复制代码
  1. [oracle@station87 dbs]$ nid  target=sys/oracle_4U  DBNAME=myorcl

  2. DBNEWID: Release 11.2.0.1.0 - Production on Thu Jul 19 19:27:01 2018

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

  4. Connected to database UTFORCL (DBID=454057935)

  5. Connected to server version 11.2.0

  6. Control Files in database:
  7.     /u01/app/oracle/oradata/utforcl/control01.ctl
  8.     /u01/app/oracle/oradata/utforcl/control02.ctl
  9.     /u01/app/oracle/oradata/utforcl/control03.ctl

  10. Change database ID and database name UTFORCL to MYORCL? (Y/[N]) => Y

  11. Proceeding with operation
  12. Changing database ID from 454057935 to 402450949
  13. Changing database name from UTFORCL to MYORCL
  14.     Control File /u01/app/oracle/oradata/utforcl/control01.ctl - modified
  15.     Control File /u01/app/oracle/oradata/utforcl/control02.ctl - modified
  16.     Control File /u01/app/oracle/oradata/utforcl/control03.ctl - modified
  17.     Datafile /u01/app/oracle/oradata/utforcl/system01.db - dbid changed, wrote new name
  18.     Datafile /u01/app/oracle/oradata/utforcl/sysaux01.db - dbid changed, wrote new name
  19.     Datafile /u01/app/oracle/oradata/utforcl/undotbs1.db - dbid changed, wrote new name
  20.     Datafile /u01/app/oracle/oradata/utforcl/users01.db - dbid changed, wrote new name
  21.     Datafile /u01/app/oracle/oradata/utforcl/example01.db - dbid changed, wrote new name
  22.     Datafile /u01/app/oracle/oradata/utforcl/tbsutf8_11g.db - dbid changed, wrote new name
  23.     Datafile /u01/app/oracle/oradata/utforcl/temp01.db - dbid changed, wrote new name
  24.     Control File /u01/app/oracle/oradata/utforcl/control01.ctl - dbid changed, wrote new name
  25.     Control File /u01/app/oracle/oradata/utforcl/control02.ctl - dbid changed, wrote new name
  26.     Control File /u01/app/oracle/oradata/utforcl/control03.ctl - dbid changed, wrote new name
  27.     Instance shut down

  28. Database name changed to MYORCL.
  29. Modify parameter file and generate a new password file before restarting.
  30. Database ID for database MYORCL changed to 402450949.
  31. All previous backups and archived redo logs for this database are unusable.
  32. Database is not aware of previous backups and archived logs in Recovery Area.
  33. Database has been shutdown, open database with RESETLOGS option.
  34. Succesfully changed database name and ID.
  35. DBNEWID - Completed succesfully.

  36. [oracle@station87 dbs]$
复制代码

准备新的spfile和orapw文件,
[oracle@station87 oracle]$ cd admin/
[oracle@station87 admin]$ ls
+ASM  utforcl
[oracle@station87 admin]$ mkdir -p myorcl/adump
[oracle@station87 admin]$

启动myorcl实例:
  1. [oracle@station87 dbs]$ ps aux | grep ora_smon
  2. oracle    8380  0.0  0.0   4220   628 pts/1    S+   19:28   0:00 grep ora_smon
  3. [oracle@station87 dbs]$ ls
  4. 1.txt  hc_utforcl.dat  init.ora  initutforcl.ora  lkUTFORCL  orapwutforcl  peshm_utforcl_0  spfileutforcl.ora
  5. [oracle@station87 dbs]$ . oraenv
  6. ORACLE_SID = [utforcl] ?
  7. The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 is /u01/app/oracle
  8. [oracle@station87 dbs]$ sqlplus /nolog

  9. SQL*Plus: Release 11.2.0.1.0 Production on Thu Jul 19 19:28:43 2018

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

  11. SQL> conn / as sysdba
  12. Connected to an idle instance.
  13. SQL> create pfile from spfile;

  14. File created.

  15. SQL> exit
  16. Disconnected
  17. [oracle@station87 dbs]$ ls
  18. 1.txt  hc_utforcl.dat  init.ora  initutforcl.ora  lkUTFORCL  orapwutforcl  peshm_utforcl_0  spfileutforcl.ora
  19. [oracle@station87 dbs]$ mv initutforcl.ora  initmyorcl.ora
  20. [oracle@station87 dbs]$ ls
  21. 1.txt  hc_utforcl.dat  initmyorcl.ora  init.ora  lkUTFORCL  orapwutforcl  peshm_utforcl_0  spfileutforcl.ora
  22. [oracle@station87 dbs]$ rm -f spfileutforcl.ora
  23. [oracle@station87 dbs]$ ls
  24. 1.txt  hc_utforcl.dat  initmyorcl.ora  init.ora  lkUTFORCL  orapwutforcl  peshm_utforcl_0
  25. [oracle@station87 dbs]$ mv orapwutforcl orapwmyorcl
  26. [oracle@station87 dbs]$ ls
  27. 1.txt  hc_utforcl.dat  initmyorcl.ora  init.ora  lkUTFORCL  orapwmyorcl  peshm_utforcl_0
  28. [oracle@station87 dbs]$ vim initmyorcl.ora
  29. [oracle@station87 dbs][        DISCUZ_CODE_65        ]nbsp;
复制代码
改一下/etc/oratab:
  1. +ASM:/u01/app/oracle/product/11.2.0/grid:N
  2. myorcl:/u01/app/oracle/product/11.2.0/dbhome_1:N                # line added by Agent
复制代码
克隆的过程中,一定要注意:
1. auxiliary instance一定要带@连接。
2. auxiliary instance一定要静态注册监听器。
----------------------------------------------------------------------------
在克隆之前,先确保以下rman命令会成功:
  1. [oracle@station87 admin]$ rman target  sys/oracle_4U@orcl auxiliary sys/oracle_4U@clonedb

  2. Recovery Manager: Release 11.2.0.1.0 - Production on Thu Jul 19 20:21:40 2018

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

  4. connected to target database: ORCL (DBID=1359978017)
  5. connected to auxiliary database: CLONEDB (not mounted)

  6. RMAN>
复制代码

注意一下,由于 OMF文件名写死的问题,块跟踪在克隆之前,要先停掉。

  1. [oracle@station87 ~]$ rman target  sys/oracle_4U@orcl auxiliary sys/oracle_4U@clonedb

  2. Recovery Manager: Release 11.2.0.1.0 - Production on Thu Jul 19 20:31:31 2018

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

  4. connected to target database: ORCL (DBID=1359978017)
  5. connected to auxiliary database: CLONEDB (not mounted)

  6. RMAN> run  {
  7. 2> allocate channel c1 device type disk;
  8. 3> allocate channel c2 device type disk;
  9. 4> allocate channel c3 device type disk;
  10. 5> allocate channel c4 device type disk;
  11. 6> allocate channel c5 device type disk;
  12. 7> allocate channel c6 device type disk;
  13. 8> allocate channel c7 device type disk;
  14. 9> allocate channel c8 device type disk;
  15. 10> allocate auxiliary channel c9 device type disk;
  16. 11> allocate auxiliary channel c10 device type disk;
  17. 12> allocate auxiliary channel c11 device type disk;
  18. 13> allocate auxiliary channel c12 device type disk;
  19. 14> allocate auxiliary channel c13 device type disk;
  20. 15> allocate auxiliary channel c14 device type disk;
  21. 16> allocate auxiliary channel c15 device type disk;
  22. 17> allocate auxiliary channel c16 device type disk;
  23. 18> duplicate target database to clonedb
  24. 19> from active database
  25. 20> nofilenamecheck
  26. 21> spfile
  27. 22> set
  28. 23> control_files='+DATA','+FRA'
  29. 24> set
  30. 25> db_file_name_convert='+DATA/orcl/','+DATA/clonedb/'
  31. 26> set
  32. 27> log_file_name_convert='+DATA/orcl','+DATA/clonedb/'
  33. 28> set
  34. 29> audit_file_dest='/u01/app/oracle/admin/clonedb/adump';
  35. 30> }

  36. using target database control file instead of recovery catalog
  37. allocated channel: c1
  38. channel c1: SID=143 device type=DISK

  39. allocated channel: c2
  40. channel c2: SID=14 device type=DISK

  41. allocated channel: c3
  42. channel c3: SID=54 device type=DISK

  43. allocated channel: c4
  44. channel c4: SID=12 device type=DISK

  45. allocated channel: c5
  46. channel c5: SID=55 device type=DISK

  47. allocated channel: c6
  48. channel c6: SID=99 device type=DISK

  49. allocated channel: c7
  50. channel c7: SID=141 device type=DISK

  51. allocated channel: c8
  52. channel c8: SID=10 device type=DISK

  53. allocated channel: c9
  54. channel c9: SID=47 device type=DISK

  55. allocated channel: c10
  56. channel c10: SID=5 device type=DISK

  57. allocated channel: c11
  58. channel c11: SID=48 device type=DISK

  59. allocated channel: c12
  60. channel c12: SID=92 device type=DISK

  61. allocated channel: c13
  62. channel c13: SID=136 device type=DISK

  63. allocated channel: c14
  64. channel c14: SID=6 device type=DISK

  65. allocated channel: c15
  66. channel c15: SID=49 device type=DISK

  67. allocated channel: c16
  68. channel c16: SID=93 device type=DISK

  69. Starting Duplicate Db at 2018-07-19:20:33:54

  70. contents of Memory Script:
  71. {
  72.    backup as copy reuse
  73.    targetfile  '+DATA/orcl/spfileorcl.ora' auxiliary format
  74. '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/spfileclonedb.ora'   ;
  75.    sql clone "alter system set spfile= ''/u01/app/oracle/product/11.2.0/dbhome_1/dbs/spfileclonedb.ora''";
  76. }
  77. executing Memory Script

  78. Starting backup at 2018-07-19:20:33:54
  79. Finished backup at 2018-07-19:20:33:55

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

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

  102. sql statement: alter system set  db_name =  ''CLONEDB'' comment= ''duplicate'' scope=spfile

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

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

  105. sql statement: alter system set  log_file_name_convert =  ''+DATA/orcl'', ''+DATA/clonedb/'' comment= '''' scope=spfile

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

  107. Oracle instance shut down

  108. connected to auxiliary database (not started)
  109. Oracle instance started

  110. Total System Global Area    1046224896 bytes

  111. Fixed Size                     1341140 bytes
  112. Variable Size                603982124 bytes
  113. Database Buffers             436207616 bytes
  114. Redo Buffers                   4694016 bytes
  115. allocated channel: c9
  116. channel c9: SID=92 device type=DISK
  117. allocated channel: c10
  118. channel c10: SID=130 device type=DISK
  119. allocated channel: c11
  120. channel c11: SID=6 device type=DISK
  121. allocated channel: c12
  122. channel c12: SID=50 device type=DISK
  123. allocated channel: c13
  124. channel c13: SID=93 device type=DISK
  125. allocated channel: c14
  126. channel c14: SID=137 device type=DISK
  127. allocated channel: c15
  128. channel c15: SID=7 device type=DISK
  129. allocated channel: c16
  130. channel c16: SID=51 device type=DISK

  131. contents of Memory Script:
  132. {
  133.    sql clone "alter system set  control_files =
  134.   ''+DATA/clonedb/controlfile/current.269.981923651'', ''+FRA/clonedb/controlfile/current.358.981923651'' comment=
  135. ''Set by RMAN'' scope=spfile";
  136.    sql clone "alter system set  db_name =
  137. ''ORCL'' comment=
  138. ''Modified by RMAN duplicate'' scope=spfile";
  139.    sql clone "alter system set  db_unique_name =
  140. ''CLONEDB'' comment=
  141. ''Modified by RMAN duplicate'' scope=spfile";
  142.    shutdown clone immediate;
  143.    startup clone force nomount
  144.    backup as copy current controlfile auxiliary format  '+DATA/clonedb/controlfile/current.261.981923651';
  145.    restore clone controlfile to  '+FRA/clonedb/controlfile/current.349.981923651' from
  146. '+DATA/clonedb/controlfile/current.261.981923651';
  147.    sql clone "alter system set  control_files =
  148.   ''+DATA/clonedb/controlfile/current.261.981923651'', ''+FRA/clonedb/controlfile/current.349.981923651'' comment=
  149. ''Set by RMAN'' scope=spfile";
  150.    shutdown clone immediate;
  151.    startup clone nomount;
  152.    alter clone database mount;
  153. }
  154. executing Memory Script

  155. sql statement: alter system set  control_files =   ''+DATA/clonedb/controlfile/current.269.981923651'', ''+FRA/clonedb/controlfile/current.358.981923651'' comment= ''Set by RMAN'' scope=spfile

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

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

  158. Oracle instance shut down

  159. Oracle instance started

  160. Total System Global Area    1046224896 bytes

  161. Fixed Size                     1341140 bytes
  162. Variable Size                603982124 bytes
  163. Database Buffers             436207616 bytes
  164. Redo Buffers                   4694016 bytes
  165. allocated channel: c9
  166. channel c9: SID=92 device type=DISK
  167. allocated channel: c10
  168. channel c10: SID=136 device type=DISK
  169. allocated channel: c11
  170. channel c11: SID=6 device type=DISK
  171. allocated channel: c12
  172. channel c12: SID=50 device type=DISK
  173. allocated channel: c13
  174. channel c13: SID=93 device type=DISK
  175. allocated channel: c14
  176. channel c14: SID=137 device type=DISK
  177. allocated channel: c15
  178. channel c15: SID=7 device type=DISK
  179. allocated channel: c16
  180. channel c16: SID=51 device type=DISK

  181. Starting backup at 2018-07-19:20:34:23
  182. channel c1: starting datafile copy
  183. copying current control file
  184. output file name=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_orcl.f tag=TAG20180719T203422 RECID=38 STAMP=981923663
  185. channel c1: datafile copy complete, elapsed time: 00:00:01
  186. Finished backup at 2018-07-19:20:34:24

  187. Starting restore at 2018-07-19:20:34:24

  188. channel c10: skipped, AUTOBACKUP already found
  189. channel c11: skipped, AUTOBACKUP already found
  190. channel c12: skipped, AUTOBACKUP already found
  191. channel c13: skipped, AUTOBACKUP already found
  192. channel c14: skipped, AUTOBACKUP already found
  193. channel c15: skipped, AUTOBACKUP already found
  194. channel c16: skipped, AUTOBACKUP already found
  195. channel c9: copied control file copy
  196. Finished restore at 2018-07-19:20:34:33

  197. sql statement: alter system set  control_files =   ''+DATA/clonedb/controlfile/current.261.981923651'', ''+FRA/clonedb/controlfile/current.349.981923651'' comment= ''Set by RMAN'' scope=spfile

  198. Oracle instance shut down

  199. connected to auxiliary database (not started)
  200. Oracle instance started

  201. Total System Global Area    1046224896 bytes

  202. Fixed Size                     1341140 bytes
  203. Variable Size                603982124 bytes
  204. Database Buffers             436207616 bytes
  205. Redo Buffers                   4694016 bytes
  206. allocated channel: c9
  207. channel c9: SID=49 device type=DISK
  208. allocated channel: c10
  209. channel c10: SID=136 device type=DISK
  210. allocated channel: c11
  211. channel c11: SID=6 device type=DISK
  212. allocated channel: c12
  213. channel c12: SID=50 device type=DISK
  214. allocated channel: c13
  215. channel c13: SID=137 device type=DISK
  216. allocated channel: c14
  217. channel c14: SID=93 device type=DISK
  218. allocated channel: c15
  219. channel c15: SID=7 device type=DISK
  220. allocated channel: c16
  221. channel c16: SID=51 device type=DISK

  222. database mounted
  223. RMAN-05529: WARNING: DB_FILE_NAME_CONVERT resulted in invalid ASM names; names changed to disk group only.
  224. datafile 4 not processed because file is OFFLINE IMMEDIATE

  225. contents of Memory Script:
  226. {
  227.    set newname for datafile  1 to
  228. "+data";
  229.    set newname for datafile  2 to
  230. "+data";
  231.    set newname for datafile  3 to
  232. "+data";
  233.    set newname for datafile  5 to
  234. "+data";
  235.    set newname for datafile  6 to
  236. "+data";
  237.    set newname for datafile  7 to
  238. "+data";
  239.    backup as copy reuse
  240.    datafile  1 auxiliary format
  241. "+data"   datafile
  242. 2 auxiliary format
  243. "+data"   datafile
  244. 3 auxiliary format
  245. "+data"   datafile
  246. 5 auxiliary format
  247. "+data"   datafile
  248. 6 auxiliary format
  249. "+data"   datafile
  250. 7 auxiliary format
  251. "+data"   ;
  252.    sql 'alter system archive log current';
  253. }
  254. executing Memory Script

  255. executing command: SET NEWNAME

  256. executing command: SET NEWNAME

  257. executing command: SET NEWNAME

  258. executing command: SET NEWNAME

  259. executing command: SET NEWNAME

  260. executing command: SET NEWNAME

  261. Starting backup at 2018-07-19:20:35:00
  262. channel c1: starting datafile copy
  263. input datafile file number=00001 name=+DATA/orcl/datafile/system.268.979853699
  264. channel c2: starting datafile copy
  265. input datafile file number=00002 name=+DATA/orcl/datafile/sysaux.267.979847755
  266. channel c3: starting datafile copy
  267. input datafile file number=00005 name=+DATA/orcl/datafile/example.259.979847765
  268. channel c4: starting datafile copy
  269. input datafile file number=00003 name=+DATA/orcl/datafile/undotbs1.258.979847755
  270. channel c5: starting datafile copy
  271. input datafile file number=00006 name=+DATA/orcl/datafile/tbs1.256.979847755
  272. channel c6: starting datafile copy
  273. input datafile file number=00007 name=+DATA/orcl/datafile/tbs2.257.979847755
  274. output file name=+DATA/clonedb/datafile/system.262.981923705 tag=TAG20180719T203459
  275. channel c1: datafile copy complete, elapsed time: 00:00:33
  276. output file name=+DATA/clonedb/datafile/tbs1.257.981923731 tag=TAG20180719T203459
  277. channel c5: datafile copy complete, elapsed time: 00:00:18
  278. output file name=+DATA/clonedb/datafile/sysaux.259.981923707 tag=TAG20180719T203459
  279. channel c2: datafile copy complete, elapsed time: 00:00:40
  280. output file name=+DATA/clonedb/datafile/undotbs1.265.981923731 tag=TAG20180719T203459
  281. channel c4: datafile copy complete, elapsed time: 00:00:42
  282. output file name=+DATA/clonedb/datafile/tbs2.258.981923743 tag=TAG20180719T203459
  283. channel c6: datafile copy complete, elapsed time: 00:00:16
  284. output file name=+DATA/clonedb/datafile/example.256.981923747 tag=TAG20180719T203459
  285. channel c3: datafile copy complete, elapsed time: 00:00:54
  286. Finished backup at 2018-07-19:20:35:58

  287. sql statement: alter system archive log current

  288. contents of Memory Script:
  289. {
  290.    backup as copy reuse
  291.    archivelog like  "+FRA/orcl/archivelog/2018_07_19/thread_1_seq_95.342.981923641" auxiliary format
  292. "+FRA"   archivelog like
  293. "/home/oracle/1_95_978645051.dbf" auxiliary format
  294. "+FRA"   archivelog like
  295. "+FRA/orcl/archivelog/2018_07_19/thread_1_seq_96.346.981923655" auxiliary format
  296. "+FRA"   archivelog like
  297. "/home/oracle/1_96_978645051.dbf" auxiliary format
  298. "+FRA"   archivelog like
  299. "+FRA/orcl/archivelog/2018_07_19/thread_1_seq_97.313.981923683" auxiliary format
  300. "+FRA"   archivelog like
  301. "/home/oracle/1_97_978645051.dbf" auxiliary format
  302. "+FRA"   archivelog like
  303. "+FRA/orcl/archivelog/2018_07_19/thread_1_seq_98.315.981923705" auxiliary format
  304. "+FRA"   archivelog like
  305. "/home/oracle/1_98_978645051.dbf" auxiliary format
  306. "+FRA"   archivelog like
  307. "+FRA/orcl/archivelog/2018_07_19/thread_1_seq_99.345.981923753" auxiliary format
  308. "+FRA"   archivelog like
  309. "/home/oracle/1_99_978645051.dbf" auxiliary format
  310. "+FRA"   archivelog like
  311. "+FRA/orcl/archivelog/2018_07_19/thread_1_seq_100.304.981923765" auxiliary format
  312. "+FRA"   archivelog like
  313. "/home/oracle/1_100_978645051.dbf" auxiliary format
  314. "+FRA"   ;
  315.    catalog clone recovery area;
  316.    switch clone datafile all;
  317. }
  318. executing Memory Script

  319. Starting backup at 2018-07-19:20:36:10
  320. channel c1: starting archived log copy
  321. input archived log thread=1 sequence=95 RECID=119 STAMP=981923647
  322. channel c2: starting archived log copy
  323. input archived log thread=1 sequence=95 RECID=120 STAMP=981923647
  324. channel c3: starting archived log copy
  325. input archived log thread=1 sequence=96 RECID=121 STAMP=981923659
  326. channel c4: starting archived log copy
  327. input archived log thread=1 sequence=96 RECID=122 STAMP=981923659
  328. channel c5: starting archived log copy
  329. input archived log thread=1 sequence=97 RECID=123 STAMP=981923691
  330. channel c6: starting archived log copy
  331. input archived log thread=1 sequence=97 RECID=124 STAMP=981923691
  332. channel c7: starting archived log copy
  333. input archived log thread=1 sequence=98 RECID=125 STAMP=981923721
  334. channel c8: starting archived log copy
  335. input archived log thread=1 sequence=98 RECID=126 STAMP=981923722
  336. output file name=+FRA/clonedb/archivelog/2018_07_19/thread_1_seq_95.350.981923771 RECID=0 STAMP=0
  337. channel c1: archived log copy complete, elapsed time: 00:00:01
  338. channel c1: starting archived log copy
  339. input archived log thread=1 sequence=99 RECID=127 STAMP=981923764
  340. output file name=+FRA/clonedb/archivelog/2018_07_19/thread_1_seq_95.320.981923771 RECID=0 STAMP=0
  341. channel c2: archived log copy complete, elapsed time: 00:00:01
  342. channel c2: starting archived log copy
  343. input archived log thread=1 sequence=99 RECID=128 STAMP=981923764
  344. output file name=+FRA/clonedb/archivelog/2018_07_19/thread_1_seq_96.294.981923771 RECID=0 STAMP=0
  345. channel c3: archived log copy complete, elapsed time: 00:00:05
  346. channel c3: starting archived log copy
  347. input archived log thread=1 sequence=100 RECID=129 STAMP=981923769
  348. output file name=+FRA/clonedb/archivelog/2018_07_19/thread_1_seq_96.328.981923771 RECID=0 STAMP=0
  349. channel c4: archived log copy complete, elapsed time: 00:00:07
  350. channel c4: starting archived log copy
  351. input archived log thread=1 sequence=100 RECID=130 STAMP=981923769
  352. output file name=+FRA/clonedb/archivelog/2018_07_19/thread_1_seq_99.355.981923773 RECID=0 STAMP=0
  353. channel c1: archived log copy complete, elapsed time: 00:00:08
  354. output file name=+FRA/clonedb/archivelog/2018_07_19/thread_1_seq_99.330.981923773 RECID=0 STAMP=0
  355. channel c2: archived log copy complete, elapsed time: 00:00:07
  356. output file name=+FRA/clonedb/archivelog/2018_07_19/thread_1_seq_100.338.981923779 RECID=0 STAMP=0
  357. channel c3: archived log copy complete, elapsed time: 00:00:02
  358. output file name=+FRA/clonedb/archivelog/2018_07_19/thread_1_seq_97.336.981923771 RECID=0 STAMP=0
  359. channel c5: archived log copy complete, elapsed time: 00:00:09
  360. output file name=+FRA/clonedb/archivelog/2018_07_19/thread_1_seq_97.259.981923773 RECID=0 STAMP=0
  361. channel c6: archived log copy complete, elapsed time: 00:00:09
  362. output file name=+FRA/clonedb/archivelog/2018_07_19/thread_1_seq_98.257.981923773 RECID=0 STAMP=0
  363. channel c7: archived log copy complete, elapsed time: 00:00:08
  364. output file name=+FRA/clonedb/archivelog/2018_07_19/thread_1_seq_98.286.981923773 RECID=0 STAMP=0
  365. channel c8: archived log copy complete, elapsed time: 00:00:08
  366. output file name=+FRA/clonedb/archivelog/2018_07_19/thread_1_seq_100.343.981923781 RECID=0 STAMP=0
  367. channel c4: archived log copy complete, elapsed time: 00:00:01
  368. Finished backup at 2018-07-19:20:36:21

  369. searching for all files in the recovery area

  370. List of Files Unknown to the Database
  371. =====================================
  372. File Name: +fra/CLONEDB/ARCHIVELOG/2018_07_19/thread_1_seq_95.350.981923771
  373. File Name: +fra/CLONEDB/ARCHIVELOG/2018_07_19/thread_1_seq_95.320.981923771
  374. File Name: +fra/CLONEDB/ARCHIVELOG/2018_07_19/thread_1_seq_96.294.981923771
  375. File Name: +fra/CLONEDB/ARCHIVELOG/2018_07_19/thread_1_seq_96.328.981923771
  376. File Name: +fra/CLONEDB/ARCHIVELOG/2018_07_19/thread_1_seq_97.336.981923771
  377. File Name: +fra/CLONEDB/ARCHIVELOG/2018_07_19/thread_1_seq_97.259.981923773
  378. File Name: +fra/CLONEDB/ARCHIVELOG/2018_07_19/thread_1_seq_98.257.981923773
  379. File Name: +fra/CLONEDB/ARCHIVELOG/2018_07_19/thread_1_seq_98.286.981923773
  380. File Name: +fra/CLONEDB/ARCHIVELOG/2018_07_19/thread_1_seq_99.355.981923773
  381. File Name: +fra/CLONEDB/ARCHIVELOG/2018_07_19/thread_1_seq_99.330.981923773
  382. File Name: +fra/CLONEDB/ARCHIVELOG/2018_07_19/thread_1_seq_100.338.981923779
  383. File Name: +fra/CLONEDB/ARCHIVELOG/2018_07_19/thread_1_seq_100.343.981923781
  384. File Name: +fra/CLONEDB/CONTROLFILE/Current.358.981923651
  385. cataloging files...
  386. cataloging done

  387. List of Cataloged Files
  388. =======================
  389. File Name: +fra/CLONEDB/ARCHIVELOG/2018_07_19/thread_1_seq_95.350.981923771
  390. File Name: +fra/CLONEDB/ARCHIVELOG/2018_07_19/thread_1_seq_95.320.981923771
  391. File Name: +fra/CLONEDB/ARCHIVELOG/2018_07_19/thread_1_seq_96.294.981923771
  392. File Name: +fra/CLONEDB/ARCHIVELOG/2018_07_19/thread_1_seq_96.328.981923771
  393. File Name: +fra/CLONEDB/ARCHIVELOG/2018_07_19/thread_1_seq_97.336.981923771
  394. File Name: +fra/CLONEDB/ARCHIVELOG/2018_07_19/thread_1_seq_97.259.981923773
  395. File Name: +fra/CLONEDB/ARCHIVELOG/2018_07_19/thread_1_seq_98.257.981923773
  396. File Name: +fra/CLONEDB/ARCHIVELOG/2018_07_19/thread_1_seq_98.286.981923773
  397. File Name: +fra/CLONEDB/ARCHIVELOG/2018_07_19/thread_1_seq_99.355.981923773
  398. File Name: +fra/CLONEDB/ARCHIVELOG/2018_07_19/thread_1_seq_99.330.981923773
  399. File Name: +fra/CLONEDB/ARCHIVELOG/2018_07_19/thread_1_seq_100.338.981923779
  400. File Name: +fra/CLONEDB/ARCHIVELOG/2018_07_19/thread_1_seq_100.343.981923781

  401. List of Files Which Where Not Cataloged
  402. =======================================
  403. File Name: +fra/CLONEDB/CONTROLFILE/Current.358.981923651
  404.   RMAN-07517: Reason: The file header is corrupted

  405. datafile 1 switched to datafile copy
  406. input datafile copy RECID=38 STAMP=981923789 file name=+DATA/clonedb/datafile/system.262.981923705
  407. datafile 2 switched to datafile copy
  408. input datafile copy RECID=39 STAMP=981923789 file name=+DATA/clonedb/datafile/sysaux.259.981923707
  409. datafile 3 switched to datafile copy
  410. input datafile copy RECID=40 STAMP=981923789 file name=+DATA/clonedb/datafile/undotbs1.265.981923731
  411. datafile 5 switched to datafile copy
  412. input datafile copy RECID=41 STAMP=981923789 file name=+DATA/clonedb/datafile/example.256.981923747
  413. datafile 6 switched to datafile copy
  414. input datafile copy RECID=42 STAMP=981923789 file name=+DATA/clonedb/datafile/tbs1.257.981923731
  415. datafile 7 switched to datafile copy
  416. input datafile copy RECID=43 STAMP=981923789 file name=+DATA/clonedb/datafile/tbs2.258.981923743

  417. contents of Memory Script:
  418. {
  419.    set until scn  1618281;
  420.    recover
  421.    clone database
  422.    skip forever tablespace  "USERS"    delete archivelog
  423.    ;
  424. }
  425. executing Memory Script

  426. executing command: SET until clause

  427. Starting recover at 2018-07-19:20:36:30

  428. Executing: alter database datafile 4 offline drop
  429. starting media recovery

  430. archived log for thread 1 with sequence 97 is already on disk as file +FRA/clonedb/archivelog/2018_07_19/thread_1_seq_97.336.981923771
  431. archived log for thread 1 with sequence 98 is already on disk as file +FRA/clonedb/archivelog/2018_07_19/thread_1_seq_98.257.981923773
  432. archived log for thread 1 with sequence 99 is already on disk as file +FRA/clonedb/archivelog/2018_07_19/thread_1_seq_99.355.981923773
  433. archived log for thread 1 with sequence 100 is already on disk as file +FRA/clonedb/archivelog/2018_07_19/thread_1_seq_100.338.981923779
  434. archived log file name=+FRA/clonedb/archivelog/2018_07_19/thread_1_seq_97.336.981923771 thread=1 sequence=97
  435. archived log file name=+FRA/clonedb/archivelog/2018_07_19/thread_1_seq_98.257.981923773 thread=1 sequence=98
  436. archived log file name=+FRA/clonedb/archivelog/2018_07_19/thread_1_seq_99.355.981923773 thread=1 sequence=99
  437. ORA-00279: change 1617151 generated at 07/19/2018 20:35:00 needed for thread 1
  438. ORA-00289: suggestion :
  439. +FRA/clonedb/archivelog/2018_07_19/thread_1_seq_99.330.981923773
  440. ORA-00280: change 1617151 for thread 1 is in sequence #99


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

  442. ORA-00279: change 1617592 generated at 07/19/2018 20:35:49 needed for thread 1
  443. ORA-00289: suggestion :
  444. +FRA/clonedb/archivelog/2018_07_19/thread_1_seq_100.343.981923781
  445. ORA-00280: change 1617592 for thread 1 is in sequence #100
  446. ORA-00278: log file
  447. '+FRA/clonedb/archivelog/2018_07_19/thread_1_seq_99.330.981923773' no longer
  448. needed for this recovery
  449. alter database open resetlogs;
  450. released channel: c1
  451. released channel: c2
  452. released channel: c3
  453. released channel: c4
  454. released channel: c5
  455. released channel: c6
  456. released channel: c7
  457. released channel: c8
  458. released channel: c9
  459. released channel: c10
  460. released channel: c11
  461. released channel: c12
  462. released channel: c13
  463. released channel: c14
  464. released channel: c15
  465. released channel: c16

  466. RMAN>
复制代码

-------------------------------------------------------冷克隆:
  1. --源头把备份优化关掉,或用force语法

  2. run {
  3. allocate channel  c1 device type disk format '/home/oracle/backup/%U';
  4. allocate channel  c2 device type disk format '/home/oracle/backup/%U';
  5. allocate channel  c3 device type disk format '/home/oracle/backup/%U';
  6. allocate channel  c4 device type disk format '/home/oracle/backup/%U';
  7. allocate channel  c5 device type disk format '/home/oracle/backup/%U';
  8. allocate channel  c6 device type disk format '/home/oracle/backup/%U';
  9. allocate channel  c7 device type disk format '/home/oracle/backup/%U';
  10. allocate channel  c8 device type disk format '/home/oracle/backup/%U';
  11. backup database plus archivelog force;
  12. backup spfile;
  13. backup current controlfile;
  14. }
复制代码

把station86上的/home/oracle/backup/完整scp -rp到station87的/home/oracle/backup/

  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 target database to mydb
  11. backup location '/home/oracle/backup'
  12. nofilenamecheck
  13. spfile
  14. set
  15. control_files='/u01/app/oracle/oradata/mydb/control01.ctl','/u01/app/oracle/oradata/mydb/control02.ctl','/u01/app/oracle/oradata/mydb/control03.ctl'
  16. set
  17. db_file_name_convert='+DATA/orcl/datafile/example.258.880451611','/u01/app/oracle/oradata/mydb/example01.dbf','+DATA/orcl/datafile/users.259.880451615','/u01/app/oracle/oradata/mydb/users01.dbf','+DATA/orcl/datafile/undotbs1.256.880451607','/u01/app/oracle/oradata/mydb/undotbs01.dbf','+DATA/orcl/datafile/sysaux.257.880451605','/u01/app/oracle/oradata/mydb/sysaux01.dbf','+DATA/orcl/datafile/system.265.880451605','/u01/app/oracle/oradata/mydb/system01.dbf'
  18. set
  19. log_file_name_convert='+DATA/orcl/onlinelog/group_1.270.880453135','/u01/app/oracle/oradata/mydb/redo01a.log','+FRA/orcl/onlinelog/group_1.276.880453137','/u01/app/oracle/oradata/mydb/redo01b.log','+DATA/orcl/onlinelog/group_3.272.880453141','/u01/app/oracle/oradata/mydb/redo03a.log','+FRA/orcl/onlinelog/group_3.274.880453141','/u01/app/oracle/oradata/mydb/redo03b.log','+DATA/orcl/onlinelog/group_2.271.880453137','/u01/app/oracle/oradata/mydb/redo02a.log','+FRA/orcl/onlinelog/group_2.275.880453139','/u01/app/oracle/oradata/mydb/redo02b.log'
  20. set
  21. audit_file_dest='/u01/app/oracle/admin/mydb/adump'
  22. set
  23. db_create_file_dest=''
  24. set
  25. db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'
  26. }
复制代码
物理坏块和逻辑坏块,其中物理坏块的制造脚本:
physical-block11.2.0.1.sh (1.23 KB, 下载次数: 17)
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2018-8-20 02:56 , Processed in 0.117536 second(s), 27 queries .

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