BACKUP ORACLE HOME AND INVENTORY

How to Backup ORACLE_HOME binaries and Oracle INVENTORY

ORACLE_HOME and INVENTORY need to backup before Database / OS level patching

Table of Contents
___________________________________________________________________________________________________

Backup ORACLE_HOME and INVENTORY

1. Shutdown Database (Not mandatory but prefer to shutdown)
2. Stop Listener (Not mandatory but prefer to shutdown)
3. Backup Oracle INVENTORY
4. Backup ORACLE_HOME

Restore ORACLE_HOME (Incase binary corruption then we can restore from backup)

1. Shutdown Database (Mandatory)
2. Stop Listener (Mandatory)
3. Restore Oracle INVENTORY
4. Restore ORACLE_HOME
___________________________________________________________________________________________________

1. Shutdown Database (Not mandatory but prefer to shutdown)

[oracle@rac1 ~]$ ps -ef | grep pmon
oracle   13474     1  0 15:29 ?        00:00:00 ora_pmon_DELL
oracle   13583 13414  0 15:30 pts/1    00:00:00 grep pmon
[oracle@rac1 ~]$ 

SQL> select name,open_mode from v$database;

NAME      OPEN_MODE
--------- --------------------
DELL      READ WRITE

SQL>

SQL> shut immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>


2. Stop Listener (Not mandatory but prefer to shutdown)

Stop any other processes running from ORACLE_HOME

[oracle@rac1 ~]$ ps -ef | grep tns
root        15     2  0 08:32 ?        00:00:00 [netns]
oracle   13623     1  0 15:31 ?        00:00:00 /u01/app/oracle/product/11.2.0.4/bin/tnslsnr LISTENER_11G -inherit
oracle   13631 13414  0 15:32 pts/1    00:00:00 grep tns
[oracle@rac1 ~]$ lsnrctl stop LISTENER_11G

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 09-DEC-2018 15:32:36

Copyright (c) 1991, 2013, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=rac1.rajasekhar.com)(PORT=1621)))
The command completed successfully
[oracle@rac1 ~]$
[oracle@rac1 ~]$ ps -ef | grep tns
root        15     2  0 08:32 ?        00:00:00 [netns]
oracle   13638 13414  0 15:32 pts/1    00:00:00 grep tns
[oracle@rac1 ~]$


3. Backup Oracle INVENTORY

[oracle@rac1 ~]$ cat /etc/oraInst.loc
inventory_loc=/u01/app/oraInventory
inst_group=dba
[oracle@rac1 app]$ cd /u01/app/
[oracle@rac1 app]$ ls -ltr
total 8
drwxr-xr-x. 10 oracle dba 4096 Nov  7 11:33 oracle
drwxrwx---.  6 oracle dba 4096 Nov  7 20:16 oraInventory
[oracle@rac1 app]$

tar -pcvf /u02/oracle/backup/binary/Backup_OraInv.tar oraInventory

OR

tar -pczvf /u02/oracle/backup/binary/Backup_OraInv.tar oraInventory | gzip > /u02/oracle/backup/binary/Backup_OraInv.tar.gz


4. Backup ORACLE_HOME

[oracle@rac1 product]$ pwd
/u01/app/oracle/product
[oracle@rac1 product]$ ls -ltr
total 12
drwxr-xr-x. 72 oracle dba 4096 Oct 21  2016 12.1.0.2
drwxr-xr-x. 78 oracle dba 4096 Dec  8 15:47 11.2.0.4 <---
drwxr-xr-x. 74 oracle dba 4096 Dec  8 19:38 12.2.0.1
[oracle@rac1 product]$

cd /u01/app/oracle/product
[oracle@rac1 product]$ nohup tar -pcvf /u02/oracle/backup/binary/oracle_home_bkup.tar 11.2.0.4 &
[1] 8848
[oracle@rac1 product]$ nohup: ignoring input and appending output to `nohup.out'

[oracle@rac1 product]$ jobs -l
[1]+  8848 Running                 nohup tar -pcvf /u02/oracle/backup/binary/oracle_home_bkup.tar 11.2.0.4 &
[oracle@rac1 product]$

[oracle@rac1 product]$ ls -ltr
total 2312
drwxr-xr-x. 72 oracle dba    4096 Oct 21  2016 12.1.0.2
drwxr-xr-x. 78 oracle dba    4096 Dec  8 15:47 11.2.0.4
drwxr-xr-x. 74 oracle dba    4096 Dec  8 19:38 12.2.0.1
-rw-------.  1 oracle dba 2354978 Dec 11 17:47 nohup.out
[oracle@rac1 product]$

OR

[oracle@rac1 product]$ nohup tar -pczvf /u02/oracle/backup/binary/oracle_home_bkup.tar 11.2.0.4 | gzip > /u02/oracle/backup/binary/oracle_home_bkup.tar.gz &
[1] 10189
[oracle@rac1 product]$ nohup: ignoring input and redirecting stderr to stdout

[oracle@rac1 product]$ jobs -l
[1]+ 10188 Running                 nohup tar -pczvf /u02/oracle/backup/binary/oracle_home_bkup.tar 11.2.0.4
     10189                       | gzip > /u02/oracle/backup/binary/oracle_home_bkup.tar.gz &
[oracle@rac1 product]$
[oracle@rac1 binary]$ ls -ltr /u02/oracle/backup/binary/oracle_home_bkup*
-rw-r--r--. 1 oracle dba 2752787212 Dec 11 18:22 /u02/oracle/backup/binary/oracle_home_bkup.tar
-rw-r--r--. 1 oracle dba     240299 Dec 11 18:22 /u02/oracle/backup/binary/oracle_home_bkup.tar.gz
[oracle@rac1 binary]$

Restore ORACLE_HOME (Incase binary corruption then we can restore from backup)

1. Shutdown Database (Mandatory)

SQL> shut immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>


2. Stop Listener (Mandatory)

Stop any other processes running from ORACLE_HOME

[oracle@rac1 ~]$ ps -ef | grep tns
root        15     2  0 08:32 ?        00:00:00 [netns]
oracle   13623     1  0 15:31 ?        00:00:00 /u01/app/oracle/product/11.2.0.4/bin/tnslsnr LISTENER_11G -inherit
oracle   13631 13414  0 15:32 pts/1    00:00:00 grep tns
[oracle@rac1 ~]$ lsnrctl stop LISTENER_11G

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 09-DEC-2018 15:32:36

Copyright (c) 1991, 2013, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=rac1.rajasekhar.com)(PORT=1621)))
The command completed successfully
[oracle@rac1 ~]$
[oracle@rac1 ~]$ ps -ef | grep tns
root        15     2  0 08:32 ?        00:00:00 [netns]
oracle   13638 13414  0 15:32 pts/1    00:00:00 grep tns
[oracle@rac1 ~]$


3. Restore Oracle INVENTORY

[oracle@rac1 app]$ cd /u01/app/
[oracle@rac1 app]$

mv oraInventory oraInventory_bkp

tar -pxvf /u02/oracle/backup/binary/Backup_OraInv.tar


4. Restore ORACLE_HOME

[oracle@rac1 product]$ cd /u01/app/oracle/product

[oracle@rac1 product]$ mv 11.2.0.4 11.2.0.4_bkp

tar -pxvf /u01/app/oracle/backup/oracle_home_bkup.tar

Caution: Your use of any information or materials on this website is entirely at your own risk. It is provided for educational purposes only. It has been tested internally, however, we do not guarantee that it will work for you. Ensure that you run it in your test environment before using.

Thank you,
Rajasekhar Amudala
Email: br8dba@gmail.com

Leave a Reply

Your email address will not be published. Required fields are marked *