1.Take backup of controlfile as trace:[SOURCE DB]
Alter database backup
controlfile to trace as ‘/export/home/oracle/ctrl_bkp.sql’;
2. Note down the location of datafiles[SOURCE DB]
Select file_name from
dba_data_files;
Select file_name from dba_temp_files;
3. Shutdown the database:[SOURCE DB]
Shut immediate
4. Copy the datafiles and tempfiles to the target db
server
5. Prepare the init file for target db:[TARGET DB]
We
can copy the pfile from source db and the change the required parameters like
DB_NAME and control_file,audit_file_dest,diag location.

6.
Start the database in nomount stage:[TARGET DB]
export ORACLE_SID=TRGDB
startup nomount
pfile=initTRGDB.ora
7.
Re-recreate the controlfile [ TARGET DB ]
This is an important steps in cloning process. In
step 1 , We had taken backup of the controlfile as trace, We will use that sql
file to re-create the controlfile.
SNIPPET FROM controlfile sql script:

Lets modify this sql by replacing the datafile
location of source with that of target and the new db name as TRGDB.
After changing it will look as below:

SET DATABASE:
Here we have use SET DATABASE, Because we are cloning
the database in target with a new db name.
CREATE CONTROLFILE SET DATABASE “SRCDB” RESETLOGS FORCE LOGGING ARCHIVELOG
If you wish to keep the database same as source, then
you can use the command REUSE DATABASE command.

8. Open the database in resetlog mode:
Alter database open resetlogs;
9. Add the temp files:
You
can get this tempfile script in the end controlfile script .

No comments:
Post a Comment