In my previous post, I explained how to use RMAN (Recovery manager) to duplicate one Oracle database.
Now, let’s make the clone possible, in few steps and without RMAN.
Applies to:
Oracle Server – Enterprise Edition – Version: 10.2.0.1.0 – 64 bit to 10.2.0.3.0 – 64 bit.
Information in this document applies to any platform.
Goal:
This document gives a step by step guide about how to manually clone or restore the database to a different host.
Solution:
1. Prerequisites
The copy of the data files must be done with the database closed or the database must be in ARCHIVELOG mode,
2. Init.ora or spfile and control file
You need to copy the init.ora or spfile file to the target host and locate it in ORACLE_HOME\dbs
Copy the controlfile(s), all the datafiles and all the archivelogs generated, to the target host.
If database is open then, you need to put all the tablespaces in backup mode, before starting the copy:
ALTER TABLESPACE BEGIN BACKUP;
>>> copy all the tablespace datafiles
ALTER TABLESPACE END BACKUP;
==> Do this for all the tablespaces
3. Set the oracle environment
export ORACLE_SID=
sqlplus “sys as sysdba”
– Check the init.ora parameters that reference location
control_files =
background_dump_dest =
core_dump_dest =
user_dump_dest =
log_archive_dest_1 =
4. Set up a password file for the duplicated database
orapwd file=$ORACLE_HOME/dbs/orapw$ORACLE_SID password=
5. Startup the database in mount status
SQL> startup mount
SQL> Rename any of the datafiles to the new location, if necessary:
ALTER DATABASE RENAME FILE
‘/FULL_PATH_OF_OLD_LOCATION/AND_DATAFILE_NAME.DBF’
TO
‘/FULL_PATH_OF_NEW_LOCATION/AND_DATAFILE_NAME.DBF’;
SQL> Rename the logfiles to the new location if necessary
alter database rename file
” to ”;
6. Check that all the datafiles are in the right location:
select file#, name from v$datafile;
7. Perform incomplete recovery:
SQL> recover database using backup controlfile until cancel;
Forward the database applying archived redo log files until you decide to stop recovery by typing cancel at the prompt (assuming that you have required archived redo log files in the log_archive_dest directory). You may archive the source database redo log files and apply them at the target database if required.
SQL> alter database open resetlogs;
Please provide your comments.
Nice reading!
Leave a comment