Manually Cloning an Existing Oracle Database Installation on Linux
This article describes the steps necessary to manually clone an existing Oracle database installation to a new Linux server. It was written in response to a specific request for a manual process for cloning a 9i home on a test system. Before starting this process it's worth reading the following notes:
- If I were doing a production installation I would not use this method. I like the security of knowing the installation went cleanly.
- This method assumes there are no cluster-related services, so it does not cover installations using ASM or RAC.
- It is assumed the source and destination server have exactly the same setup. That is, all the Oracle prerequisites have been performed on the destination server. In this example, the only diffeerence between the two servers is the hostname and IP address.
- There are several Oracle Support notes on cloning installations using the Oracle Universal Installer (OUI) and Grid Control (GC), so you should consider those before considering this method. See Master Note For Cloning Oracle Database Server ORACLE_HOME's Using the Oracle Universal Installer (OUI) (Doc ID 1154613.1).
With those points in mind, here are the list of steps necessary to clone an existing database installation to a new server.
- Stop Oracle
- Create TAR File
- Transfer TAR File
- Extract TAR File
- Check File Ownership
- Root Configuration Scripts
- Modify Config Files
- Start Oracle
- Additional Configuration
Turn off all Oracle-related services, including the Enterprise Manager Grid Control, database and listener.
$ # EM $ emctl stop dbconsole $ # database and listener (>=10g) $ dbshut $ORACLE_HOME $ # listener (<10g) $ lsnrctl stop
Create TAR File
TAR and optionally compress the mount point containing the Oracle software. In this case, all Oracle software and datafiles are beneath the "/u01" directory. Perform the following command as the "root" user.
# tar -cvf /tmp/u01.tar /u01 # gzip /tmp/u01.tar
Once this is complete you can restart Oracle on the source server.
Transfer TAR File
Copy the file from the source to the destination server. You can do this transfer using which ever method you like, but here I will use SCP command from the source server.
# scp /tmp/u01.tar.gz firstname.lastname@example.org:/tmp/u01.tar.gz
Extract TAR File
Decompress and extract the contents of the TAR file on the destination server. Perform the following commands as the "root" user on the destination server.
# gunzip /tmp/u01.tar.gz # cd / # tar -xvf /tmp/u01.tar
Check File Ownership
Check the ownership of the "/u01" directory and it's contents. If it doesn't match the ownership of the source server, alter it to match.
# chown -R oracle:oinstall /u01
Root Configuration Scripts
Run the root configutation scripts, generated as part of the original installation, on the destination server as the "root" user.
Modify Config Files
If you have not prepared the ".bash_profile" as part of the destination server setup, copy the file from the source to the destination server.
# scp /home/oracle/.bash_profile email@example.com:/home/oracle/.bash_profile
Edit the ".bash_profile" file on the destination server, giving it the correct value for the ORACLE_HOSTNAME environment variable.
Amend any hostname or IP references in the "listener.ora" and "tnsnames.ora" files in the "$ORACLE_HOME/network/admin" directory.
Edit the "/etc/oratab" making sure all instances are referenced correctly. In my case I need to add the following entry.
Start the listener and database.
$ # listener (<10g) $ lsnrctl start $ # database and listener (>=10g) $ dbstart $ORACLE_HOME
The database should now be functioning normally on the destination server.
If you are using Enterprise Manager Database Control (>= 10g), you will need to reconfigure it using the method described here.
If you require your database to restart automatically after reboot, configure it using the method specified here.
For more information see:
- Master Note For Cloning Oracle Database Server ORACLE_HOME's Using the Oracle Universal Installer (OUI) (Doc ID 1154613.1)
- Basic Enterprise Manager Troubleshooting
- Automating Database Startup and Shutdown on Linux
Hope this helps. Regards Tim...