On Linux Clone a 12c $ORACLE_HOME + patches, $ORACLE_BASE, and a database to a new server

Without running runInstaller, dbca, opatch, or rman, pick up an existing DB and the Oracle binaries and move them to another server, here is one way (without all the screen shots):
Assumption are:

  • You only have one home and database under your $ORACLE_BASE – this example only does one DB – but you could modify the process below if you have more than one home or DB under your $ORACLE_BASE.
  • Your datafiles are within the $ORACLE_BASE and your installation mount points will be the same on both the source and target servers.  In my case, my source and destination both do and will reside in /u01/app.

$ORACLE_BASE/oradata/SID is standard default location for datafiles so if you pick up the entire $ORACLE_BASE you get all the databases under the base – assuming you used the default directory structures on the original source install.
Shutdown the database you want to clone.
Zip up or tar the source $ORACLE_BASE – this will combine, the Oracle binaries, the Oracle “admin” directory structure, the “FRA” if you set one up, and the Oracle datafiles / database itself.  This directory architecture is the default structure, if you chose default install options on the source install – your $ORACLE_BASE may vary.

echo $ORACLE_BASE
/u01/app/oracle
# cd to a mount shared by both servers – your will be different – or just ftp in binary
cd /media/sf_OEL6.6+DBSetups/
tar -cvf  oracleBase.tar /u01/app/oracle

Copy the tar file from the source server to the target  server root directory “/” – you may have to use root (copy commands not shown) – Unwind the tar file from the root directory “/”.

su – root
cd cd /media/sf_OEL6.6+DBSetups/
cp -p oracleBase.tar /
cd /
tar -xvf oracleBase.tar

If you used the root account to unwind the tar, change the ownership of the new directory structure using the root account

# your mount point may vary
cd /u01
chown -R oracle:oinstall app

You will probably want to copy your oracle .bash_profile from your target to your source
Change your $ORACLE_HOME/network/admin/listener.ora and tnsnames.ora to the new server/host name
Use Oracle Perl based clone tool as follows (your $ORACLE_HOME is likely different):

$ORACLE_HOME/perl/bin/perl $ORACLE_HOME/clone/bin/clone.pl ORACLE_BASE=”/u01/app/oracle/” $ORACLE_HOME=”/u01/app/oracle/product/12.1.0/dbhome_1″ OSDBA_GROUP=dba OSOPER_GROUP=dba -defaultHomeName

You’ll be prompted to run a root script – when this program completes, execute it.
Modify your target /etc/oratab to match your source.
Done deal – hope this helps.  Mike
 
 

Leave a Comment

Scroll to Top