DBA Hub

📋Steps in this guide1/10

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.

oracle miscconfigurationintermediate
by OracleDba
14 views
1

Stop Oracle

Turn off all Oracle-related services, including the Enterprise Manager Grid Control, database and listener.

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
$ # EM
$ emctl stop dbconsole

$ # database and listener (>=10g)
$ dbshut $ORACLE_HOME

$ # listener (<10g)
$ lsnrctl stop
2

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. Once this is complete you can restart Oracle on the source server.

Code/Command (click line numbers to comment):

1
2
# tar -cvf /tmp/u01.tar /u01
# gzip /tmp/u01.tar
3

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.

Code/Command (click line numbers to comment):

1
# scp /tmp/u01.tar.gz [email protected]:/tmp/u01.tar.gz
4

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.

Code/Command (click line numbers to comment):

1
2
3
# gunzip /tmp/u01.tar.gz
# cd /
# tar -xvf /tmp/u01.tar
5

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.

Code/Command (click line numbers to comment):

1
# chown -R oracle:oinstall /u01
6

Root Configuration Scripts

Run the root configutation scripts, generated as part of the original installation, on the destination server as the "root" user.

Code/Command (click line numbers to comment):

1
2
/u01/app/oraInventory/orainstRoot.sh
/u01/app/oracle/product/11.2.0/db_1/root.sh
7

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. 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.

Code/Command (click line numbers to comment):

1
2
3
# scp /home/oracle/.bash_profile [email protected]:/home/oracle/.bash_profile

DB11G:/u01/app/oracle/product/11.2.0/db_1:Y
8

Start Oracle

Start the listener and database. The database should now be functioning normally on the destination server.

Code/Command (click line numbers to comment):

1
2
3
4
5
$ # listener (<10g)
$ lsnrctl start

$ # database and listener (>=10g)
$ dbstart $ORACLE_HOME
9

Additional Configuration

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
10

Changing ORACLE_HOME Path

The instructions above assume the path of the matches between the two servers. If the new home has a different path, a straight rename won't work. The simplest way to deal with the renamed path is to use the script. The following example does a rename of an existing home. After turning off all processes, rename the ORACLE_HOME. Set the and parameters to the new values. Run the "clone.pl" script, passing in the , and OS groups. Run the "root.sh" script in the . Edit the "/etc/oratab" file and any custom environment files to reflect the new path. You can then restart the Oracle services as normal. In 19c the "clone.pl" script is deprecated. Using it will produce the following warning. Thanks to Brian Fitzgerald for pointing this out. Hope this helps. Regards Tim...

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
cd $ORACLE_BASE/product/19.0.0/
mv dbhome_1 dbhome_2

export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/19.0.0/dbhome_2

$ORACLE_HOME/perl/bin/perl \
  $ORACLE_HOME/clone/bin/clone.pl \
  ORACLE_BASE="$ORACLE_BASE" \
  ORACLE_HOME="$ORACLE_HOME" \
  OSDBA_GROUP=dba \
  OSOPER_GROUP=dba \
  -defaultHomeName

/u01/app/oracle/product/19.0.0/dbhome_2/root.sh

[INFO] [INS-32183] Use of clone.pl is deprecated in this release. Clone operation is equivalent to performing a Software Only installation from the image.
You must use /u01/app/oracle/product/19.0.0/dbhome_1/runInstaller script available to perform the Software Only install. For more details on image based installation, refer to help documentation.

Comments (0)

Please to add comments

No comments yet. Be the first to comment!