Guenadi N Jilevski's Oracle BLOG

Oracle RAC, DG, EBS, DR and HA DBA BLOG

Database duplication with RMAN on remote host

Database duplication with RMAN on remote host

In this scenario I will duplicate database on a remote host with the same directory structure as of original database. In this example original database is dbase and the hostname of the original database is zeus while the duplicate database name will be dbdup and the hostname of the duplicate database is hera.

The following steps are required to perform the operation.

A)Backup the original database. Here original database is dbase on host zeus.

i)SQL> host rman TARGET /

Recovery Manager: Release 10.2.0.1.0 – Production on Tue May 13 02:50:23 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: DBASE (DBID=1509380669)

ii)RMAN> BACKUP DATABASE PLUS ARCHIVELOG;

Starting backup at 13-MAY-08
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=3 recid=21 stamp=654577550
channel ORA_DISK_1: starting piece 1 at 13-MAY-08
channel ORA_DISK_1: finished piece 1 at 13-MAY-08
piece handle=/oradata2/flash_recovery_area/DBASE/backupset/2008_05_13/
o1_mf_annnn_TAG20080513T030550_42lhghq3_.bkp tag=TAG20080513T030550 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 13-MAY-08

Starting backup at 13-MAY-08
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=/oradata2/data1/dbase/system01.dbf
input datafile fno=00003 name=/oradata2/data1/dbase/sysaux01.dbf
input datafile fno=00008 name=/oradata2/DBASE/datafile/o1_mf_permanen_42l31vg0_.dbf
input datafile fno=00002 name=/oradata2/data1/dbase/undotbs01.dbf
input datafile fno=00004 name=/oradata2/data1/dbase/users01.dbf
input datafile fno=00005 name=/oradata2/data.dbf
input datafile fno=00006 name=/oradata2/data1/data02.dbf
input datafile fno=00009 name=/oradata2/data_test.dbf
input datafile fno=00007 name=/oradata2/6.dbf
channel ORA_DISK_1: starting piece 1 at 13-MAY-08
channel ORA_DISK_1: finished piece 1 at 13-MAY-08
piece handle=/oradata2/flash_recovery_area/DBASE/backupset/2008_05_13/
o1_mf_nnndf_TAG20080513T030552_42lhgk10_.bkp tag=TAG20080513T030552 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:16
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current control file in backupset
including current SPFILE in backupset
channel ORA_DISK_1: starting piece 1 at 13-MAY-08
channel ORA_DISK_1: finished piece 1 at 13-MAY-08
piece handle=/oradata2/flash_recovery_area/DBASE/backupset/2008_05_13/
o1_mf_ncsnf_TAG20080513T030552_42lhjxkf_.bkp tag=TAG20080513T030552 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 13-MAY-08

Starting backup at 13-MAY-08
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=4 recid=22 stamp=654577630
channel ORA_DISK_1: starting piece 1 at 13-MAY-08
channel ORA_DISK_1: finished piece 1 at 13-MAY-08
piece handle=/oradata2/flash_recovery_area/DBASE/backupset/2008_05_13/
o1_mf_annnn_TAG20080513T030710_42lhjzro_.bkp tag=TAG20080513T030710 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 13-MAY-08

B)Copy the backup set of datafile and archived redo log files to hera as to the same path as it was in recorded in control file in terminus.

$ scp /oradata2/flash_recovery_area/DBASE/backupset/2008_05_13/
o1_mf_annnn_TAG20080513T030550_42lhghq3_.bkp oracle@hera:/oradata2/flash_recovery_area/DBASE/backupset/2008_05_13/

Password:
o1_mf_annnn_TAG20080 100% |***********************************************| 25088 00:00
$ scp /oradata2/flash_recovery_area/DBASE/backupset/2008_05_13/
o1_mf_nnndf_TAG20080513T030552_42lhgk10_.bkp oracle@hera:/oradata2/flash_recovery_area/DBASE/backupset/2008_05_13/

Password:
o1_mf_nnndf_TAG20080 100% |***********************************************| 564 MB 01:03
$ scp /oradata2/flash_recovery_area/DBASE/backupset/2008_05_13/
o1_mf_annnn_TAG20080513T030710_42lhjzro_.bkp oracle@hera:/oradata2/flash_recovery_area/DBASE/backupset/2008_05_13/

Password:
o1_mf_annnn_TAG20080 100% |***********************************************| 7680 00:00
$ scp /oradata2/flash_recovery_area/DBASE/backupset/2008_05_13/
o1_mf_annnn_TAG20080513T030409_42lhdrxt_.bkp oracle@hera:/oradata2/flash_recovery_area/DBASE/backupset/2008_05_13/

Password:
o1_mf_annnn_TAG20080 100% |***********************************************| 90210 KB 00:10
$ scp /oradata2/flash_recovery_area/DBASE/backupset/2008_05_13/
o1_mf_annnn_TAG20080513T030409_42lhf17z_.bkp oracle@hera:/oradata2/flash_recovery_area/DBASE/backupset/2008_05_13/

Password:
o1_mf_annnn_TAG20080 100% |***********************************************| 5331 KB 00:00

B)Prepare the auxiliary instance. Auxiliary instance will be created in hera host and name of the auxiliary instance is dbdup.

i)Create pfile with parameter db_name=dbdup . If you want to rename control file set control_files parameter in pfile.

$ vi /oradata2/initdbdup.ora
db_name=dbdup

ii)Set the Oracle sid in hera to dbdup.
$ export ORACLE_SID=dbdup

iii)Create spfile from pfile.
$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 – Production on Tue May 13 03:31:02 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.

SQL> startup nomount pfile=’/oradata2/initdbdup.ora’;

ORACLE instance started.
Total System Global Area 171966464 bytes
Fixed Size 2019320 bytes
Variable Size 113246216 bytes
Database Buffers 50331648 bytes
Redo Buffers 6369280 bytes

SQL> CREATE SPFILE FROM PFILE=’/oradata2/initdbdup.ora’;

File created.

iv)Start the auxiliary instance with spfile.
SQL> startup force nomount
ORACLE instance started.

Total System Global Area 171966464 bytes
Fixed Size 2019320 bytes
Variable Size 113246216 bytes
Database Buffers 50331648 bytes
Redo Buffers 6369280 bytes

C)Connect to the hera machine(auxiliary database) RMAN and issue following command.

$ rman target sys/a@dbase AUXILIARY /

Recovery Manager: Release 10.2.0.1.0 – Production on Tue May 13 04:23:45 2008

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

connected to target database: DBASE (DBID=1509380669)
connected to auxiliary database: DBDUP (not mounted)

RMAN> RUN{
2> SET UNTIL SEQUENCE 5 THREAD 1;
3> DUPLICATE TARGET DATABASE TO DBDUP NOFILENAMECHECK;
4> }

.
.
.
database opened
Finished Duplicate Db at 13-MAY-08

D)now your database duplication is ok. Work and Test with that.

RMAN> exit
Recovery Manager complete.

$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 – Production on Tue May 13 05:02:17 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 – Production
With the Partitioning, OLAP and Data Mining options

SQL> select open_mode from v$database;

OPEN_MODE
———-
READ WRITE

SQL> SELECT NAME FROM V$DATABASE;

NAME
———
DBDUP

May 17, 2008 - Posted by | oracle

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: