Monday, May 12, 2008

Creating a Duplicate Database on a Remote Host -Part1

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 neptune while the duplicate database name will be dupbase and the hostname of the duplicate database is saturn.

The following steps is needed to perform the operation.

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

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 saturn as to the same path as it was in recorded in control file in terminus.

bash-3.00$ scp /oradata2/flash_recovery_area/DBASE/backupset/2008_05_13/
o1_mf_annnn_TAG20080513T030550_42lhghq3_.bkp oracle@saturn:/oradata2/flash_recovery_area/DBASE/backupset/2008_05_13/

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

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

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

Password:
o1_mf_annnn_TAG20080 100% |***********************************************| 90210 KB 00:10
-bash-3.00$ scp /oradata2/flash_recovery_area/DBASE/backupset/2008_05_13/
o1_mf_annnn_TAG20080513T030409_42lhf17z_.bkp oracle@saturn:/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 saturn host and name of the auxiliary instance is dupbase.

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

bash-3.00$ vi /oradata2/initdupbase.ora
db_name=dupbase


ii)Set the Oracle sid in saturn to dupbase.
bash-3.00$ export ORACLE_SID=dupbase

iii)Create spfile from pfile.
bash-3.00$ 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/initdupbase.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/initdupbase.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 saturn machine(auxiliary database) RMAN and issue following command.

bash-3.00$ rman target sys/a@neptune:1522/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: DUPBASE (not mounted)


RMAN> RUN{
2> SET UNTIL SEQUENCE 5 THREAD 1;
3> DUPLICATE TARGET DATABASE TO DUPBASE 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.

bash-3.00$ 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
---------
DUPBASE

Related Documents:
----------------------

Duplication fails with Missing log

No comments:

Post a Comment