Search This Blog

Thursday, 13 October 2016

Cloning


                                                            Cloning

User Managed Cloning

Steps:

 At source database site

1.        Take online backup of datafiles database.

2.        Take trace of control file

Sql>alter database backup controlfile to trace

3.        Go to udump directory of the source database.

$cd prod/udump

$ls –ltr

4.        copy the last trace file with another name to another location and edit it

$cp prod_ora_22305.trc ~/bkpctrl.sql

$vi bkpctrl.sql

Change

 Reuse          => set and change the name of database also

 Noresetlogs =>resetlogs            

: wq!  //close the file

 

 At clone database site

  1. Create necessary directory structure.

$mkdir –p clone/{data,control,log}

  1. Configure parameter file
  2. Restore the datafiles backup
  3. start the database in nomount state

Sql>startup nomount;

  1. Recreate controlfile(run edited trace file)

Sql>@bkpctrl.sql    // imagine bkpctrl.sql as a script for creating new controlfile

  1. Recover database and open with resetlogs.

Sql>recover database using backup controlfile until cancel;//apply all archives and specify all                    redo log files if required.

Sql>alter database open resetlogs;

 

Rman Cloning From Active Database

  Steps:

Both side create password file with same password

 

Ø  create a password file for Target and Source database at $ORACLE_HOME/dbs location:

$orapwd file= orapwprod password=manager force=y ignorecase=y

$orapwd file= orapwclone password=manager force=y ignorecase=y

            At auxiliary (clone) machine

1.        Create necessary directory structure.

2.        Configure parameter file and add two additional parameters(in pfile or spfile) (to update the location of datafile and logfiles in controlfile )

db_file_name_convert=’/u01/home/prod’,’/u01/home/clone/data’

log_file_name_convert=’/u01/home/prod’,’/u01/home/clone/log’

           

              3.configure and start listener service for target database(Clone).

     

     4.  configure  one TNS Service  (for Source db’s)

Eg:

    toclone (for Source prod database)

 

start the aux(clone) database in nomount state

Sql>startup nomount

             5.connect to rman using following command

$rman target / nocatalog auxiliary sys/manager@toclone

 

             6.Give command to clone the database.

Rman>duplicate target database  to ‘clone’ from active database

No comments:

Post a Comment