在sun t2000上两台主机间利用oracle10g rman_duplicate复制数据库

1,duplicate db不同于standby db(dg)
2,要复制一个db,必须通过rman以nomount 连接到target(primary)db和auxiliary db
3,在auxilary db上开启至少一个辅助通道(channel),复制工作主要通过辅助通道实行
4,为duplicate db生成一个新的dbid
5, 相同的dbid不能注册在同一个recovery catalog db中,要注册,须用dbnewid
6,duplicate db时,可以用rman skipp readonly or offline tablespace
SQL> select name,status,enabled from v$datafile;--status,enabled,

NAME
--------------------------------------------------------------------------------
STATUS  ENABLED
------- ----------
/oracle/oradata/ora10g/system01.dbf
SYSTEM  READ WRITE

/oracle/oradata/ora10g/undotbs01.dbf
ONLINE  READ WRITE

/oracle/oradata/ora10g/sysaux01.dbf
ONLINE  READ WRITE


NAME
--------------------------------------------------------------------------------
STATUS  ENABLED
------- ----------
/oracle/oradata/ora10g/users01.dbf
ONLINE  READ WRITE

+MIGRATION_DATA/ora10g/datafile/zxy.258.704104663
OFFLINE DISABLED


SQL>



实施duplicate过程 (此适用于oracle10g,两机相同目录结构,目录是指data file,control file,tempfile,redo file)

1,构建一个用于辅助实例的密码文件
  在target db上面吧(hostname:capitek1)
  su - oracle
2,根据target db的spfile,创建出对应的pfile(用于duplicate上面的auxiliary instance spfile)
SQL> create pfile='/orainstall/target.ora' from spfile;

File created.


-bash-3.00$ vi target.ora
"target.ora" 29 行,1043 字符
dup.__db_cache_size=4160749568
dup.__java_pool_size=16777216
dup.__large_pool_size=16777216
dup.__shared_pool_size=872415232
dup.__streams_pool_size=0
*.audit_file_dest='/orainstall/admin/dup/adump'
*.background_dump_dest='/orainstall/admin/dup/bdump'
*.compatible='10.2.0.1.0'
*.control_files='/orainstall/oradata/dup/control01.ctl','/orainstall/oradata/dup/control02.ctl','/orainstall/oradata/dup/cont
rol03.ctl'
*.core_dump_dest='/orainstall/admin/dup/cdump'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='dup'
*.db_recovery_file_dest='/orainstall/flash_recovery_area'
*.db_recovery_file_dest_size=2147483648
*.dispatchers='(PROTOCOL=TCP) (SERVICE=dupXDB)'
*.job_queue_processes=10
*.log_archive_format='%t_%s_%r.dbf'
*.nls_language='SIMPLIFIED CHINESE'
*.nls_territory='CHINA'
*.open_cursors=300
*.pga_aggregate_target=1693450240
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=5081399296
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/orainstall/admin/dup/udump'
control_files=('/orainstall/oradata/dup/control01.ctl','/orainstall/oradata/dup/control02.ctl','/orainstall/oradata/dup/cont
rol03.ctl')
db_file_name_convert=(/orainstall/oradata/target/,/orainstall/oradata/dup/)
log_file_name_convert=(/orainstall/oradata/target/,/orainstall/oradata/dup/)
~

3,根据target db的pfile创建对应的目录
-bash-3.00$ mkdir -p /orainstall/admin/dup/adump
-bash-3.00$ mkdir -p /orainstall/admin/dup/bdump
-bash-3.00$ mkdir -p /orainstall/oradata/dup
-bash-3.00$ mkdir -p /orainstall/admin/dup/cdump
-bash-3.00$ mkdir -p /orainstall/flash_recovery_area
-bash-3.00$ mkdir -p /orainstall/admin/dup/udump
-bash-3.00$ cd $ORACLE_HOME
-bash-3.00$ pwd
/orainstall/oracle/product/10.2.0/db_1
-bash-3.00$ hostname
capitek2

4,以oracle身份在target和duplicate库上面构建存储rman备份的目录
mkdir -p /orainstall/rmanbak


5,在target上面利用rman对库进行一个全备
-bash-3.00$ rman target /

Recovery Manager: Release 10.2.0.1.0 - Production on Sun Nov 29 20:23:03 2009

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

connected to target database: TARGET (DBID=3106171664)

RMAN> backup as copy incremental level 0 database format '/orainstall/rmanbak/%Ubak' tag 'test duplicate db';

Starting backup at 29-NOV-09
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=151 devtype=DISK
channel ORA_DISK_1: starting datafile copy
input datafile fno=00001 name=/orainstall/oradata/target/system01.dbf
output filename=/orainstall/rmanbak/data_D-TARGET_I-3106171664_TS-SYSTEM_FNO-1_01kvjfvabak tag=TEST DUPLICATE DB recid=1 stamp=704233466
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting datafile copy
input datafile fno=00003 name=/orainstall/oradata/target/sysaux01.dbf
output filename=/orainstall/rmanbak/data_D-TARGET_I-3106171664_TS-SYSAUX_FNO-3_02kvjg03bak tag=TEST DUPLICATE DB recid=2 stamp=704233483
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile fno=00002 name=/orainstall/oradata/target/undotbs01.dbf
output filename=/orainstall/rmanbak/data_D-TARGET_I-3106171664_TS-UNDOTBS1_FNO-2_03kvjg0jbak tag=TEST DUPLICATE DB recid=3 stamp=704233492
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting datafile copy
input datafile fno=00004 name=/orainstall/oradata/target/users01.dbf
output filename=/orainstall/rmanbak/data_D-TARGET_I-3106171664_TS-USERS_FNO-4_04kvjg0nbak tag=TEST DUPLICATE DB recid=4 stamp=704233495
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting datafile copy
copying current control file
output filename=/orainstall/rmanbak/cf_D-TARGET_id-3106171664_05kvjg0obak tag=TEST DUPLICATE DB recid=5 stamp=704233497
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting incremental level 0 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current SPFILE in backupset
channel ORA_DISK_1: starting piece 1 at 29-NOV-09
channel ORA_DISK_1: finished piece 1 at 29-NOV-09
piece handle=/orainstall/rmanbak/06kvjg0q_1_1bak tag=TEST DUPLICATE DB comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 29-NOV-09

RMAN> sql 'alter system archive log current';

6,根据target库的密码文件相关信息,在duplicate库上面构建对应的密码文件
target

-bash-3.00$ cd $ORACLE_HOME/dbs
-bash-3.00$ ls
ab_+ASM1.dat      hc_target.dat     init.ora          lkTARGET          orapwtarget       spfiletarget.ora
hc_+ASM1.dat      init+ASM1.ora     initdw.ora        orapw+ASM1        snapcf_target.f

duplicate
-bash-3.00$ cd $ORACLE_HOME/dbs
-bash-3.00$ ls -l orapwtarget

-bash-3.00$ orapwd file=./orapwtarget password=system entries=10 force=y

7,通过rcp把target库的pfile(通过target的spfile构建)传到duplicate对应的目录下

-bash-3.00$ rcp ./target.ora  oracle@capitek2:/orainstall

8,同上利用rcp把target作的rman全备及归档日志传到duplicate库对应目录下

target

-bash-3.00$ pwd
/orainstall/rmanbak
-bash-3.00$ rcp ./* oracle@capitek2:/orainstall/rmanbak
-bash-3.00$ tar cvf x.tar flash_recovery_area/
a flash_recovery_area// 0K
a flash_recovery_area//TARGET/ 0K
a flash_recovery_area//TARGET/onlinelog/ 0K
a flash_recovery_area//TARGET/archivelog/ 0K
a flash_recovery_area//TARGET/archivelog/2009_11_29/ 0K
a flash_recovery_area//TARGET/archivelog/2009_11_29/o1_mf_1_3_5k4z49ql_.arc 48K

-bash-3.00$ rcp x.tar  oracle@capitek2:/orainstall
-bash-3.00$


duplicate

tar xvf x.tar

9,在target和duplicate,利用netca构建监听器及相关的net服务名(duplicate上net服务名为aux),target上net服务名为target
  (note:在每个节点构建两个net服务名),并用tnsping测试互通性
10,在duplicate上以nomount状态启动auxiliary instance
-bash-3.00$ export ORACLE_SID=aux
-bash-3.00$ sqlplus '/as sysdba'

SQL*Plus: Release 10.2.0.1.0 - Production on Sun Nov 29 20:51:27 2009

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup nomount pfile=/orainstall/target.ora
ORACLE instance started.

Total System Global Area 5083496448 bytes
Fixed Size                  1985656 bytes
Variable Size             905974664 bytes
Database Buffers         4160749568 bytes
Redo Buffers               14786560 bytes
SQL>

(注:---最好对辅助实例构建spfile.因为duplicate动作时,要重启库,所以要是用pfile,会提示找不到相关的文件,还是spfile省时,让oracle自己找)
-bash-3.00$ sqlplus '/as sysdba'

SQL*Plus: Release 10.2.0.1.0 - Production on Sun Nov 29 22:10:50 2009

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup nomount pfile='/orainstall/oracle/product/10.2.0/db_1/dbs/initaux.ora';
ORACLE instance started.

Total System Global Area 5083496448 bytes
Fixed Size                  1985656 bytes
Variable Size             905974664 bytes
Database Buffers         4160749568 bytes
Redo Buffers               14786560 bytes
SQL> create spfile from pfile='/orainstall/oracle/product/10.2.0/db_1/dbs/initaux.ora';

File created.
)

11,在duplicate上利用rman迁移复制库出错
-bash-3.00$ hostname
capitek2
export ORACLE_SID=aux
-bash-3.00$ rman target sys/system@target auxiliary sys/system

Recovery Manager: Release 10.2.0.1.0 - Production on Sun Nov 29 21:32:52 2009

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

connected to target database: TARGET (DBID=3106171664)
connected to auxiliary database: DUP (not mounted)

RMAN> run {
2> allocate auxiliary channel ch1 device type disk;
3> duplicate target database to dup;
4> }

using target database control file instead of recovery catalog
allocated channel: ch1
channel ch1: sid=153 devtype=DISK

Starting Duplicate Db at 29-NOV-09
released channel: ch1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 11/29/2009 21:33:36
ORA-01405: fetched column value is NULL

RMAN>

处理:
在target库上alter system switch logfile;

再次执行rman run块

RMAN> run {
2> allocate auxiliary channel ch1 device type disk;
3> duplicate target database to dup;
4> }

allocated channel: ch1
channel ch1: sid=153 devtype=DISK

Starting Duplicate Db at 29-NOV-09

contents of Memory Script.:
{
   set until scn  544150;
   set newname for datafile  1 to
 "/orainstall/oradata/dup/system01.dbf";
   set newname for datafile  2 to
 "/orainstall/oradata/dup/undotbs01.dbf";
   set newname for datafile  3 to
 "/orainstall/oradata/dup/sysaux01.dbf";
   set newname for datafile  4 to
 "/orainstall/oradata/dup/users01.dbf";
   restore
   check readonly
   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

Starting restore at 29-NOV-09

channel ch1: restoring datafile 00001
input datafile copy recid=1 stamp=704233466 filename=/orainstall/rmanbak/data_D-TARGET_I-3106171664_TS-SYSTEM_FNO-1_01kvjfvabak
destination for restore of datafile 00001: /orainstall/oradata/dup/system01.dbf
channel ch1: copied datafile copy of datafile 00001
output filename=/orainstall/oradata/dup/system01.dbf
channel ch1: restoring datafile 00002
input datafile copy recid=3 stamp=704233492 filename=/orainstall/rmanbak/data_D-TARGET_I-3106171664_TS-UNDOTBS1_FNO-2_03kvjg0jbak
destination for restore of datafile 00002: /orainstall/oradata/dup/undotbs01.dbf
channel ch1: copied datafile copy of datafile 00002
output filename=/orainstall/oradata/dup/undotbs01.dbf
channel ch1: restoring datafile 00003
input datafile copy recid=2 stamp=704233483 filename=/orainstall/rmanbak/data_D-TARGET_I-3106171664_TS-SYSAUX_FNO-3_02kvjg03bak
destination for restore of datafile 00003: /orainstall/oradata/dup/sysaux01.dbf
channel ch1: copied datafile copy of datafile 00003
output filename=/orainstall/oradata/dup/sysaux01.dbf
channel ch1: restoring datafile 00004
input datafile copy recid=4 stamp=704233495 filename=/orainstall/rmanbak/data_D-TARGET_I-3106171664_TS-USERS_FNO-4_04kvjg0nbak
destination for restore of datafile 00004: /orainstall/oradata/dup/users01.dbf
channel ch1: copied datafile copy of datafile 00004
output filename=/orainstall/oradata/dup/users01.dbf
Finished restore at 29-NOV-09
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "DUP" RESETLOGS ARCHIVELOG
  MAXLOGFILES     16
  MAXLOGMEMBERS      3
  MAXDATAFILES      100
  MAXINSTANCES     8
  MAXLOGHISTORY      292
 LOGFILE
  GROUP  1 ( '/orainstall/oradata/dup/redo01.log' ) SIZE 50 M  REUSE,
  GROUP  2 ( '/orainstall/oradata/dup/redo02.log' ) SIZE 50 M  REUSE,
  GROUP  3 ( '/orainstall/oradata/dup/redo03.log' ) SIZE 50 M  REUSE
 DATAFILE
  '/orainstall/oradata/dup/system01.dbf'
 CHARACTER SET ZHS16GBK


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

datafile 2 switched to datafile copy
input datafile copy recid=1 stamp=704237834 filename=/orainstall/oradata/dup/undotbs01.dbf
datafile 3 switched to datafile copy
input datafile copy recid=2 stamp=704237834 filename=/orainstall/oradata/dup/sysaux01.dbf
datafile 4 switched to datafile copy
input datafile copy recid=3 stamp=704237834 filename=/orainstall/oradata/dup/users01.dbf

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

executing command: SET until clause

Starting recover at 29-NOV-09

starting media recovery

Oracle Error:
ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01152: file 2 was not restored from a sufficiently old backup
ORA-01110: data file 2: '/orainstall/oradata/dup/undotbs01.dbf'

released channel: ch1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 11/29/2009 21:37:20
RMAN-03015: error occurred in stored script. Memory Script
RMAN-06053: unable to perform. media recovery because of missing log
RMAN-06025: no backup of log thread 1 seq 2 lowscn 530402 found to restore

RMAN>


还是出错


再次修正后,还是出错(重新备份全库及归档,传到duplicate)
-bash-3.00$ rman target sys/system@target auxiliary sys/system

Recovery Manager: Release 10.2.0.1.0 - Production on Sun Nov 29 21:59:31 2009

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

connected to target database: TARGET (DBID=3106171664)
connected to auxiliary database: DUP (not mounted)

RMAN> run {
2> allocate auxiliary channel ch1 device type disk;
3>  duplicate target database to dup;
4> }

using target database control file instead of recovery catalog
allocated channel: ch1
channel ch1: sid=153 devtype=DISK

Starting Duplicate Db at 29-NOV-09

contents of Memory Script.:
{
   set until scn  544558;
   set newname for datafile  1 to
 "/orainstall/oradata/dup/system01.dbf";
   set newname for datafile  2 to
 "/orainstall/oradata/dup/undotbs01.dbf";
   set newname for datafile  3 to
 "/orainstall/oradata/dup/sysaux01.dbf";
   set newname for datafile  4 to
 "/orainstall/oradata/dup/users01.dbf";
   restore
   check readonly
   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

Starting restore at 29-NOV-09

channel ch1: restoring datafile 00001
input datafile copy recid=6 stamp=704238671 filename=/orainstall/rmanbak/data_D-TARGET_I-3106171664_TS-SYSTEM_FNO-1_07kvjl1vbak
destination for restore of datafile 00001: /orainstall/oradata/dup/system01.dbf
channel ch1: copied datafile copy of datafile 00001
output filename=/orainstall/oradata/dup/system01.dbf
channel ch1: restoring datafile 00002
input datafile copy recid=8 stamp=704238697 filename=/orainstall/rmanbak/data_D-TARGET_I-3106171664_TS-UNDOTBS1_FNO-2_09kvjl38bak
destination for restore of datafile 00002: /orainstall/oradata/dup/undotbs01.dbf
channel ch1: copied datafile copy of datafile 00002
output filename=/orainstall/oradata/dup/undotbs01.dbf
channel ch1: restoring datafile 00003
input datafile copy recid=7 stamp=704238688 filename=/orainstall/rmanbak/data_D-TARGET_I-3106171664_TS-SYSAUX_FNO-3_08kvjl2pbak
destination for restore of datafile 00003: /orainstall/oradata/dup/sysaux01.dbf
channel ch1: copied datafile copy of datafile 00003
output filename=/orainstall/oradata/dup/sysaux01.dbf
channel ch1: restoring datafile 00004
input datafile copy recid=9 stamp=704238700 filename=/orainstall/rmanbak/data_D-TARGET_I-3106171664_TS-USERS_FNO-4_0akvjl3cbak
destination for restore of datafile 00004: /orainstall/oradata/dup/users01.dbf
channel ch1: copied datafile copy of datafile 00004
output filename=/orainstall/oradata/dup/users01.dbf
Finished restore at 29-NOV-09
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "DUP" RESETLOGS ARCHIVELOG
  MAXLOGFILES     16
  MAXLOGMEMBERS      3
  MAXDATAFILES      100
  MAXINSTANCES     8
  MAXLOGHISTORY      292
 LOGFILE
  GROUP  1 ( '/orainstall/oradata/dup/redo01.log' ) SIZE 50 M  REUSE,
  GROUP  2 ( '/orainstall/oradata/dup/redo02.log' ) SIZE 50 M  REUSE,
  GROUP  3 ( '/orainstall/oradata/dup/redo03.log' ) SIZE 50 M  REUSE
 DATAFILE
  '/orainstall/oradata/dup/system01.dbf'
 CHARACTER SET ZHS16GBK


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

datafile 2 switched to datafile copy
input datafile copy recid=1 stamp=704239294 filename=/orainstall/oradata/dup/undotbs01.dbf
datafile 3 switched to datafile copy
input datafile copy recid=2 stamp=704239294 filename=/orainstall/oradata/dup/sysaux01.dbf
datafile 4 switched to datafile copy
input datafile copy recid=3 stamp=704239294 filename=/orainstall/oradata/dup/users01.dbf

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

executing command: SET until clause

Starting recover at 29-NOV-09

starting media recovery

archive log thread 1 sequence 3 is already on disk as file /orainstall/flash_recovery_area/TARGET/archivelog/2009_11_29/o1_mf_1_3_5k4z49ql_.arc
archive log filename=/orainstall/flash_recovery_area/TARGET/archivelog/2009_11_29/o1_mf_1_3_5k4z49ql_.arc thread=1 sequence=3
media recovery complete, elapsed time: 00:00:03
Finished recover at 29-NOV-09

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

database dismounted
Oracle instance shut down

connected to auxiliary database (not started)
startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/orainstall/oracle/product/10.2.0/db_1/dbs/initaux.ora'

starting Oracle instance without parameter file for retrival of spfile
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 11/29/2009 22:03:13
RMAN-03015: error occurred in stored script. Memory Script
RMAN-04014: startup failed: ORA-04031: unable to allocate 4096 bytes of shared memory ("shared pool","unknown object","sga heap(1,0)","kglsim hash table bkts")

RMAN> exit





---再次经过修正后执行

RMAN> run {
2> allocate auxiliary channel ch1 device type disk;
3> duplicate target database to dup;
4> }

using target database control file instead of recovery catalog
allocated channel: ch1
channel ch1: sid=153 devtype=DISK

Starting Duplicate Db at 29-NOV-09

contents of Memory Script.:
{
   set until scn  544558;
   set newname for datafile  1 to
 "/orainstall/oradata/dup/system01.dbf";
   set newname for datafile  2 to
 "/orainstall/oradata/dup/undotbs01.dbf";
   set newname for datafile  3 to
 "/orainstall/oradata/dup/sysaux01.dbf";
   set newname for datafile  4 to
 "/orainstall/oradata/dup/users01.dbf";
   restore
   check readonly
   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

Starting restore at 29-NOV-09

channel ch1: restoring datafile 00001
input datafile copy recid=6 stamp=704238671 filename=/orainstall/rmanbak/data_D-TARGET_I-3106171664_TS-SYSTEM_FNO-1_07kvjl1vbak
destination for restore of datafile 00001: /orainstall/oradata/dup/system01.dbf
channel ch1: copied datafile copy of datafile 00001
output filename=/orainstall/oradata/dup/system01.dbf
channel ch1: restoring datafile 00002
input datafile copy recid=8 stamp=704238697 filename=/orainstall/rmanbak/data_D-TARGET_I-3106171664_TS-UNDOTBS1_FNO-2_09kvjl38bak
destination for restore of datafile 00002: /orainstall/oradata/dup/undotbs01.dbf
channel ch1: copied datafile copy of datafile 00002
output filename=/orainstall/oradata/dup/undotbs01.dbf
channel ch1: restoring datafile 00003
input datafile copy recid=7 stamp=704238688 filename=/orainstall/rmanbak/data_D-TARGET_I-3106171664_TS-SYSAUX_FNO-3_08kvjl2pbak
destination for restore of datafile 00003: /orainstall/oradata/dup/sysaux01.dbf
channel ch1: copied datafile copy of datafile 00003
output filename=/orainstall/oradata/dup/sysaux01.dbf
channel ch1: restoring datafile 00004
input datafile copy recid=9 stamp=704238700 filename=/orainstall/rmanbak/data_D-TARGET_I-3106171664_TS-USERS_FNO-4_0akvjl3cbak
destination for restore of datafile 00004: /orainstall/oradata/dup/users01.dbf
channel ch1: copied datafile copy of datafile 00004
output filename=/orainstall/oradata/dup/users01.dbf
Finished restore at 29-NOV-09
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "DUP" RESETLOGS ARCHIVELOG
  MAXLOGFILES     16
  MAXLOGMEMBERS      3
  MAXDATAFILES      100
  MAXINSTANCES     8
  MAXLOGHISTORY      292
 LOGFILE
  GROUP  1 ( '/orainstall/oradata/dup/redo01.log' ) SIZE 50 M  REUSE,
  GROUP  2 ( '/orainstall/oradata/dup/redo02.log' ) SIZE 50 M  REUSE,
  GROUP  3 ( '/orainstall/oradata/dup/redo03.log' ) SIZE 50 M  REUSE
 DATAFILE
  '/orainstall/oradata/dup/system01.dbf'
 CHARACTER SET ZHS16GBK


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

datafile 2 switched to datafile copy
input datafile copy recid=1 stamp=704240118 filename=/orainstall/oradata/dup/undotbs01.dbf
datafile 3 switched to datafile copy
input datafile copy recid=2 stamp=704240118 filename=/orainstall/oradata/dup/sysaux01.dbf
datafile 4 switched to datafile copy
input datafile copy recid=3 stamp=704240118 filename=/orainstall/oradata/dup/users01.dbf

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

executing command: SET until clause

Starting recover at 29-NOV-09

starting media recovery

archive log thread 1 sequence 3 is already on disk as file /orainstall/flash_recovery_area/TARGET/archivelog/2009_11_29/o1_mf_1_3_5k4z49ql_.arc
archive log filename=/orainstall/flash_recovery_area/TARGET/archivelog/2009_11_29/o1_mf_1_3_5k4z49ql_.arc thread=1 sequence=3
media recovery complete, elapsed time: 00:00:03
Finished recover at 29-NOV-09

contents of Memory Script.:
{
   shutdown clone;
   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    5083496448 bytes

Fixed Size                     1985656 bytes
Variable Size                905974664 bytes
Database Buffers            4160749568 bytes
Redo Buffers                  14786560 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "DUP" RESETLOGS ARCHIVELOG
  MAXLOGFILES     16
  MAXLOGMEMBERS      3
  MAXDATAFILES      100
  MAXINSTANCES     8
  MAXLOGHISTORY      292
 LOGFILE
  GROUP  1 ( '/orainstall/oradata/dup/redo01.log' ) SIZE 50 M  REUSE,
  GROUP  2 ( '/orainstall/oradata/dup/redo02.log' ) SIZE 50 M  REUSE,
  GROUP  3 ( '/orainstall/oradata/dup/redo03.log' ) SIZE 50 M  REUSE
 DATAFILE
  '/orainstall/oradata/dup/system01.dbf'
 CHARACTER SET ZHS16GBK


contents of Memory Script.:
{
   set newname for tempfile  1 to
 "/orainstall/oradata/dup/temp01.dbf";
   switch clone tempfile all;
   catalog clone datafilecopy  "/orainstall/oradata/dup/undotbs01.dbf";
   catalog clone datafilecopy  "/orainstall/oradata/dup/sysaux01.dbf";
   catalog clone datafilecopy  "/orainstall/oradata/dup/users01.dbf";
   switch clone datafile all;
}
executing Memory Script

executing command: SET NEWNAME

renamed temporary file 1 to /orainstall/oradata/dup/temp01.dbf in control file

cataloged datafile copy
datafile copy filename=/orainstall/oradata/dup/undotbs01.dbf recid=1 stamp=704240229

cataloged datafile copy
datafile copy filename=/orainstall/oradata/dup/sysaux01.dbf recid=2 stamp=704240230

cataloged datafile copy
datafile copy filename=/orainstall/oradata/dup/users01.dbf recid=3 stamp=704240230

datafile 2 switched to datafile copy
input datafile copy recid=1 stamp=704240229 filename=/orainstall/oradata/dup/undotbs01.dbf
datafile 3 switched to datafile copy
input datafile copy recid=2 stamp=704240230 filename=/orainstall/oradata/dup/sysaux01.dbf
datafile 4 switched to datafile copy
input datafile copy recid=3 stamp=704240230 filename=/orainstall/oradata/dup/users01.dbf

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

database opened
Finished Duplicate Db at 29-NOV-09

RMAN>

--一切ok


总结:
1,看官方文档一定要仔细,细小的地方要多看,千万别略过,可能就是哪儿导致 你实施不成功
2,target和duplicate的目录结构要一致(此指存储data file,tempfile,log file)
3,一定要对target库进行全库备份后来一个alter system switch logfile.这个东东在duplicate时会用到(也就是所谓的一致性恢复,说白了就是归档日志)
4,根据target的spfile,创建用于auxiliary instance的spfile,然后mount,根据pfile构建spfile(至关重要,因为rman duplicate脚本会有一个重启库的过程,你用pfile会提示找到这个pfile,导致duplicate过程执行memory script失败)
5,硬件环境及软件环境:
   sun t2000两台
   os:solaris 10
   oracle version:oracle1201

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

转载于:http://blog.itpub.net/9240380/viewspace-620956/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值