-Oracle 11gR2通过RMAN克隆数据库

Oracle Study之--Oracle 11gR2通过RMAN克隆数据库

Purpose of Database Duplication

A duplicate database is useful for a variety of purposes, most of which involve testing. You can perform the following tasks in a duplicate database:

  • Test backup and recovery procedures
  • Test an upgrade to a new release of Oracle Database
  • Test the effect of applications on database performance
  • Create a standby database
  • Generate reports

Techniques for Duplicating a Database

RMAN supports two basic types of duplication: active database duplication and backup-based duplication. RMAN can perform backup-based duplication with or without either of the following connections:

  • Target
  • Recovery catalog

A connection to both is required for active database duplication.

Figure 24-1 shows the decision tree for the two duplication techniques.

Active Database Duplication

In active database duplication, RMAN connects as TARGET to the source database instance and as AUXILIARY to the auxiliary instance. RMAN copies the live source database over the network to the auxiliary instance, thereby creating the duplicate database. No backups of the source database are required. Figure 24-2 illustrates active database duplication.

     Oracle 11g的RMAN duplicate 可以通过Active database duplicate和Backup-based duplicate两种方法实现。本案例使用的是Active database duplicate,对于Active database duplicate来说,在克隆数据库时不用对Source备份,这对于大数据特别是T级别的数据库来说优点非常明显,复制前不需要进行备份,减少了备份和传送备份的时间,同时节省备份空间。

 

    克隆数据库一般是在不同的主机上来完成,本案例是测试环境,所以在一台主机上完成。

 

1、Source 库信息

[html] view plain copy

print?

  1. [[email protected] ~]$sqlplus ‘/as sysdba‘
  2. SQL*Plus: Release 11.2.0.3.0 Production on Thu Mar 24 16:30:48 2016
  3. Copyright (c) 1982, 2011, Oracle.  All rights reserved.
  4. Connected to:
  5. Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
  6. With the Partitioning, OLAP, Data Mining and Real Application Testing options
  7. 16:30:48 [email protected] prod>select status from v$instance;
  8. STATUS
  9. ------------
  10. OPEN
  11. 16:31:12 [email protected] prod>select name from v$datafile;
  12. NAME
  13. ------------------------------------------------------------------------------------------------------------------------
  14. /u01/app/oracle/oradata/prod/system01.dbf
  15. /u01/app/oracle/oradata/prod/sysaux01.dbf
  16. /u01/app/oracle/oradata/prod/undotbs01.dbf
  17. /u01/app/oracle/oradata/prod/users01.dbf
  18. /u01/app/oracle/oradata/prod/example01.dbf
  19. /u01/app/oracle/oradata/prod/test1.dbf
  20. 6 rows selected.
  21. 16:37:41 [email protected] prod>select member from v$logfile;
  22. MEMBER
  23. ------------------------------------------------------------------------------------------------------------------------
  24. /u01/app/oracle/oradata/prod/redo03.log
  25. /u01/app/oracle/oradata/prod/redo02.log
  26. /u01/app/oracle/oradata/prod/redo01.log
  27. 16:38:43 [email protected] prod>show parameter name
  28. NAME                                 TYPE        VALUE
  29. ------------------------------------ ----------- ------------------------------
  30. db_file_name_convert                 string
  31. db_name                              string      prod
  32. db_unique_name                       string      prod
  33. global_names                         boolean     FALSE
  34. instance_name                        string      prod
  35. lock_name_space                      string
  36. log_file_name_convert                string
  37. processor_group_name                 string
  38. service_names                        string      prod

2、构建测试库:

1)测试库目录环境
[[email protected] dsk3]# cd test1/
[[email protected] test1]# ls
oradata  logs admin

2)生成测试库pfile
[[email protected] dbs]$ cat inittest1.ora 

[html] view plain copy

print?

  1. *.audit_file_dest=‘/dsk3/test1/admin/adump‘
  2. *.audit_trail=‘db‘
  3. *.compatible=‘11.2.0.0.0‘
  4. *.control_files=‘/dsk3/test1/oradata/control01.ctl‘
  5. *.db_block_size=8192
  6. *.db_domain=‘‘
  7. *.db_name=‘test1‘
  8. *.diagnostic_dest=‘/u01/app/oracle‘
  9. *.memory_target=319430400
  10. *.open_cursors=300
  11. *.processes=150
  12. *.remote_login_passwordfile=‘EXCLUSIVE‘
  13. *.undo_tablespace=‘UNDOTBS1‘
  14. *.db_file_name_convert=(‘/u01/app/oracle/oradata/prod/‘,‘/dsk3/test1/oradata/‘)        ;如果源库和目标库在同一台主机,需要配置文件存储路径转换参数
  15. *.log_file_name_convert=(‘/u01/app/oracle/oradata/prod/‘,‘/dsk3/test1/logs/‘)

3)生成口令文件
[[email protected] dbs]$ cp orapwprod orapwtest1

4)启动Auxiliary Instance到no mount

[html] view plain copy

print?

  1. 16:52:01 [email protected] test1>startup nomount;
  2. ORACLE instance started.
  3. Total System Global Area  521936896 bytes
  4. Fixed Size                  2229944 bytes
  5. Variable Size             314575176 bytes
  6. Database Buffers          201326592 bytes
  7. Redo Buffers                3805184 bytes
  8. 16:52:13 [email protected] test1>show parameter name
  9. NAME                                 TYPE        VALUE
  10. ------------------------------------ ----------- ------------------------------
  11. db_file_name_convert                 string      /u01/app/oracle/oradata/prod/,
  12. /dsk3/test1/oradata/
  13. db_name                                 string      test1
  14. db_unique_name                    string      test1
  15. global_names                         boolean     FALSE
  16. instance_name                        string      test1
  17. lock_name_space                   string
  18. log_file_name_convert            string        /u01/app/oracle/oradata/prod/,
  19. /dsk3/test1/logs/
  20. processor_group_name           string
  21. service_names                        string      test1

三、配置网络Listener 和 tnsname

由于Auxiliary Instance只能启动到no mount状态,所以需要在listener里配置Auxiliary Instance为静态注册,以便RMAN进行连接。

1)配置监听器
[[email protected] admin]$ cat listener.ora 

[html] view plain copy

print?

  1. # listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
  2. # Generated by Oracle configuration tools.
  3. LISTENER =
  4. (DESCRIPTION_LIST =
  5. (DESCRIPTION =
  6. (ADDRESS = (PROTOCOL = TCP)(HOST = rh64)(PORT = 1521))
  7. (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
  8. )
  9. )
  10. ADR_BASE_LISTENER = /u01/app/oracle

# 静态注册Auxiliary Instance:test1
SID_LIST_LISTENER =

  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = test1)
      (ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
      (SID_NAME = test1)
    )
  )

 

2)配置tnsnames
[[email protected] admin]$ cat tnsnames.ora 

[html] view plain copy

print?

  1. # tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/db_1/network/admin/tnsnames.ora
  2. # Generated by Oracle configuration tools.
  3. PROD =
  4. (DESCRIPTION =
  5. (ADDRESS = (PROTOCOL = TCP)(HOST = rh64)(PORT = 1521))
  6. (CONNECT_DATA =
  7. (SERVER = DEDICATED)
  8. (SERVICE_NAME = prod)
  9. )
  10. )
  11. TEST1 =
  12. (DESCRIPTION =
  13. (ADDRESS = (PROTOCOL = TCP)(HOST = rh64)(PORT = 1521))
  14. (CONNECT_DATA =
  15. (SERVER = DEDICATED)
  16. (SERVICE_NAME = test1)
  17. )
  18. )

3)查看listener信息

[html] view plain copy

