Use the Duplicate function of RMAN to create a physical partition uard

Source: Internet
Author: User

If the directory on the master and backup is different, add the files in the pfile file on both ends. If the directory is the same, add the following files:

*. Log_file_name_convert = '/u01/oradata/orcl/', '/u02/oradata/orcl /'

*. Db_file_name_convert = '/u01/oradata/orcl/', '/u02/oradata/orcl /'

  1. -- Generate a full backup on the master end, including archiving logs and standby Control Files
  2. [Oracle @ source bak] rman target/
  3. Recovery Manager: Release 10.2.0.1.0-Production on Thursday April 26 23:22:58 2012
  4. Copyright (c) 1982,200 5, Oracle. All rights reserved.
  5. Connected to target database: ORCL (DBID = 1309351439)
  6. RMAN> run {
  7. Backup FORMAT '/home/oracle/bak/orcl _ % U _ % t'
  8. Database
  9. Include current controlfile for standby
  10. Plus archivelog
  11. ;
  12. } 2> 3> 4> 5> 6> 7>
  13. -- Copy the full backup to the backup
  14. [Oracle @ source bak] $ scp * 192.168.1.103: // home/oracle/bak
  15. -- Start pfile to nomount on the slave end and create a spfile;
  16. [Oracle @ target dbs] $ sqlplus/as sysdba
  17. SQL * Plus: Release 10.2.0.1.0-Production on Friday April 27 23:07:28 2012
  18. Copyright (c) 1982,200 5, Oracle. All rights reserved.
  19. Connected to an idle instance.
  20. SQL> startup pfile = initorcl. ora nomount;
  21. ORACLE instance started.
  22. Total System Global Area 276824064 bytes
  23. Fixed Size 2020160 bytes
  24. Variable Size 96472256 bytes
  25. Database Buffers 176160768 bytes
  26. Redo Buffers 2170880 bytes
  27. SQL> create spfile from pfile = 'initorcl. ora ';
  28. File created.
  29. -- Create dg using RMAN Duplicate on the master end. If the directory of the data file is the same as that of the redo log file, add nofilenamecheck. Otherwise, no need to add
  30. [Oracle @ source bak] $ rmant an target/
  31. Recovery Manager: Release 10.2.0.1.0-Production on 4 27 23:08:23 2012
  32. Copyright (c) 1982,200 5, Oracle. All rights reserved.
  33. Connected to target database: ORCL (DBID = 1309351439)
  34. RMAN> connect auxiliary sys/oracle @ orcl_st
  35. Connected to auxiliary database: ORCL (not mounted)
  36. RMAN> run {
  37. Duplicate target database
  38. For standby nofilenamecheck dorecover;
  39. } 2> 3> 4>
  40. Starting Duplicate Db at 2012-04-27 23:08:45
  41. Using target database control file instead of recovery catalog
  42. Allocated channel: ORA_AUX_DISK_1
  43. Channel ORA_AUX_DISK_1: sid = 155 devtype = DISK
  44. Contents of Memory Script:
  45. {
  46. Set until scn 611334;
  47. Restore clone standby controlfile;
  48. SQL clone 'alter database mount standby database ';
  49. }
  50. Executing Memory Script
  51. Executing command: SET until clause
  52. Starting restore at 2012-04-27 23:08:45
  53. Using channel ORA_AUX_DISK_1
  54. Channel ORA_AUX_DISK_1: starting datafile backupset restore
  55. Channel ORA_AUX_DISK_1: restoring control file
  56. Channel ORA_AUX_DISK_1: reading from backup piece/home/oracle/bak/orcl_0cn9gs8i_1_1_20120427
  57. Channel ORA_AUX_DISK_1: restored backup piece 1
  58. Piece handle =/home/oracle/bak/orcl_0cn9gs8i_1_1_20427 tag = TAG20120427T223632
  59. Channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
  60. Output filename =/home/oracle/oradata/orcl/control01.ctl
  61. Output filename =/home/oracle/oradata/orcl/control02.ctl
  62. Output filename =/home/oracle/oradata/orcl/control03.ctl
  63. Finished restore at 23:08:47
  64. SQL statement: alter database mount standby database
  65. Released channel: ORA_AUX_DISK_1
  66. Contents of Memory Script:
  67. {
  68. Set until scn 611334;
  69. Set newname for tempfile 1
  70. "/Home/oracle/oradata/orcl/temp01.dbf ";
  71. Switch clone tempfile all;
  72. Set newname for datafile 1
  73. "/Home/oracle/oradata/orcl/system01.dbf ";
  74. Set newname for datafile 2
  75. "/Home/oracle/oradata/orcl/undotbs01.dbf ";
  76. Set newname for datafile 3
  77. "/Home/oracle/oradata/orcl/sysaux01.dbf ";
  78. Set newname for datafile 4
  79. "/Home/oracle/oradata/orcl/users01.dbf ";
  80. Restore
  81. Check readonly
  82. Clone database
  83. ;
  84. }
  85. Executing Memory Script
  86. Executing command: SET until clause
  87. Executing command: SET NEWNAME
  88. Renamed temporary file 1 to/home/oracle/oradata/orcl/temp01.dbf in control file
  89. Executing command: SET NEWNAME
  90. Executing command: SET NEWNAME
  91. Executing command: SET NEWNAME
  92. Executing command: SET NEWNAME
  93. Starting restore at 2012-04-27 23:08:53
  94. Allocated channel: ORA_AUX_DISK_1
  95. Channel ORA_AUX_DISK_1: sid = 155 devtype = DISK
  96. Channel ORA_AUX_DISK_1: starting datafile backupset restore
  97. Channel ORA_AUX_DISK_1: specifying datafile (s) to restore from backup set
  98. Restoring datafile 00001 to/home/oracle/oradata/orcl/system01.dbf
  99. Restoring datafile 00002 to/home/oracle/oradata/orcl/undotbs01.dbf
  100. Restoring datafile 00003 to/home/oracle/oradata/orcl/sysaux01.dbf
  101. Restoring datafile 00004 to/home/oracle/oradata/orcl/users01.dbf
  102. Channel ORA_AUX_DISK_1: reading from backup piece/home/oracle/bak/orcl_0bn9gs3g_1_1_20120427
  103. Channel ORA_AUX_DISK_1: restored backup piece 1
  104. Piece handle =/home/oracle/bak/orcl_0bn9gs3g_0000000020120427 tag = TAG20120427T223632
  105. Channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:01:15
  106. Finished restore at 23:10:10
  107. Contents of Memory Script:
  108. {
  109. Switch clone datafile all;
  110. }
  111. Executing Memory Script
  112. Datafile 1 switched to datafile copy
  113. Input datafile copy recid = 5 stamp = 781744210 filename =/home/oracle/oradata/orcl/system01.dbf
  114. Datafile 2 switched to datafile copy
  115. Input datafile copy recid = 6 stamp = 781744210 filename =/home/oracle/oradata/orcl/undotbs01.dbf
  116. Datafile 3 switched to datafile copy
  117. Input datafile copy recid = 7 stamp = 781744210 filename =/home/oracle/oradata/orcl/sysaux01.dbf
  118. Datafile 4 switched to datafile copy
  119. Input datafile copy recid = 8 stamp = 781744210 filename =/home/oracle/oradata/orcl/users01.dbf
  120. Contents of Memory Script:
  121. {
  122. Set until scn 611334;
  123. Recover
  124. Standby
  125. Clone database
  126. Delete archivelog
  127. ;
  128. }
  129. Executing Memory Script
  130. Executing command: SET until clause
  131. Starting recover at 23:10:10
  132. Using channel ORA_AUX_DISK_1
  133. Starting media recovery
  134. Archive log thread 1 sequence 13 is already on disk as file/home/oracle/archive/1_13_781570707.dbf
  135. Archive log filename =/home/oracle/archive/1_13_781570707.dbf thread = 1 sequence = 13
  136. Media recovery complete, elapsed time: 00:00:02
  137. Finished recover at 23:10:14
  138. Finished Duplicate Db at 23:10:14

After completion, the slave database starts to the mount state, and then verifies the DG.

For more information about Oracle, see Oracle topics page http://www.bkjia.com/topicnews.aspx? Tid = 12

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.