Showing posts with label how to clone using rman backup based duplication. Show all posts
Showing posts with label how to clone using rman backup based duplication. Show all posts

Tuesday, 2 April 2013

11G RMAN BACKUP BASED CLONING


Source(TARGET) instance information:
Instance name=DLINK
hostname=mydbt4db2
datafile location=/u03/oradata/DLINK, /u02/oradata/DLINK
Redolog file location=/u03/oradata/DLINK
Archive log file location=/u02/oradata/arch

Auxiliary instance (RLINK) information:

Instance name=RLINK
hostname=mydbt4db4
datafile location=/u03/oradata/RLINK, /u02/oradata/RLINK
Redolog file location=/u03/oradata/RLINK
Archive log file location=/u02/oradata/arch_RLINK

1) Create required directory structure at auxiliary side

[oracle@mydbt4db4 admin]$ mkdir -p /u02/oradata/RLINK
[oracle@mydbt4db4 admin]$ mkdir -p /u03/oradata/RLINK
[oracle@mydbt4db4 admin]$ mkdir -p /u02/oradata/arch_RLINK

2) Define ORACLE_SID and other required settings for auxiliary instance

[oracle@mydbt4db4 ~]$ vi .bash_profile
[oracle@mydbt4db4 ~]$ pwd
/home/oracle
[oracle@mydbt4db4 ~]$ . .bash_profile
[oracle@mydbt4db4 ~]$ echo $ORACLE_SID
RLINK
[oracle@mydbt4db4 ~]$

3) Creating initialization Parameter file for the Auxiliary instance(RLINK)


[oracle@mydbt4db4 dbs]$ vi initTLINK.ora
[oracle@mydbt4db4 dbs]$ cat initTLINK.ora
db_name='RLINK'
memory_target=200M
db_block_size=8192
control_files ='/u02/oradata/RLINK/control1.ctl','/u03/oradata/RLINK/control2.ctl'
compatible ='11.2.0'
log_archive_dest=/u02/oradata/arch_RLINK
log_file_name_convert='/u03/oradata/DLINK','/u03/oradata/RLINK'
db_file_name_convert='/u03/oradata/DLINK','/u03/oradata/RLINK','/u02/oradata/DLINK','/u02/oradata/RLINK'

4) Create password file at auxiliary side(TLINK)

[oracle@mydbt4db4 ~]$ cd $ORACLE_HOME/dbs
[oracle@mydbt4db4 dbs]$ orapwd file=orapw$ORACLE_SID password=sys force=y
[oracle@mydbt4db4 dbs]$ ls -ltr orapwR*
-rw-r----- 1 oracle oinstall 1536 Nov 26 16:55 orapwRLINK
[oracle@mydbt4db4 dbs]$


5) Take a backup of the database Source

RMAN> backup database plus archivelog;


Starting backup at 26-NOV-12
current log archived
configuration for DISK channel 2 is ignored
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=133 device type=DISK
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
.
.
.
.
Starting Control File and SPFILE Autobackup at 26-NOV-12
piece handle=/u02/oradata/rman_bkp/c-2903807241-20121126-00 comment=NONE
Finished Control File and SPFILE Autobackup at 26-NOV-12


6)  Prepare for duplicate by starting the auxiliary instance

[oracle@mydbt4db4 rman_bkp]$  sqlplus '/as sysdba'

SQL*Plus: Release 11.2.0.1.0 Production on Mon Nov 26 08:41:59 2012

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

Connected to an idle instance.

SQL> startup nomount;
.
7) Copy the backupsets from source to your auxiliary server

If the duplicate is going to happen on different server, move the backup pieces to a new server using commands like ftp,scp etc

[oracle@mydbt4db2 rman_bkp]$ scp *  oracle@192.168.3.19:/u02/oradata/RMAN_BKP


8) Connect to the auxiliary instance from RMAN and perform the rman duplicate as follows

rman auxiliary /

Recovery Manager: Release 11.2.0.1.0 - Production on Mon Nov 26 20:41:32 2012

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to auxiliary database: RLINK (not mounted)

RMAN>  DUPLICATE DATABASE TO 'RLINK'
2> BACKUP LOCATION '/u02/oradata/RMAN_BKP';

Starting Duplicate Db at 26-NOV-12

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

database opened
Finished Duplicate Db at 26-NOV-12