After upgrade to the new GI (from 19.15 to 19.16) spend enough time, all env variables points to the new GI home, so has become the time to delete the old GI home.
As we know, the GI home has the file $GI_HOME/deinstall/deinstall which do all the work instead of us. You should run this script as grid owner. New OS environment variables don't confuse the deinstall script, it checks what it remove.
How it work:
[root@rac1 deinstall]# ./deinstall
You must not be logged in as root to run ./deinstall.
Log in as Oracle user and rerun ./deinstall.
[grid@rac1 deinstall]$ ./deinstall
Checking for required files and bootstrapping ...
Please wait ...
Location of logs /u01/app/oraInventory/logs/
############ ORACLE DECONFIG TOOL START ############
######################### DECONFIG CHECK OPERATION START #########################
## [START] Install check configuration ##
Checking for existence of the Oracle home location /u01/app/19.15
Oracle Home type selected for deinstall is: Oracle Grid Infrastructure for a Cluster
Oracle Base selected for deinstall is: /u01/app/grid
Checking for existence of central inventory location /u01/app/oraInventory
Checking for existence of the Oracle Grid Infrastructure home /u01/app/19.16/grid
The following nodes are part of this cluster: rac1
Checking for sufficient temp space availability on node(s) : 'rac1'
## [END] Install check configuration ##
Traces log file: /u01/app/oraInventory/logs//crsdc_2023-08-14_09-39-54-AM.log
Network Configuration check config START
Network de-configuration trace file location: /u01/app/oraInventory/logs/netdc_check2023-08-14_09-39-54AM.log
Specify all RAC listeners (do not include SCAN listener) that are to be de-configured. Enter .(dot) to deselect all. [ASMNET1LSNR_ASM,LISTENER,LISTENER_SCAN3,LISTENER_SCAN2,LISTENER_SCAN1]:.
Network Configuration check config END
Asm Check Configuration START
ASM de-configuration trace file location: /u01/app/oraInventory/logs/asmcadc_check2023-08-14_09-39-54AM.log
ASM was not detected in the Oracle Home
Database Check Configuration START
Database de-configuration trace file location: /u01/app/oraInventory/logs/databasedc_check2023-08-14_09-39-54AM.log
Oracle Grid Management database was not found in this Grid Infrastructure home
Database Check Configuration END
######################### DECONFIG CHECK OPERATION END #########################
####################### DECONFIG CHECK OPERATION SUMMARY #######################
Oracle Grid Infrastructure Home is: /u01/app/19.16/grid
The following nodes are part of this cluster: rac1
The cluster node(s) on which the Oracle home deinstallation will be performed are:rac1
Oracle Home selected for deinstall is: /u01/app/19.15
Inventory Location where the Oracle home registered is: /u01/app/oraInventory
The home being deconfigured is NOT a configured Grid Infrastructure home (/u01/app/19.16/grid)
ASM was not detected in the Oracle Home
Oracle Grid Management database was not found in this Grid Infrastructure home
Do you want to continue (y - yes, n - no)? [n]: y
A log of this session will be written to: '/u01/app/oraInventory/logs/deinstall_deconfig2023-08-14_09-39-53-AM.out'
Any error messages from this session will be written to: '/u01/app/oraInventory/logs/deinstall_deconfig2023-08-14_09-39-53-AM.err'
######################## DECONFIG CLEAN OPERATION START ########################
Database de-configuration trace file location: /u01/app/oraInventory/logs/databasedc_clean2023-08-14_09-39-54AM.log
ASM de-configuration trace file location: /u01/app/oraInventory/logs/asmcadc_clean2023-08-14_09-39-54AM.log
ASM Clean Configuration END
Network Configuration clean config START
Network de-configuration trace file location: /u01/app/oraInventory/logs/netdc_clean2023-08-14_09-39-54AM.log
De-configuring Naming Methods configuration file on all nodes...
Naming Methods configuration file de-configured successfully.
De-configuring Local Net Service Names configuration file on all nodes...
Local Net Service Names configuration file de-configured successfully.
De-configuring Directory Usage configuration file on all nodes...
Directory Usage configuration file de-configured successfully.
De-configuring backup files on all nodes...
Backup files de-configured successfully.
The network configuration has been cleaned up successfully.
Network Configuration clean config END
---------------------------------------->
The deconfig command below can be executed in parallel on all the remote nodes. Execute the command on the local node after the execution completes on all the remote nodes.
Run the following command as the root user or the administrator on node "rac1".
/u01/app/19.15/crs/install/rootcrs.sh -unlock -crshome /u01/app/19.15 -paramfile "/tmp/deinstall2023-08-14_09-39-33AM/response/deinstall_OraGI19Home2.rsp"
Press Enter after you finish running the above commands
<----------------------------------------
Here i switched to next window and run rootcrs.sh:
[root@rac1 deinstall]# /u01/app/19.15/crs/install/rootcrs.sh -unlock -crshome /u01/app/19.15 -paramfile "/tmp/deinstall2023-08-14_09-39-33AM/response/deinstall_OraGI19Home2.rsp"
Using configuration parameter file: /tmp/deinstall2023-08-14_09-39-33AM/response/deinstall_OraGI19Home2.rsp
The log of current session can be found at:
/u01/app/oraInventory/logs/crsunlock_rac1_2023-08-14_09-43-43AM.log
2023/08/14 09:43:48 CLSRSC-347: Successfully unlock /u01/app/19.15
<----------------------------------------
######################### DECONFIG CLEAN OPERATION END #########################
####################### DECONFIG CLEAN OPERATION SUMMARY #######################
There is no Oracle Grid Management database to de-configure in this Grid Infrastructure home
The home being deconfigured is NOT a configured Grid Infrastructure home (/u01/app/19.16/grid)
Oracle Clusterware was successfully unlocked on node "rac1".
#######################################################################
############# ORACLE DECONFIG TOOL END #############
Using properties file /tmp/deinstall2023-08-14_09-39-33AM/response/deinstall_2023-08-14_09-39-53-AM.rsp
Location of logs /u01/app/oraInventory/logs/
############ ORACLE DEINSTALL TOOL START ############
####################### DEINSTALL CHECK OPERATION SUMMARY #######################
A log of this session will be written to: '/u01/app/oraInventory/logs/deinstall_deconfig2023-08-14_09-39-53-AM.out'
Any error messages from this session will be written to: '/u01/app/oraInventory/logs/deinstall_deconfig2023-08-14_09-39-53-AM.err'
######################## DEINSTALL CLEAN OPERATION START ########################
## [START] Preparing for Deinstall ##
Setting LOCAL_NODE to rac1
Setting CLUSTER_NODES to rac1
Setting CRS_HOME to false
Setting oracle.installer.invPtrLoc to /tmp/deinstall2023-08-14_09-39-33AM/oraInst.loc
Setting oracle.installer.local to false
## [END] Preparing for Deinstall ##
Setting the force flag to false
Setting the force flag to cleanup the Oracle Base
Oracle Universal Installer clean START
Detach Oracle home '/u01/app/19.15' from the central inventory on the local node : Done
Failed to delete the directory '/u01/app/19.15/gpnp/gpnp_bcp__2023_6_3_91739'. Either user has no permission to delete or it is in use.
Failed to delete the directory '/u01/app/19.15/gpnp'. The directory is not empty.
Failed to delete the directory '/u01/app/19.15'. The directory is not empty.
Delete directory '/u01/app/19.15' on the local node : Failed <<<<
The Oracle Base directory '/u01/app/grid' will not be removed on local node. The directory is in use by Oracle Home '/u01/app/19.16/grid'.
Oracle Universal Installer cleanup was successful.
Oracle Universal Installer clean END
## [START] Oracle install clean ##
## [END] Oracle install clean ##
######################### DEINSTALL CLEAN OPERATION END #########################
####################### DEINSTALL CLEAN OPERATION SUMMARY #######################
Successfully detached Oracle home '/u01/app/19.15' from the central inventory on the local node.
Failed to delete directory '/u01/app/19.15' on the local node due to error : Either user has no permission to delete or file is in use.
Review the permissions and manually delete '/u01/app/19.15' on local node.
Oracle Universal Installer cleanup was successful.
Review the permissions and contents of '/u01/app/grid' on nodes(s) 'rac1'.
If there are no Oracle home(s) associated with '/u01/app/grid', manually delete '/u01/app/grid' and its contents.
Oracle deinstall tool successfully cleaned up temporary directories.
#######################################################################
############# ORACLE DEINSTALL TOOL END #############
[grid@rac1 deinstall]$
On 2nd node:
[grid@rac2 deinstall]$ cd /u01/app/19.15/deinstall/
[grid@rac2 deinstall]$ ./deinstall
Checking for required files and bootstrapping ...
Please wait ...
Location of logs /u01/app/oraInventory/logs/
############ ORACLE DECONFIG TOOL START ############
######################### DECONFIG CHECK OPERATION START #########################
## [START] Install check configuration ##
Remote nodes on which old homes will be deleted:
Checking for existence of the Oracle home location /u01/app/19.15
Oracle Home type selected for deinstall is: Oracle Grid Infrastructure for a Cluster
Oracle Base selected for deinstall is: /u01/app/grid
Checking for existence of central inventory location /u01/app/oraInventory
Checking for existence of the Oracle Grid Infrastructure home /u01/app/19.16/grid
The following nodes are part of this cluster: rac2,rac1
Checking for sufficient temp space availability on node(s) : 'rac2'
## [END] Install check configuration ##
Traces log file: /u01/app/oraInventory/logs//crsdc_2023-08-14_10-32-34-AM.log
Network Configuration check config START
Network de-configuration trace file location: /u01/app/oraInventory/logs/netdc_check2023-08-14_10-32-34AM.log
Network Configuration check config END
Asm Check Configuration START
ASM de-configuration trace file location: /u01/app/oraInventory/logs/asmcadc_check2023-08-14_10-32-34AM.log
ASM was not detected in the Oracle Home
Database Check Configuration START
Database de-configuration trace file location: /u01/app/oraInventory/logs/databasedc_check2023-08-14_10-32-34AM.log
Oracle Grid Management database was not found in this Grid Infrastructure home
Database Check Configuration END
######################### DECONFIG CHECK OPERATION END #########################
####################### DECONFIG CHECK OPERATION SUMMARY #######################
Oracle Grid Infrastructure Home is: /u01/app/19.16/grid
The following nodes are part of this cluster: rac2,rac1
The cluster node(s) on which the Oracle home deinstallation will be performed are:rac2
Oracle Home selected for deinstall is: /u01/app/19.15
Inventory Location where the Oracle home registered is: /u01/app/oraInventory
The home being deconfigured is NOT a configured Grid Infrastructure home (/u01/app/19.16/grid)
ASM was not detected in the Oracle Home
Oracle Grid Management database was not found in this Grid Infrastructure home
Do you want to continue (y - yes, n - no)? [n]: y
A log of this session will be written to: '/u01/app/oraInventory/logs/deinstall_deconfig2023-08-14_10-32-21-AM.out'
Any error messages from this session will be written to: '/u01/app/oraInventory/logs/deinstall_deconfig2023-08-14_10-32-21-AM.err'
######################## DECONFIG CLEAN OPERATION START ########################
Database de-configuration trace file location: /u01/app/oraInventory/logs/databasedc_clean2023-08-14_10-32-34AM.log
ASM de-configuration trace file location: /u01/app/oraInventory/logs/asmcadc_clean2023-08-14_10-32-34AM.log
ASM Clean Configuration END
Network Configuration clean config START
Network de-configuration trace file location: /u01/app/oraInventory/logs/netdc_clean2023-08-14_10-32-34AM.log
De-configuring Naming Methods configuration file on all nodes...
Naming Methods configuration file de-configured successfully.
De-configuring Local Net Service Names configuration file on all nodes...
Local Net Service Names configuration file de-configured successfully.
De-configuring Directory Usage configuration file on all nodes...
Directory Usage configuration file de-configured successfully.
De-configuring backup files on all nodes...
Backup files de-configured successfully.
The network configuration has been cleaned up successfully.
Network Configuration clean config END
---------------------------------------->
The deconfig command below can be executed in parallel on all the remote nodes. Execute the command on the local node after the execution completes on all the remote nodes.
Run the following command as the root user or the administrator on node "rac2".
/u01/app/19.15/crs/install/rootcrs.sh -unlock -crshome /u01/app/19.15 -paramfile "/tmp/deinstall2023-08-14_10-32-13AM/response/deinstall_OraGI19Home2.rsp"
Press Enter after you finish running the above commands
<----------------------------------------
[root@rac2 ~]# /u01/app/19.15/crs/install/rootcrs.sh -unlock -crshome /u01/app/19.15 -paramfile "/tmp/deinstall2023-08-14_10-32-13AM/response/deinstall_OraGI19Home2.rsp"
Using configuration parameter file: /tmp/deinstall2023-08-14_10-32-13AM/response/deinstall_OraGI19Home2.rsp
The log of current session can be found at:
/u01/app/oraInventory/logs/crsunlock_rac2_2023-08-14_10-35-28AM.log
2023/08/14 10:35:36 CLSRSC-347: Successfully unlock /u01/app/19.15
[root@rac2 ~]#
<----------------------------------------
######################### DECONFIG CLEAN OPERATION END #########################
####################### DECONFIG CLEAN OPERATION SUMMARY #######################
There is no Oracle Grid Management database to de-configure in this Grid Infrastructure home
The home being deconfigured is NOT a configured Grid Infrastructure home (/u01/app/19.16/grid)
Oracle Clusterware was successfully unlocked on node "rac2".
#######################################################################
############# ORACLE DECONFIG TOOL END #############
Using properties file /tmp/deinstall2023-08-14_10-32-13AM/response/deinstall_2023-08-14_10-32-21-AM.rsp
Location of logs /u01/app/oraInventory/logs/
############ ORACLE DEINSTALL TOOL START ############
####################### DEINSTALL CHECK OPERATION SUMMARY #######################
A log of this session will be written to: '/u01/app/oraInventory/logs/deinstall_deconfig2023-08-14_10-32-21-AM.out'
Any error messages from this session will be written to: '/u01/app/oraInventory/logs/deinstall_deconfig2023-08-14_10-32-21-AM.err'
######################## DEINSTALL CLEAN OPERATION START ########################
## [START] Preparing for Deinstall ##
Setting LOCAL_NODE to rac2
Setting CLUSTER_NODES to rac2
Setting CRS_HOME to false
Setting oracle.installer.invPtrLoc to /tmp/deinstall2023-08-14_10-32-13AM/oraInst.loc
Setting oracle.installer.local to false
## [END] Preparing for Deinstall ##
Setting the force flag to false
Setting the force flag to cleanup the Oracle Base
Oracle Universal Installer clean START
Detach Oracle home '/u01/app/19.15' from the central inventory on the local node : Done
Failed to delete the directory '/u01/app/19.15/gpnp/gpnp_bcp__2023_6_3_93314'. Either user has no permission to delete or it is in use.
Failed to delete the directory '/u01/app/19.15/gpnp'. The directory is not empty.
Failed to delete the directory '/u01/app/19.15'. The directory is not empty.
Delete directory '/u01/app/19.15' on the local node : Failed <<<<
The Oracle Base directory '/u01/app/grid' will not be removed on local node. The directory is in use by Oracle Home '/u01/app/19.16/grid'.
Oracle Universal Installer cleanup was successful.
Oracle Universal Installer clean END
## [START] Oracle install clean ##
## [END] Oracle install clean ##
######################### DEINSTALL CLEAN OPERATION END #########################
####################### DEINSTALL CLEAN OPERATION SUMMARY #######################
Successfully detached Oracle home '/u01/app/19.15' from the central inventory on the local node.
Failed to delete directory '/u01/app/19.15' on the local node due to error : Either user has no permission to delete or file is in use.
Review the permissions and manually delete '/u01/app/19.15' on local node.
Oracle Universal Installer cleanup was successful.
Review the permissions and contents of '/u01/app/grid' on nodes(s) 'rac2'.
If there are no Oracle home(s) associated with '/u01/app/grid', manually delete '/u01/app/grid' and its contents.
Oracle deinstall tool successfully cleaned up temporary directories.
#######################################################################
############# ORACLE DEINSTALL TOOL END #############
[grid@rac2 deinstall]$
Files in Grid Home: