Duplicate Database

In the following example of active database duplication, a connection is established to three database instances, all through the use of net service names:

RMAN> CONNECT TARGET SYS/sysdba@prod;    # source database
connected to target database: PROD (DBID=39525561)

RMAN> CONNECT AUXILIARY SYS/sysdba@dupdb; # duplicate database instance
connected to auxiliary database: DUPDB (not mounted)

RMAN> CONNECT CATALOG rman/rman@catdb;    # recovery catalog database
connected to recovery catalog database


To duplicate a database to a remote host with the same directory structure
==========================================================================
how to perform active duplication when the SPFILE clause is specified. DUPLICATE requires the NOFILENAMECHECK option because the source database files have the same names as the duplicate database files.
DUPLICATE TARGET DATABASE TO dupdb
  FROM ACTIVE DATABASE
  PASSWORD FILE
  SPFILE
  NOFILENAMECHECK;
The PASSWORD FILE option specifies that RMAN should copy the password file to the destination host. RMAN automatically copies the server parameter file to the destination host, starts the auxiliary instance with the server parameter file, copies all necessary database files and archived redo logs over the network to the destination host, and recovers the database. Finally, RMAN opens the database with the RESETLOGS option to create the online redo log.


Backup-Based Duplication With a Target Connection
=================================================
DUPLICATE TARGET DATABASE TO dupdb
  SPFILE
  NOFILENAMECHECK
  UNTIL TIME 'SYSDATE-7';


Backup-Based Duplication Without a Target and a Recovery Catalog Connection
===========================================================================
DUPLICATE DATABASE TO dupdb
  UNTIL TIME "TO_DATE('11/01/2007 14:00:00', 'MM/DD/YYYY HH24:MI:SS')"
  SPFILE
  BACKUP LOCATION '/prod_backups'
  NOFILENAMECHECK;


%b
Specifies the file name stripped of directory paths. For example, if a datafile is named /oradata/prod/financial.dbf, then %b results in financial.dbf.
%f
Specifies the absolute file number of the datafile for which the new name is generated. For example, if datafile 2 is duplicated, then %f generates the value 2.
%I
Specifies the DBID.
%N
Specifies the tablespace name.
%U
Specifies the following format: data-D-%d_id-%I_TS-%N_FNO-%f.

.../system01.dbf   SYSTEM   1   /oradata/data-D-PROD_id-87650928_TS-SYSTEM_FNO-1

RUN {
  SET NEWNAME FOR TABLESPACE users TO '/oradata%f/%b';
  SET NEWNAME FOR DATAFILE 1 TO '/oradata1/system01.dbf'; 
  SET NEWNAME FOR DATAFILE 2 TO '/oradata2/sysaux01.dbf';
  SET NEWNAME FOR DATAFILE 3 TO '/oradata3/undotbs01.dbf'; 
  SET NEWNAME FOR TEMPFILE 1 TO '/oradatat/temp01.dbf'; 
  DUPLICATE TARGET DATABASE TO dupdb
    SKIP TABLESPACE tools
    LOGFILE
      GROUP 1 ('/duplogs/redo01a.log', 
               '/duplogs/redo01b.log') SIZE 4M REUSE, 
      GROUP 2 ('/duplogs/redo02a.log', 
               '/duplogs/redo02b.log') SIZE 4M REUSE;
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值