Cloning Oracle home

When we migrate a database to new server due to out of support by vendor eg: physical server,it is good approach to clone the oracle home from source to destination and recover the database.It depends on individuals to install fresh database software or clone.

Check the oracle home of the database

[oracle@orcl12x ~]$ echo $ORACLE_HOME
/app01/product/12.1.0/dbhome_1/

locate to the oracle home directory

[oracle@orcl12x ~]$ cd $ORACLE_HOME
[oracle@orcl12x dbhome_1]$ cd ..
[oracle@orcl12x 12.1.0]$

Check space on the FS

[oracle@orcl12x 12.1.0]$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1        20G   10G  8.2G  55% /
tmpfs           2.0G  491M  1.5G  25% /dev/shm
/dev/sda2        15G  7.2G  6.4G  54% /app01
/dev/sda5        12G  6.3G  4.7G  58% /data01

Tar the oracle home

[oracle@orcl12x 12.1.0]$ tar -cvf /data01/dbclone.tar ./dbhome_1 >/dev/null 2>/dev/null

Copy the tar file to the destination host

[oracle@orcl12x 12.1.0]$ scp /data01/dbclone.tar oracle@192.168.56.36:/data01
The authenticity of host 'xxx (xxx)' can't be established.
RSA key fingerprint is 8b:ad:8c:a1:be:23:91:28:ca:5a:8c:4e:1c:c9:00:1b.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'xxx' (RSA) to the list of known hosts.
oracle@192.168.56.36's password:
dbclone.tar                                    63% 2995MB   7.2MB/s   03:58 ETA

create the oracle home directory on the destination

[root@exdbadm02 bin]# mkdir -p /app01/product/12.1.0/

Extract the tar file

[root@exdbadm02 bin]# tar -xvf dbclone.tar

Check the inventory file if the path exists else database installation will fail

[oracle@exdbadm02 bin]$ cat /etc/oraInst.loc
inventory_loc=/app01/orainventory
install_group=oinstall
inst_group=oinstall

Create the oracle base directory in destination

[root@exdbadm02 app01]# mkdir base

Give appropriate permissions

[root@exdbadm02 app01]# chmod -R 777 base/

Go to clone perl script

[root@exdbadm02 app01]# su - oracle
[oracle@exdbadm02 ~]$ cd /app01/product/12.1.0/dbhome_1/clone/bin/

Clone the Oracle 12c home

[oracle@exdbadm02 bin]$ perl clone.pl "ORACLE_BASE=/app01/base" "ORACLE_HOME=/app01/product/12.1.0/dbhome_1" "ORACLE_HOME_NAME=orahome"
./runInstaller -clone -waitForCompletion  "ORACLE_BASE=/app01/base" "ORACLE_HOME=/app01/product/12.1.0/dbhome_1" "ORACLE_HOME_NAME=orahome" -silent -paramFile /app01/product/12.1.0/dbhome_1/clone/clone_oraparam.ini
Starting Oracle Universal Installer...

Checking Temp space: must be greater than 500 MB.   Actual 3130 MB    Passed
Checking swap space: must be greater than 500 MB.   Actual 2047 MB    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2020-09-08_09-37-21AM. Please wait ...You can find the log of this install session at:
 /apps01/orainventory/logs/cloneActions2020-09-08_09-37-21AM.log
..................................................   5% Done.
..................................................   10% Done.
..................................................   15% Done.
..................................................   20% Done.
..................................................   25% Done.
..................................................   30% Done.
..................................................   35% Done.
..................................................   40% Done.
..................................................   45% Done.
..................................................   50% Done.
..................................................   55% Done.
..................................................   60% Done.
..................................................   65% Done.
..................................................   70% Done.
..................................................   75% Done.
..................................................   80% Done.
..................................................   85% Done.
..........
Copy files in progress.

Copy files successful.

Link binaries in progress.

Link binaries successful.

Setup files in progress.
WARNING:This install was unsuccessful because: The response filename you have specified for silent operation of the Net8 Configuration Assistant (/app01/product/12.1.0/dbhome_1/network/install/netca_typ.rsp) does not exist on the system.  Please re-check the value you entered for "s_responseFileName" in the [oracle.assistants.netca.client] section of the OUI response file and try again.
Would you like to end this session now?

Setup files successful.

Setup Inventory in progress.

Setup Inventory successful.

Finish Setup successful.
The cloning of orahome was successful.
Please check '/apps01/orainventory/logs/cloneActions2020-09-08_09-37-21AM.log' for more details.

Setup Oracle Base in progress.

Setup Oracle Base successful.
..................................................   95% Done.

As a root user, execute the following script(s):
        1. /app01/product/12.1.0/dbhome_1/root.sh



..................................................   100% Done.

Run the root.sh script to link the binaries

[root@exdbadm02 bin]# /app01/product/12.1.0/dbhome_1/root.sh
Check /app01/product/12.1.0/dbhome_1/install/root_exdbadm02_2020-09-08_09-46-47.log for the output of root script

[root@exdbadm02 bin]# cat /app01/product/12.1.0/dbhome_1/install/root_exdbadm02_2020-09-08_09-46-47.log
Performing root user operation.

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /app01/product/12.1.0/dbhome_1
   Copying dbhome to /usr/local/bin ...
   Copying oraenv to /usr/local/bin ...
   Copying coraenv to /usr/local/bin ...

Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.

We are good to install a new database on the cloned home!!!

Published by kishan

You will know about me.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: