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
Backup ORACLE_HOME and INVENTORY
1. Shutdown Database (Not mandatory but prefer to shutdown)
[oracle@node1 ~]$ ps -ef | grep pmon oracle 487 316 0 12:05 pts/0 00:00:00 grep --color=auto pmon SQL> select name,open_mode from v$database; NAME OPEN_MODE --------- -------------------- PRIM READ WRITE SQL> shu immediate; Database closed. Database dismounted. ORACLE instance shut down.
2. Stop Listener (Not mandatory but prefer to shutdown)
- Stop any other processes running from ORACLE_HOME
[oracle@node1 ~]$ ps -ef|grep tns root 23 2 0 May27 ? 00:00:00 [netns] oracle 3445 1 0 12:33 ? 00:00:00 /data/app/oracle/product/19C/dbhome_3/bin/tnslsnr LISTENER -inherit oracle 3493 3357 0 12:34 pts/0 00:00:00 grep --color=auto tns [oracle@node1 ~]$ lsnrctl stop LISTENER LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 31-MAY-2024 12:35:12 Copyright (c) 1991, 2019, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=node1.learnomate.org)(PORT=1521))) The command completed successfully [oracle@node1 ~]$ ps -ef|grep tns root 23 2 0 May27 ? 00:00:00 [netns] oracle 3766 3357 0 12:37 pts/0 00:00:00 grep --color=auto tns
3. Backup Oracle INVENTORY
[oracle@node1 ~]$ cat /etc/oraInst.loc inventory_loc=/data/app/oraInventory inst_group=oinstall [oracle@node1 ~]$ cd /data/app [oracle@node1 app]$ ls -lrt total 8 drwxrwxr-x. 9 oracle oinstall 4096 May 13 15:21 oracle drwxrwx---. 6 oracle oinstall 4096 May 31 12:06 oraInventory [oracle@node1 app]$ [oracle@node1 app]$ tar -pcvf /u01/oracle/backup/binary/Backup_OraInv.tar oraInventory OR [oracle@node1 app]$ tar -pczvf /u01/oracle/backup/binary/Backup_OraInv.tar oraInventory | gzip > /u01/oracle/backup/binary/Backup_OraInv.tar.gz
4. Backup ORACLE_HOME
[oracle@node1 product]$ pwd /data/app/oracle/product [oracle@node1 product]$ ll total 0 drwxrwxr-x. 3 oracle oinstall 22 May 7 16:10 19C [oracle@node1 product]$ nohup tar -pcvf /u01/oracle/backup/binary/oracle_home_bkup.tar 19C & [1] 5321 [oracle@node1 product]$ nohup: ignoring input and appending output to ‘nohup.out’ 1]+ Exit 2 nohup tar -pcvf /u01/oracle/backup/binary/oracle_home_bkup.tar 19C [oracle@node1 product]$ jobs -l [oracle@node1 product]$ [oracle@node1 product]$ [oracle@node1 product]$ [oracle@node1 product]$ ls -lrt total 4 drwxrwxr-x. 3 oracle oinstall 22 May 7 16:10 19C -rw-------. 1 oracle oinstall 270 May 31 12:52 nohup.out
Restore ORACLE_HOME (Incase binary corruption then we can restore from backup)
1. Shutdown Database (Mandatory)
SQL> shu immediate; Database closed. Database dismounted. ORACLE instance shut down.
2. Stop Listener (Mandatory)
Stop any other processes running from ORACLE_HOME
[oracle@node1 ~]$ ps -ef|grep tns root 23 2 0 May27 ? 00:00:00 [netns] oracle 3445 1 0 12:33 ? 00:00:00 /data/app/oracle/product/19C/dbhome_3/bin/tnslsnr LISTENER -inherit oracle 3493 3357 0 12:34 pts/0 00:00:00 grep --color=auto tns [oracle@node1 ~]$ [oracle@node1 ~]$ [oracle@node1 ~]$ lsnrctl stop LISTENER LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 31-MAY-2024 12:35:12 Copyright (c) 1991, 2019, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=node1.learnomate.org)(PORT=1521))) The command completed successfully [oracle@node1 ~]$ [oracle@node1 ~]$ [oracle@node1 ~]$ ps -ef|grep tns root 23 2 0 May27 ? 00:00:00 [netns] oracle 3766 3357 0 12:37 pts/0 00:00:00 grep --color=auto tns
3. Restore Oracle INVENTORY
[oracle@node1 app]$ ll total 8 drwxrwxr-x. 9 oracle oinstall 4096 May 13 15:21 oracle drwxrwx---. 6 oracle oinstall 4096 May 31 12:06 oraInventory [oracle@node1 app]$ mv oraInventory oraInventory_bkp [oracle@node1 app]$ ll total 8 drwxrwxr-x. 9 oracle oinstall 4096 May 13 15:21 oracle drwxrwx---. 6 oracle oinstall 4096 May 31 12:06 oraInventory_bkp [oracle@node1 app] [oracle@node1 app] [oracle@node1 app]$ tar -pxvf /u01/oracle/backup/binary/Backup_OraInv.tar
4. Restore ORACLE_HOME
[oracle@node1 product]$ mv 19C 19C_bkp [oracle@node1 product]$ ll total 4 drwxrwxr-x. 3 oracle oinstall 22 May 7 16:10 19C_bkp -rw-------. 1 oracle oinstall 270 May 31 12:52 nohup.out [oracle@node1 product]$ tar -pxvf /u02/app/oracle/backup/oracle_home_bkup.tar