print?

  1. [[email protected] admin]$ lsnrctl status
  2. LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 24-MAR-2016 17:44:04
  3. Copyright (c) 1991, 2011, Oracle.  All rights reserved.
  4. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=rh64)(PORT=1521)))
  5. STATUS of the LISTENER
  6. ------------------------
  7. Alias                     LISTENER
  8. Version                   TNSLSNR for Linux: Version 11.2.0.3.0 - Production
  9. Start Date                24-MAR-2016 17:43:17
  10. Uptime                    0 days 0 hr. 0 min. 46 sec
  11. Trace Level               off
  12. Security                  ON: Local OS Authentication
  13. SNMP                      OFF
  14. Listener Parameter File   /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
  15. Listener Log File         /u01/app/oracle/diag/tnslsnr/rh64/listener/alert/log.xml
  16. Listening Endpoints Summary...
  17. (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rh64.cuug.cn)(PORT=1521)))
  18. (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  19. Services Summary...
  20. Service "prod" has 1 instance(s).
  21. Instance "prod", status READY, has 1 handler(s) for this service...
  22. Service "prodXDB" has 1 instance(s).
  23. Instance "prod", status READY, has 1 handler(s) for this service...
  24. Service "test1" has 1 instance(s).
  25. Instance "test1", status UNKNOWN, has 1 handler(s) for this service...           ;;Auxiliary Instance静态注册后,状态为“UNKNOWN"
  26. The command completed successfully

四、配置RMAN克隆
[[email protected] admin]$ rman target sys/[email protected] auxiliary sys/[email protected]
Recovery Manager: Release 11.2.0.3.0 - Production on Thu Mar 24 17:07:38 2016
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
connected to target database: PROD (DBID=305104131)
connected to auxiliary database: TEST1 (not mounted)

RMAN> duplicate database to test1 from active database nofilenamecheck;

[html] view plain copy

print?

  1. Starting Duplicate Db at 24-MAR-16
  2. using target database control file instead of recovery catalog
  3. allocated channel: ORA_AUX_DISK_1
  4. channel ORA_AUX_DISK_1: SID=20 device type=DISK
  5. contents of Memory Script:
  6. {
  7. sql clone "create spfile from memory";
  8. }
  9. executing Memory Script
  10. sql statement: create spfile from memory
  11. contents of Memory Script:
  12. {
  13. shutdown clone immediate;
  14. startup clone nomount;
  15. }
  16. executing Memory Script
  17. Oracle instance shut down
  18. connected to auxiliary database (not started)
  19. Oracle instance started
  20. Total System Global Area     321507328 bytes
  21. Fixed Size                     2228024 bytes
  22. Variable Size                230686920 bytes
  23. Database Buffers              83886080 bytes
  24. Redo Buffers                   4706304 bytes
  25. contents of Memory Script:
  26. {
  27. sql clone "alter system set  db_name =
  28. ‘‘PROD‘‘ comment=
  29. ‘‘Modified by RMAN duplicate‘‘ scope=spfile";
  30. sql clone "alter system set  db_unique_name =
  31. ‘‘TEST1‘‘ comment=
  32. ‘‘Modified by RMAN duplicate‘‘ scope=spfile";
  33. shutdown clone immediate;
  34. startup clone force nomount
  35. backup as copy current controlfile auxiliary format  ‘/dsk3/test1/oradata/control01.ctl‘;
  36. alter clone database mount;
  37. }
  38. executing Memory Script
  39. sql statement: alter system set  db_name =  ‘‘PROD‘‘ comment= ‘‘Modified by RMAN duplicate‘‘ scope=spfile
  40. sql statement: alter system set  db_unique_name =  ‘‘TEST1‘‘ comment= ‘‘Modified by RMAN duplicate‘‘ scope=spfile
  41. Oracle instance shut down
  42. Oracle instance started
  43. Total System Global Area     321507328 bytes
  44. Fixed Size                     2228024 bytes
  45. Variable Size                230686920 bytes
  46. Database Buffers              83886080 bytes
  47. Redo Buffers                   4706304 bytes
  48. Starting backup at 24-MAR-16
  49. allocated channel: ORA_DISK_1
  50. channel ORA_DISK_1: SID=34 device type=DISK
  51. channel ORA_DISK_1: starting datafile copy
  52. copying current control file
  53. output file name=/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_prod.f tag=TAG20160324T175437 RECID=3 STAMP=907350882
  54. channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
  55. Finished backup at 24-MAR-16
  56. database mounted
  57. contents of Memory Script:
  58. {
  59. set newname for datafile  1 to
  60. "/dsk3/test1/data/system01.dbf";
  61. set newname for datafile  2 to
  62. "/dsk3/test1/data/sysaux01.dbf";
  63. set newname for datafile  3 to
  64. "/dsk3/test1/data/undotbs01.dbf";
  65. set newname for datafile  4 to
  66. "/dsk3/test1/data/users01.dbf";
  67. set newname for datafile  5 to
  68. "/dsk3/test1/data/example01.dbf";
  69. set newname for datafile  6 to
  70. "/dsk3/test1/data/test1.dbf";
  71. backup as copy reuse
  72. datafile  1 auxiliary format
  73. "/dsk3/test1/data/system01.dbf"   datafile
  74. 2 auxiliary format
  75. "/dsk3/test1/data/sysaux01.dbf"   datafile
  76. 3 auxiliary format
  77. "/dsk3/test1/data/undotbs01.dbf"   datafile
  78. 4 auxiliary format
  79. "/dsk3/test1/data/users01.dbf"   datafile
  80. 5 auxiliary format
  81. "/dsk3/test1/data/example01.dbf"   datafile
  82. 6 auxiliary format
  83. "/dsk3/test1/data/test1.dbf"   ;
  84. sql ‘alter system archive log current‘;
  85. }
  86. executing Memory Script
  87. executing command: SET NEWNAME
  88. executing command: SET NEWNAME
  89. executing command: SET NEWNAME
  90. executing command: SET NEWNAME
  91. executing command: SET NEWNAME
  92. executing command: SET NEWNAME
  93. Starting backup at 24-MAR-16
  94. using channel ORA_DISK_1
  95. channel ORA_DISK_1: starting datafile copy
  96. input datafile file number=00001 name=/u01/app/oracle/oradata/prod/system01.dbf
  97. output file name=/dsk3/test1/oradata/system01.dbf tag=TAG20160324T180122
  98. channel ORA_DISK_1: datafile copy complete, elapsed time: 00:01:45
  99. channel ORA_DISK_1: starting datafile copy
  100. input datafile file number=00002 name=/u01/app/oracle/oradata/prod/sysaux01.dbf
  101. output file name=/dsk3/test1/oradata/sysaux01.dbf tag=TAG20160324T180122
  102. channel ORA_DISK_1: datafile copy complete, elapsed time: 00:01:35
  103. channel ORA_DISK_1: starting datafile copy
  104. input datafile file number=00005 name=/u01/app/oracle/oradata/prod/example01.dbf
  105. output file name=/dsk3/test1/oradata/example01.dbf tag=TAG20160324T180122
  106. channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:55
  107. channel ORA_DISK_1: starting datafile copy
  108. input datafile file number=00003 name=/u01/app/oracle/oradata/prod/undotbs01.dbf
  109. output file name=/dsk3/test1/oradata/undotbs01.dbf tag=TAG20160324T180122
  110. channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
  111. channel ORA_DISK_1: starting datafile copy
  112. input datafile file number=00006 name=/u01/app/oracle/oradata/prod/test1.dbf
  113. output file name=/dsk3/test1/oradata/test1.dbf tag=TAG20160324T180122
  114. channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
  115. channel ORA_DISK_1: starting datafile copy
  116. input datafile file number=00004 name=/u01/app/oracle/oradata/prod/users01.dbf
  117. output file name=/dsk3/test1/oradata/users01.dbf tag=TAG20160324T180122
  118. channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
  119. Finished backup at 24-MAR-16
  120. sql statement: alter system archive log current
  121. contents of Memory Script:
  122. {
  123. backup as copy reuse
  124. archivelog like  "/dsk4/arch_prod/arch_1_32_893265808.log" auxiliary format
  125. "/u01/app/oracle/product/11.2.0/db_1/dbs/arch1_32_893265808.dbf"   ;
  126. catalog clone archivelog  "/u01/app/oracle/product/11.2.0/db_1/dbs/arch1_32_893265808.dbf";
  127. switch clone datafile all;
  128. }
  129. executing Memory Script
  130. Starting backup at 24-MAR-16
  131. using channel ORA_DISK_1
  132. channel ORA_DISK_1: starting archived log copy
  133. input archived log thread=1 sequence=32 RECID=26 STAMP=907351568
  134. output file name=/u01/app/oracle/product/11.2.0/db_1/dbs/arch1_32_893265808.dbf RECID=0 STAMP=0
  135. channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01
  136. Finished backup at 24-MAR-16
  137. cataloged archived log
  138. archived log file name=/u01/app/oracle/product/11.2.0/db_1/dbs/arch1_32_893265808.dbf RECID=26 STAMP=907351572
  139. datafile 1 switched to datafile copy
  140. input datafile copy RECID=4 STAMP=907351573 file name=/dsk3/test1/oradata/system01.dbf
  141. datafile 2 switched to datafile copy
  142. input datafile copy RECID=5 STAMP=907351573 file name=/dsk3/test1/oradata/sysaux01.dbf
  143. datafile 3 switched to datafile copy
  144. input datafile copy RECID=6 STAMP=907351574 file name=/dsk3/test1/oradata/undotbs01.dbf
  145. datafile 4 switched to datafile copy
  146. input datafile copy RECID=7 STAMP=907351574 file name=/dsk3/test1/oradata/users01.dbf
  147. datafile 5 switched to datafile copy
  148. input datafile copy RECID=8 STAMP=907351574 file name=/dsk3/test1/oradata/example01.dbf
  149. datafile 6 switched to datafile copy
  150. input datafile copy RECID=9 STAMP=907351574 file name=/dsk3/test1/oradata/test1.dbf
  151. contents of Memory Script:
  152. {
  153. set until scn  1471172;
  154. recover
  155. clone database
  156. delete archivelog
  157. ;
  158. }
  159. executing Memory Script
  160. executing command: SET until clause
  161. Starting recover at 24-MAR-16
  162. allocated channel: ORA_AUX_DISK_1
  163. channel ORA_AUX_DISK_1: SID=18 device type=DISK
  164. starting media recovery
  165. archived log for thread 1 with sequence 32 is already on disk as file /u01/app/oracle/product/11.2.0/db_1/dbs/arch1_32_893265808.dbf
  166. archived log file name=/u01/app/oracle/product/11.2.0/db_1/dbs/arch1_32_893265808.dbf thread=1 sequence=32
  167. media recovery complete, elapsed time: 00:00:05
  168. Finished recover at 24-MAR-16
  169. Oracle instance started
  170. Total System Global Area     321507328 bytes
  171. Fixed Size                     2228024 bytes
  172. Variable Size                234881224 bytes
  173. Database Buffers              79691776 bytes
  174. Redo Buffers                   4706304 bytes
  175. contents of Memory Script:
  176. {
  177. sql clone "alter system set  db_name =
  178. ‘‘TEST1‘‘ comment=
  179. ‘‘Reset to original value by RMAN‘‘ scope=spfile";
  180. sql clone "alter system reset  db_unique_name scope=spfile";
  181. shutdown clone immediate;
  182. startup clone nomount;
  183. }
  184. executing Memory Script
  185. sql statement: alter system set  db_name =  ‘‘TEST1‘‘ comment= ‘‘Reset to original value by RMAN‘‘ scope=spfile
  186. sql statement: alter system reset  db_unique_name scope=spfile
  187. Oracle instance shut down
  188. connected to auxiliary database (not started)
  189. Oracle instance started
  190. Total System Global Area     321507328 bytes
  191. Fixed Size                     2228024 bytes
  192. Variable Size                234881224 bytes
  193. Database Buffers              79691776 bytes
  194. Redo Buffers                   4706304 bytes
  195. sql statement: CREATE CONTROLFILE REUSE SET DATABASE "TEST1" RESETLOGS ARCHIVELOG
  196. MAXLOGFILES     16
  197. MAXLOGMEMBERS      3
  198. MAXDATAFILES      100
  199. MAXINSTANCES     8
  200. MAXLOGHISTORY      292
  201. LOGFILE
  202. GROUP   1 ( ‘/dsk3/test1/logs/‘‘redo01.log‘ ) SIZE 50 M  REUSE,
  203. GROUP   2 ( ‘/dsk3/test1/logs/‘‘redo02.log‘ ) SIZE 50 M  REUSE,
  204. GROUP   3 ( ‘/dsk3/test1/logs/‘‘redo03.log‘ ) SIZE 50 M  REUSE
  205. DATAFILE
  206. ‘/dsk3/test1/oradata/system01.dbf‘
  207. CHARACTER SET ZHS16GBK
  208. contents of Memory Script:
  209. {
  210. set newname for tempfile  1 to
  211. "/dsk3/test1/oradata/temp01.dbf";
  212. switch clone tempfile all;
  213. catalog clone datafilecopy  "/dsk3/test1/oradata/sysaux01.dbf",
  214. "/dsk3/test1/oradata/undotbs01.dbf",
  215. "/dsk3/test1/oradata/users01.dbf",
  216. "/dsk3/test1/oradata/example01.dbf",
  217. "/dsk3/test1/oradata/test1.dbf";
  218. switch clone datafile all;
  219. }
  220. executing Memory Script
  221. executing command: SET NEWNAME
  222. renamed tempfile 1 to /dsk3/test1/oradata/temp01.dbf in control file
  223. cataloged datafile copy
  224. datafile copy file name=/dsk3/test1/oradata/sysaux01.dbf RECID=1 STAMP=907351727
  225. cataloged datafile copy
  226. datafile copy file name=/dsk3/test1/oradata/undotbs01.dbf RECID=2 STAMP=907351728
  227. cataloged datafile copy
  228. datafile copy file name=/dsk3/test1/oradata/users01.dbf RECID=3 STAMP=907351728
  229. cataloged datafile copy
  230. datafile copy file name=/dsk3/test1/oradata/example01.dbf RECID=4 STAMP=907351728
  231. cataloged datafile copy
  232. datafile copy file name=/dsk3/test1/oradata/test1.dbf RECID=5 STAMP=907351729
  233. datafile 2 switched to datafile copy
  234. input datafile copy RECID=1 STAMP=907351727 file name=/dsk3/test1/oradata/sysaux01.dbf
  235. datafile 3 switched to datafile copy
  236. input datafile copy RECID=2 STAMP=907351728 file name=/dsk3/test1/oradata/undotbs01.dbf
  237. datafile 4 switched to datafile copy
  238. input datafile copy RECID=3 STAMP=907351728 file name=/dsk3/test1/oradata/users01.dbf
  239. datafile 5 switched to datafile copy
  240. input datafile copy RECID=4 STAMP=907351728 file name=/dsk3/test1/oradata/example01.dbf
  241. datafile 6 switched to datafile copy
  242. input datafile copy RECID=5 STAMP=907351729 file name=/dsk3/test1/oradata/test1.dbf
  243. Reenabling controlfile options for auxiliary database
  244. Executing: alter database enable block change tracking using file ‘/dsk4/backup/block.trc‘
  245. ORACLE error from auxiliary database: ORA-19751: could not create the change tracking file
  246. ORA-19750: change tracking file: ‘/dsk4/backup/block.trc‘
  247. ORA-27038: created file already exists
  248. Additional information: 1
  249. Ignoring error, reattempt command after duplicate finishes
  250. contents of Memory Script:
  251. {
  252. Alter clone database open resetlogs;
  253. }
  254. executing Memory Script
  255. database opened
  256. Finished Duplicate Db at 24-MAR-16

五、验证克隆

[html] view plain copy

print?

  1. Connected to:
  2. Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
  3. With the Partitioning, OLAP, Data Mining and Real Application Testing options
  4. 18:28:57 [email protected] test1>select status from v$instance;
  5. STATUS
  6. ------------
  7. OPEN
  8. 18:29:06 [email protected] test1>select name from v$datafile;
  9. NAME
  10. ------------------------------------------------------------------------------------------------------------------------
  11. /dsk3/test1/oradata/system01.dbf
  12. /dsk3/test1/oradata/sysaux01.dbf
  13. /dsk3/test1/oradata/undotbs01.dbf
  14. /dsk3/test1/oradata/users01.dbf
  15. /dsk3/test1/oradata/example01.dbf
  16. /dsk3/test1/oradata/test1.dbf
  17. 6 rows selected.
  18. 18:29:13 [email protected] test1>select member from v$logfile;
  19. MEMBER
  20. ------------------------------------------------------------------------------------------------------------------------
  21. /dsk3/test1/logs/redo03.log
  22. /dsk3/test1/logs/redo02.log
  23. /dsk3/test1/logs/redo01.log
  24. 18:30:19 [email protected] test1>show parameter control
  25. NAME                                 TYPE        VALUE
  26. ------------------------------------ ----------- ------------------------------
  27. control_files                        string      /dsk3/test1/oradata/control01.ctl  <span style="font-family: 宋体, Arial; background-color: rgb(255, 255, 255);">       </span>

-------- 至此,数据库克隆成功 !                                     

 转:http://blog.csdn.net/lqx0405/article/details/50976979

时间: 2024-11-13 23:03:53

-Oracle 11gR2通过RMAN克隆数据库的相关文章

Oracle Study之--Oracle 11gR2通过RMAN克隆数据库

Oracle Study之--Oracle 11gR2通过RMAN克隆数据库 Purpose of Database Duplication A duplicate database is useful for a variety of purposes, most of which involve testing. You can perform the following tasks in a duplicate database: Test backup and recovery proc

Oracle 11gR2 使用RMAN Duplicate复制数据库

Oracle 11gR2 使用RMAN Duplicate复制数据库  作者:吴伟龙 PrudentWoo QQ:286507175    前言:     上周刚做完一个项目,用户要求RAC的数据库能够自动备份到另外一个单节点上,单节点能够正常拿起来就能用.当时跟他们讨论的是用ADG来做,但通过描述后,用户觉得如果要人工干预的话太麻烦,它不想做任何的人工干预,实现数据自动到这台单机上来,那只是一台备用的数据库,没事的时候可以登录上去看看历史的数据情况. 这个时候我提出了11g的RMAN Dupl

Oracle 11g 使用RMAN备份数据库

使用Oracle自带的备份恢复工具RMAN(Recovery Manager)具有以下几种优势: 支持增量备份 能自动管理备份文件 自动化备份与恢复 备份的文件有效性检查 配置快闪恢复区(flash recovery area) 快闪恢复区是存储备份和恢复数据文件以及相关信息的存储区.需要设置两个参数:db_recovery_file_dest_size(快闪恢复区的最大容量),db_recovery_file_dest(快闪恢复区所在的路径). 查看快闪恢复区信息: SQL> show par

Oracle 11gR2使用RMAN duplicate复制数据库

11g的RMAN duplicate 个人感觉比10g的先进了很多,10g需在rman备份的基础上进行复制,使用RMAN duplicate创建一个数据完全相同但DBID不同的数据库.而11g的RMAN duplicate 可通过Active database duplicate和Backup-based duplicate两种方法实现.Active database duplicate方式不需要先把目标数据库进行rman备份,只要目标数据库处于归档模式下即可直接通过网络对数据库进行copy,且

通过RMAN克隆数据库(基于备份)

  SQL> show parameter name;   NAME                                     TYPE        VALUE ------------------------------------ ----------------------------------------- db_file_name_convert                     string db_name                           

示例在同一台机器上RMAN克隆数据库

1.查看主库ZDJS并使用RMAM进行备份 [[email protected] ~]$ sqlplus '/as sysdba' SQL*Plus: Release 10.2.0.1.0 - Production on Wed Jan 14 14:13:14 2015 Copyright (c) 1982, 2005, Oracle. All rights reserved. Connected to an idle instance. SQL> startup ORACLE instance

Oracle 11gR2 RAC 新特性说明

最近接触了一下Oracle 11g R2 的RAC,发现变化很大. 所以在自己动手做实验之前还是先研究下它的新特性比较好. 一.    官网介绍 先看一下Oracle 的官网文档里对RAC 新特性的一点说明. Oracle Database 11g Release 2 (11.2.0.2) New Features in Oracle RAC http://download.oracle.com/docs/cd/E11882_01/rac.112/e16795/whatsnew.htm#CHDJ

Oracle 11gR2用gpnp profile存放ASM的spfile路径

从Oracle 11gR2开始,GI集成了ASM,OCR/VOTEDISK也存放在ASM磁盘组了(11gR2以前需要存放于裸设备中),同时ASM的功能较10g也有很大增强. 我们先引入一个问题:11gR2中,OCR/VOTEDISK存放在ASM磁盘组,这也就意味着在GI能够启动的前提是能够顺利启动ASM实例并且能够将相应磁盘组MOUNT起来:而ASM的spfile却放在ASM磁盘组里,这也同样意味着要先启动ASM实例并且能读到参数文件.那如何解决这个问题呢? 11gR2中引入了pgnp prof

Oracle Study之案例--重建数据库控制文件

Oracle Study之案例--重建数据库控制文件 系统环境: 操作系统: Linux RH6 数据库:   Oracle 11gR2    案例分析:           数据库中所有的控制文件被意外破坏,非归档的库,在有trace备份的情况下,重建控制文件. 1.控制文件trace脚本 [[email protected] ~]$ cat crctr.sql  CREATE CONTROLFILE REUSE DATABASE "TEST3" NORESETLOGS  NOARC