ITPub博客

首页 > Linux操作系统 > Linux操作系统 > RMAN backup-based duplicate分析

RMAN backup-based duplicate分析

原创 Linux操作系统 作者:Jack_Miller 时间:2012-07-12 21:20:57 0 删除 编辑
RMAN duplicate database有两种方式,一种是backup-based(默认),一种是from active database。
RMAN duplicate数据库命令很简单,不过要prepare一些东西,但是RMAN的duplicate命令具体做了那些事情呢?今天测试了一下,具体prepare过程网上有很多资料了。这里只是把duplicate的执行过程贴出来了,留待明天分析!!

RMAN> duplicate target database to "test";

Starting Duplicate Db at 11-JUL-12
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=17 device type=DISK
allocated channel: ORA_AUX_DISK_2
channel ORA_AUX_DISK_2: SID=20 device type=DISK

contents of Memory Script.:
{
   sql clone "create spfile from memory";
}
executing Memory Script

sql statement: create spfile from memory

contents of Memory Script.:
{
   shutdown clone immediate;
   startup clone nomount;
}
executing Memory Script

Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area     464519168 bytes

Fixed Size                     1337240 bytes
Variable Size                289409128 bytes
Database Buffers             167772160 bytes
Redo Buffers                   6000640 bytes

contents of Memory Script.:
{
   sql clone "alter system set  db_name = 
 ''JOYCE'' comment=
 ''Modified by RMAN duplicate'' scope=spfile";
   sql clone "alter system set  db_unique_name = 
 ''TEST'' comment=
 ''Modified by RMAN duplicate'' scope=spfile";
   shutdown clone immediate;
   startup clone force nomount
   restore clone primary controlfile;
   alter clone database mount;
}
executing Memory Script

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

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

Oracle instance shut down

Oracle instance started

Total System Global Area     464519168 bytes

Fixed Size                     1337240 bytes
Variable Size                289409128 bytes
Database Buffers             167772160 bytes
Redo Buffers                   6000640 bytes

Starting restore at 11-JUL-12
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=19 device type=DISK
allocated channel: ORA_AUX_DISK_2
channel ORA_AUX_DISK_2: SID=20 device type=DISK

channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: reading from backup piece /mnt/sdb1/flash_recovery_area/JOYCE/autobackup/2012_07_11/o1_mf_s_788346243_7ztyg3tr_.bkp
channel ORA_AUX_DISK_1: piece handle=/mnt/sdb1/flash_recovery_area/JOYCE/autobackup/2012_07_11/o1_mf_s_788346243_7ztyg3tr_.bkp tag=TAG20120711T090403
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:02
output file name=/u01/app/mengliu/oradata/test/control01.ctl
Finished restore at 11-JUL-12

database mounted

contents of Memory Script.:
{
   set until scn  934838;
   set newname for datafile  1 to 
 "/u01/app/mengliu/oradata/test/system01.dbf";
   set newname for datafile  2 to 
 "/u01/app/mengliu/oradata/test/sysaux01.dbf";
   set newname for datafile  3 to 
 "/u01/app/mengliu/oradata/test/undotbs01.dbf";
   set newname for datafile  4 to 
 "/u01/app/mengliu/oradata/test/users01.dbf";
   set newname for datafile  5 to 
 "/u01/app/mengliu/oradata/test/example01.dbf";
   restore
   clone database
   ;
}
executing Memory Script

executing command: SET until clause

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 11-JUL-12
using channel ORA_AUX_DISK_1
using channel ORA_AUX_DISK_2

channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00001 to /u01/app/mengliu/oradata/test/system01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00004 to /u01/app/mengliu/oradata/test/users01.dbf
channel ORA_AUX_DISK_1: reading from backup piece /mnt/sdb1/flash_recovery_area/JOYCE/backupset/2012_07_11/o1_mf_nnndf_FULL_BACKUP_0711_7zty9hs7_.bkp
channel ORA_AUX_DISK_2: starting datafile backup set restore
channel ORA_AUX_DISK_2: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_2: restoring datafile 00002 to /u01/app/mengliu/oradata/test/sysaux01.dbf
channel ORA_AUX_DISK_2: restoring datafile 00003 to /u01/app/mengliu/oradata/test/undotbs01.dbf
channel ORA_AUX_DISK_2: restoring datafile 00005 to /u01/app/mengliu/oradata/test/example01.dbf
channel ORA_AUX_DISK_2: reading from backup piece /mnt/sdb1/flash_recovery_area/JOYCE/backupset/2012_07_11/o1_mf_nnndf_FULL_BACKUP_0711_7zty9hvm_.bkp
channel ORA_AUX_DISK_2: piece handle=/mnt/sdb1/flash_recovery_area/JOYCE/backupset/2012_07_11/o1_mf_nnndf_FULL_BACKUP_0711_7zty9hvm_.bkp tag=FULL_BACKUP_0711
channel ORA_AUX_DISK_2: restored backup piece 1
channel ORA_AUX_DISK_2: restore complete, elapsed time: 00:01:56
channel ORA_AUX_DISK_1: piece handle=/mnt/sdb1/flash_recovery_area/JOYCE/backupset/2012_07_11/o1_mf_nnndf_FULL_BACKUP_0711_7zty9hs7_.bkp tag=FULL_BACKUP_0711
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:02:17
Finished restore at 11-JUL-12

contents of Memory Script.:
{
   switch clone datafile all;
}
executing Memory Script

datafile 1 switched to datafile copy
input datafile copy RECID=12 STAMP=788346830 file name=/u01/app/mengliu/oradata/test/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=13 STAMP=788346830 file name=/u01/app/mengliu/oradata/test/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=14 STAMP=788346830 file name=/u01/app/mengliu/oradata/test/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=15 STAMP=788346830 file name=/u01/app/mengliu/oradata/test/users01.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=16 STAMP=788346830 file name=/u01/app/mengliu/oradata/test/example01.dbf

contents of Memory Script.:
{
   set until scn  934838;
   recover
   clone database
    delete archivelog
   ;
}
executing Memory Script

executing command: SET until clause

Starting recover at 11-JUL-12
using channel ORA_AUX_DISK_1
using channel ORA_AUX_DISK_2

starting media recovery

channel ORA_AUX_DISK_1: starting archived log restore to default destination
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=10
channel ORA_AUX_DISK_1: reading from backup piece /mnt/sdb1/flash_recovery_area/JOYCE/backupset/2012_07_11/o1_mf_annnn_TAG20120711T090345_7ztyflmt_.bkp
channel ORA_AUX_DISK_2: starting archived log restore to default destination
channel ORA_AUX_DISK_2: restoring archived log
archived log thread=1 sequence=11
channel ORA_AUX_DISK_2: reading from backup piece /mnt/sdb1/flash_recovery_area/JOYCE/backupset/2012_07_11/o1_mf_annnn_TAG20120711T090345_7ztyfy1k_.bkp
channel ORA_AUX_DISK_1: piece handle=/mnt/sdb1/flash_recovery_area/JOYCE/backupset/2012_07_11/o1_mf_annnn_TAG20120711T090345_7ztyflmt_.bkp tag=TAG20120711T090345
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=/u01/app/mengliu/archivelog/test/1_10_788081602.dbf thread=1 sequence=10
channel clone_default: deleting archived log(s)
archived log file name=/u01/app/mengliu/archivelog/test/1_10_788081602.dbf RECID=9 STAMP=788346834
channel ORA_AUX_DISK_2: piece handle=/mnt/sdb1/flash_recovery_area/JOYCE/backupset/2012_07_11/o1_mf_annnn_TAG20120711T090345_7ztyfy1k_.bkp tag=TAG20120711T090345
channel ORA_AUX_DISK_2: restored backup piece 1
channel ORA_AUX_DISK_2: restore complete, elapsed time: 00:00:02
archived log file name=/u01/app/mengliu/archivelog/test/1_11_788081602.dbf thread=1 sequence=11
channel clone_default: deleting archived log(s)
archived log file name=/u01/app/mengliu/archivelog/test/1_11_788081602.dbf RECID=8 STAMP=788346834
media recovery complete, elapsed time: 00:00:00
Finished recover at 11-JUL-12

contents of Memory Script.:
{
   shutdown clone immediate;
   startup clone nomount;
   sql clone "alter system set  db_name = 
 ''TEST'' comment=
 ''Reset to original value by RMAN'' scope=spfile";
   sql clone "alter system reset  db_unique_name scope=spfile";
   shutdown clone immediate;
   startup clone nomount;
}
executing Memory Script

database dismounted
Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area     464519168 bytes

Fixed Size                     1337240 bytes
Variable Size                289409128 bytes
Database Buffers             167772160 bytes
Redo Buffers                   6000640 bytes

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

sql statement: alter system reset  db_unique_name scope=spfile

Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area     464519168 bytes

Fixed Size                     1337240 bytes
Variable Size                289409128 bytes
Database Buffers             167772160 bytes
Redo Buffers                   6000640 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "TEST" RESETLOGS ARCHIVELOG 
  MAXLOGFILES     16
  MAXLOGMEMBERS      3
  MAXDATAFILES      100
  MAXINSTANCES     8
  MAXLOGHISTORY      292
 LOGFILE
  GROUP  1 ( '/u01/app/mengliu/oradata/test/redo01.log' ) SIZE 50 M  REUSE,
  GROUP  2 ( '/u01/app/mengliu/oradata/test/redo02.log' ) SIZE 50 M  REUSE,
  GROUP  3 ( '/u01/app/mengliu/oradata/test/redo03.log' ) SIZE 50 M  REUSE
 DATAFILE
  '/u01/app/mengliu/oradata/test/system01.dbf'
 CHARACTER SET AL32UTF8


contents of Memory Script.:
{
   set newname for tempfile  1 to 
 "/u01/app/mengliu/oradata/test/temp01.dbf";
   switch clone tempfile all;
   catalog clone datafilecopy  "/u01/app/mengliu/oradata/test/sysaux01.dbf", 
 "/u01/app/mengliu/oradata/test/undotbs01.dbf", 
 "/u01/app/mengliu/oradata/test/users01.dbf", 
 "/u01/app/mengliu/oradata/test/example01.dbf";
   switch clone datafile all;
}
executing Memory Script

executing command: SET NEWNAME

renamed tempfile 1 to /u01/app/mengliu/oradata/test/temp01.dbf in control file

cataloged datafile copy
datafile copy file name=/u01/app/mengliu/oradata/test/sysaux01.dbf RECID=1 STAMP=788346862
cataloged datafile copy
datafile copy file name=/u01/app/mengliu/oradata/test/undotbs01.dbf RECID=2 STAMP=788346862
cataloged datafile copy
datafile copy file name=/u01/app/mengliu/oradata/test/users01.dbf RECID=3 STAMP=788346862
cataloged datafile copy
datafile copy file name=/u01/app/mengliu/oradata/test/example01.dbf RECID=4 STAMP=788346862

datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=788346862 file name=/u01/app/mengliu/oradata/test/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=788346862 file name=/u01/app/mengliu/oradata/test/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=788346862 file name=/u01/app/mengliu/oradata/test/users01.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=4 STAMP=788346862 file name=/u01/app/mengliu/oradata/test/example01.dbf

contents of Memory Script.:
{
   Alter clone database open resetlogs;
}
executing Memory Script

database opened
Finished Duplicate Db at 11-JUL-12

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/25791987/viewspace-735340/,如需转载,请注明出处,否则将追究法律责任。

上一篇: 微软 面经
请登录后发表评论 登录
全部评论

注册时间:2011-12-09

  • 博文量
    25
  • 访问量
    68393