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/{{b,c,u}dump,data,control,log}
2.
Configure
parameter file
3.
Restore the
datafiles backup
4.
start the
database in nomount state
Sql>startup
nomount;
5.
Recreate
controlfile(run edited trace file)
Sql>@bkpctrl.sql
// imagine bkpctrl.sql as a script for creating new controlfile
6.
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
Steps:
At target machine
1.
create a password
file for target database at $ORACLE_HOME/dbs location:
$orapwd
file= orapwprod password=manager force=y
2.
Take online
backup of target database using rman;
3.
configure and
start listener service for target database .(target)
At catalog machine
1.
Configure listener for catalog
At auxiliary (clone) machine
1.
Create necessary
directory structure.
2.
Configure parameter
file and add two additional parameters (to update the location of datafile and
logfiles in controlfile )
Db_file_name_convert=’/u01/user18/prod/data’,’/u01/user18/aux/data’
log_file_name_convert=’/u01/user18/prod/log’,’/u01/user18/aux/log’
3.
configure two tns
services (for target and catalog db’s)
Eg:
totarget (for target database)
tocatalog (for catalog database)
4.
start the aux
database in nomount state
Sql>startup
nomount
5.
connect to rman
using following command
$rman
target sys/manager@totarget catalog rman/rman@tocatalog
6.
Give command to
clone the database.
Rman>duplicate
target database to ‘aux’; // assume aux is the clone database name
NOTE: IN 11g there is a new feature for
cloning i.e active database cloning. While using this feature there is no need
to take backup,it clone from the active database.The above steps are same only
one step we can skip i.e taking backup and instead of using this command
Rman>duplicate target database to
‘aux’; // assume aux is the clone database name
We can use the below command.
Rman cloning
Rman
cloning from active database
$rman target sys/manager@totarget
nocatalog auxiliary sys/manager@totest
Rman> duplicate target database to
‘test’ from active database;
No comments:
Post a Comment