Deinstall Old Oracle Homes

Removing old Oracle Grid and Database Homes #JoelKallmanDay

After you patch your database servers grid and database homes whether using out-of-place method or fleet patching method, you should remove the old Oracle Homes. 

As a precautionary measure, I keep old Oracle Homes at least 15 days and once i am comfortable with the new ones, then i remove old ones.

Removing old Oracle Grid Infrastructure Home with deinstall command: 

[oracle@oravt01 ~]$ export OLD_ORACLE_HOME=/u01/app/19/grid
[oracle@oravt01 ~]$ $OLD_ORACLE_HOME/deinstall/deinstall
–Answer interactively.
[oracle@oravt01 ~]$ rm -rf /u01/app/19/

The deinstall command detects cluster nodes, displays a short summary, asks for confirmation, operates on all nodes and warns you to run root.sh on all nodes, and usually leaves some leftovers. I also remove the old directory. After deinstallation, old grid home is flagged as deleted in the inventory.xml under oraInventory. Old Grid Home is tagged with Removed=“T” attribute.

Users can also cleanup a Oracle Grid Home using fleet maintenance by means of CLEANUP_SOFTWARE. More information is available on EM 13c : Usage of CLEANUP_SOFTWARE Verb In Fleet Maintenance (Doc ID 2570023.1).

Removing old Oracle Grid Infrastructure Home with cleanup_sofware verb in fleet maintenance:

[oracle@oravt01 ~]$ /u01/app/oracle/em_agent/GoldImage_GI135v6/agent_13.5.0.0.0/bin/emctl config agent listtargets | grep oracle_home
[OraGI19Home1_1_oravt01.bjk_3271, oracle_home] —> OLD_GRID_HOME – double check from EMCC targets menu.
[OraDB19Home1_2_oravt01.bjk_6741, oracle_home]
[OraHome2_4_oravt01.bjk_2369, oracle_home]
[OraGI19Home2_5_oravt01.bjk_1255, oracle_home]
[OraDB19Home2_6_oravt01.bjk_5493, oracle_home]
[oracle@oracc Setup]$ /u01/app/oracle/em135/oms/bin/emcli db_software_maintenance -performOperation -name="CLEANUP_SOFTWARE_oravt0102grid" \
-purpose="CLEANUP_SOFTWARE" -target_list=OraGI19Home1_1_oravt01.bjk_3271,OraGI19Home1_1_oravt02.bjk_3271 -target_type=oracle_home \
-normal_credential=ORACLE@ORAVT01-02:SYSMAN -privilege_credential=ROOT@ORAVT01-02:SYSMAN -workDir=/tmp
[oracle@oravt01 ~]$ rm -rf /u01/app/19/

This method also leaves some leftovers. In both methods, remove the old directory.  If you encounter “The following Oracle homes are candidate for removal by policy. However, they CANNOT BE DELETED since one or more instances are running on these Oracle homes. ” error, first make sure that your resources are not using it, if not then check associated targets from EMCC Targets menu and update these targets configurations home properties with the new home values and retry operation.

Removing old Oracle Database Home with deinstall command: 

[oracle@oravt01 ~]$ export OLD_ORACLE_HOME=/u01/app/oracle/product/19.0.0.0/dbhome_1
[oracle@oravt01 ~]$ $OLD_ORACLE_HOME/deinstall/deinstall
–Answer interactively.
[oracle@oravt01 ~]$ rm -rf /u01/app/oracle/product/19.0.0.0

Removing old Oracle Database Home with cleanup_sofware verb in fleet maintenance:

[oracle@oravt01 ~]$ /u01/app/oracle/em_agent/GoldImage_GI135v6/agent_13.5.0.0.0/bin/emctl config agent listtargets | grep oracle_home
[OraGI19Home1_1_oravt01.bjk_3271, oracle_home]
[OraDB19Home1_2_oravt01.bjk_6741, oracle_home] —> OLD_DB_HOME – double check from EMCC targets menu.
[OraHome2_4_oravt01.bjk_2369, oracle_home]
[OraGI19Home2_5_oravt01.bjk_1255, oracle_home]
[OraDB19Home2_6_oravt01.bjk_5493, oracle_home]
[oracle@oracc Setup]$ /u01/app/oracle/em135/oms/bin/emcli db_software_maintenance -performOperation -name="CLEANUP_SOFTWARE_oravt0102db" \
-purpose="CLEANUP_SOFTWARE" -target_list=OraDB19Home1_2_oravt01.bjk_6741,OraDB19Home1_2_oravt02.bjk_6741 -target_type=oracle_home \
-normal_credential=ORACLE@ORAVT01-02:SYSMAN -privilege_credential=ROOT@ORAVT01-02:SYSMAN -workDir=/tmp
[oracle@oravt01 ~]$ rm -rf /u01/app/oracle/product/19.0.0.0

Hope it helps.

See you on Bonus Step – What a Wonderful Patch. (Database Patching Tips) 


Discover More from Osman DİNÇ


Comments

Leave your comment