Clone/ Copy Oracle Database from one Server to Another



  • If your database is not in ARCHIVE LOG mode, take an off-line database backup.
  • If in ARCHIVELOG MODE, you can either take an on-line or off-line database backup.
Primary Server

Login as SYS in sqlplus

SQL> alter database backup controlfile to trace;

  • Edit the controlfile trace (in $ORACLE_BASE/admin/$ORACLE_SID>/udump) and remove the lines until you get to the 'CREATE CONTROLFILE ..' statement. Edit this statement to read:
Second Server
  • Move this script to the new machine. Edit this script to update the directories for the datafiles and redo log files. Also, comment out the lines for "RECOVER ..." and "ALTER DATABASE OPEN ..."
  • Restore/ or copy the backup and the archived logs (if any) to the new machine. You may create same directory structure as primary server to minimal change in init.ora file 
  • Copy your init.ora file to the new machine. Ensure your controlfile and archive destinations in your SPFILE/ ini$ORACLE_SID.ora are properly set on the new machine.
  • Set your Oracle Environment by running ". oraenv" on Unix or Linux.
  • Start sqlplus  connect SYS AS SYSDBA and run the create controlfile script.
  • Perform a database recovery using
SQL> RECOVER DATABASE USING BACKUP CONTROLFILE UNTIL CANCEL;

You'll be prompted to supply an archived log file, Restore that file to the archive log destination (if not already there) and continue. Repeat for all archived files till you get to the last one. At that point specify 'CANCEL'.

SQL> ALTER DATABASE OPEN RESETLOGS;

Change the global name of the new database to avoid problems with networked application and replication:

SQL> ALTER DATABASE RENAME GLOBAL_NAME = target_new_db_name;

Here you go J