A technical troubleshooting blog about Oracle with other Databases & Cloud Technologies.

How to Perform ORACLE_HOME Backup?

2 min read
Backup of the Oracle home can be taken using any preferred method. You can use any tool such as zip, tar, and cpio to compress the Oracle home.

It is highly recommended to take a backup of the Oracle_Home binaries and Central Inventory prior to applying patchsets or patches. It should also be done as part of a standard backup schedule.

It is also suggested but not mandatory that the database(s),listeners, any processes in the source home are shutdown so that cold backup of the Oracle Home software can be taken.  

However if you are applying patches or patchsets the instructions stated in the README file may state a shutdown is required in which case a suggestion might be to take cold backups of the ORACLE_HOME during this scheduled maintenance outage.  

Taking backups while Oracle processes are active should also be valid becuase any processes that load the static binaries or libraries into memory should not hold a write lock.  Again this note only speaks about the ORACLE_HOME software and not databases.

The backup must be taken by the user that owns the Oracle installation or root user.  The intention is to make sure that the ownership/permissions of the files is preserved correctly.

Below example shows use of tar command:
1. (Suggested but not mandatory) Shutdown databases, listeners, or any other processes related to the ORACLE_HOME which you are taking backup.
2. cd to the directory where ORACLE_HOME is located for example:

cd /u01/app/oracle/product/19/
In the above example, ORACLE_HOME is /u01/app/oracle/product/19/db and backup the directory is /u01/app/oracle/backup/

3. backup the ORACLE_HOME for example:
tar -pcvf /u01/app/oracle/backup/oracle_home_bkup.tar db1

Below is an example of restoring the ORACLE_HOME:

1. (This step would be mandatory in the case of restore) Shutdown databases, listeners, or any other processes related to the ORACLE_HOME which you are restoring.
2. Go to the directory where ORACLE_HOME is located for example:

cd /u01/app/oracle/product/19
3. Rename or move the current ORACLE_HOME for example:

mv db1 db1_bkup
4. Restore the ORACLE_HOME for example:

Make sure that is enough enough free disk space before doing the backup.
tar -pxvf /u01/app/oracle/backup/oracle_home_bkup.tar
The Central Inventory where the Oracle_Home is registered should also be part of the backup plan and taken at the same time as the ORACLE_HOME backup for consistency.

The Central Inventory contains information relating to the Oracle_Home's installed on a host.
To determine where the Central Inventory (oraInventory) is located review the following file depending upon the platform:

/var/opt/oracle/oraInst.loc

or

/etc/oraInst.loc

The contents of oraInst.loc file will look something like this for example:
inventory_loc=/oracle/product/oraInventory
inst_group=dba