1) To use hot backup and clone the database the
production database has to be in archivelog mode.
2) Create a new init.ora from the production
database’s init.ora file and make the required
modifications like the location of bdump,udump,
cdump,log_archive_dest_1,instance_name,db_name and
also make sure the folders are physically present
at the OS level(i.e create them).
3) On the target machine (i.e where the clone database has been created)
we have to create a new service as well as the password file.
Commands for the same are:-
C:\oracle\ora92\bin>oradim -new -sid
C:\oracle\ora92\database>orapwd file=PWD
4) Now on your production database fire the following command
to create a trace of the controlfile
SQL>alter database backup controlfile to trace;
This will create a trace file in your udump folder
(kindly check the time to make sure it is the latest trace file).
5) Open the trace file which was created in step 4 and
make the following modifications
a) Change the
CREATE CONTROLFILE REUSE DATABASE “
TO
CREATE CONTROLFILE SET DATABASE “
b) Change all directories in the create controlfile clause
to point to the correct directories for the new target database, if necessary
c) Leave “only” the CREATE CONTROLFILE clause. The other statements,
like the recover command, will be done manually.
Be sure you also remove the STARTUP NOMOUNT command.
So remove all the other statements other then the script starting
with CREATE CONTROLFILE …and ending with CHARACTER SET WE8MSWIN1252;
After making the modifications save the changed script
as a sql file (i.e for example like create_contol.sql)
and send it to the target machine.
6) Now on the produstion database
we begin the hot backup procedure
To find out the datafile associated with each tablespace
fire the following query
SQL>select file_name,tablespace_name from dba_data_files;
SQL>alter tablespace
Copy all the datafiles associated with this tablespace
to the required location as specified in the CREATE CONTROLFILE script.
After copying is over fire the following command to end the backup
SQL>alter tablespace
Do this for all the tablespaces.
7) After all the datafiles have been copied and no more tablespace
is in backup mode fire the following query to archive the current logfile;
SQL>alter system archive log current;
These were the steps to be performed on the production database
except for step 3 which needs to be performed on the target machine.
The following steps needs to be performed on the target machine.
On the target machine log into SQL with the following commands
C:\>set oracle_sid=
C:\>sqlplus
and then enter the username and password.
9) Ater logging into the sql prompt startup the database in nomount phase
with the modified init file.
SQL>startup nomount pfile=
10) After the instance is started then we have to run the script
to create the controlfile.
SQL>@
11) After the command has been executed successfully and
the controlfile is created then we have to recover the database
using the following command.
SQL>recover database until cancel using backup controlfile;
It will ask for the archives which were generated in the production database
during the hot backup and till the latest archive.Kindly copy those
archives to the target machine at the loaction
specified by the log_archive_dest_1 parameter in init file
.
12) After recovery is completed then open the database with resetlogs option.
SQL>alter database open resetlogs;
Now after this command completed successfully your clone database is ready.