Wednesday 7 January 2015

How To Deinstall/Uninstall Oracle Home In 11gR2



From 11gR2, de-installing Oracle Home should be done by deinstall tools provided separately. De-installation from 11.2 OUI is desupported.   Please note the following text taken from the 11.2 Installation guides under:
Caution:
When you run the deinstall command, if the central inventory (oraInventory) contains no
other registered homes besides the home that you are deconfiguring and removing, then the
deinstall command removes the following files and directory contents in the Oracle base directory of the Oracle Database installation owner:

 admin
 cfgtoollogs
 checkpoints
 diag
 oradata
 flash_recovery_area

Oracle strongly recommends that you configure your installations using an
Optimal Flexible Architecture (OFA) configuration, and that you reserve Oracle base and
Oracle home paths for exclusive use of Oracle software. If you have any user data in
these locations in the Oracle base that is owned by the user account that owns the Oracle
software, then the deinstall command deletes this data.
It is also suggested that before doing a deinstall on a server where more than one ORACLE_HOME exists there are a valid set of backups for the ORACLE_HOMEs, databases, and oraInventory.
Official documentation presents two methods to remove Oracle Database software:

1) External de-install utility downloadable from OTN ***Recommended method***

It is advised to use the external De-install utility that is downloadable from OTN as currently there are some open bugs with the deinstall script.
To get the external tool :


Under Oracle Database 11g Release 2, click See All for the respective platform for which you want to download the De-install utility.
If the intent is to deinstall 11.2.0.1 or 11.2.0.2 then you should use the latest version of the 11.2 deinstall utility, which would be version 11.2.0.3.0.
The De-install utility is available for download from the following links:


2) Deinstall script located inside Oracle Home (It is highly recommended not use the $ORACLE_HOME deinstall utility for versions 11.2.0.1 and 11.2.0.2, Download an use the 11.2.0.3.0 version):

$ORACLE_HOME/deinstall/deinstall (unix/linux platforms)
%ORACLE_HOME%\deinstall\deinstall.bat (windows platforms)

3) It is possible to run the deinstall utility without doing the deinstall to confirm the deinstall will remove what is expected and allow any potential problems to be sorted out by running the following command:

$ /<path to location of deinstall utility>/deinstall/deinstall -home <path to ORACLE_HOME that is to be removed> -checkonly (unix/linux platforms)
% \<path to location of deinstall utility>\deinstall\deinstall -home <path to ORACLE_HOME that is to be removed> -checkonly (WINDOWS platform)
The logs can be found in one of the locations noted in the LOG LOCATION section below.
This will also generate a parameter file that can be used with interactive or silent deinstall.  The parameter file will be generated in the /<path to location of deinstall utility>/deinstall/response directory.

De-installing Oracle Home using external de-install utility

If Oracle Home deinstall script has some issue and you want to deinstall home then you can download separate de-install utility from OTN and use it.

1. Download and unzip de-install utility in some folder outside Oracle Home.
2. Go to the deinstall folder.

3. Invoke deinstall utility with the -home option specifying the full path of the Oracle Home you want to deinstall.

Example:
$./deinstall -home /data/oracle/app/oracle/product/11.2.0/db_1

4. If you want to do a non-interactive deinstall you can use the -silent option with a parameter file.

Example:

[oracle@NVMBD1BZY150D00 ~]$ cd $ORACLE_HOME
[oracle@NVMBD1BZY150D00 db_1]$ cd deinstall/
[oracle@NVMBD1BZY150D00 deinstall]$ ./deinstall

Checking for required files and bootstrapping ...
Please wait ...
Location of logs /tmp/deinstall2014-12-11_11-21-08AM/logs/

############ ORACLE DEINSTALL & DECONFIG TOOL START ############


######################### CHECK OPERATION START #########################
## [START] Install check configuration ##


Checking for existence of the Oracle home location /data/oracle/app/oracle/product/11.2.0/db_1
Oracle Home type selected for deinstall is: Oracle Single Instance Database
Oracle Base selected for deinstall is: /data/oracle/app/oracle
Checking for existence of central inventory location /data/oracle/app/oraInventory
Checking for sufficient temp space availability on node(s) : 'NVMBD1BZY150D00'

## [END] Install check configuration ##


Network Configuration check config START

Network de-configuration trace file location: /tmp/deinstall2014-12-11_11-21-08AM/logs/netdc_check2014-12-11_11-21-13-AM.log

Specify all Single Instance listeners that are to be de-configured [LISTENER]:

Network Configuration check config END

Database Check Configuration START

Database de-configuration trace file location: /tmp/deinstall2014-12-11_11-21-08AM/logs/databasedc_check2014-12-11_11-21-17-AM.log

Use comma as separator when specifying list of values as input

Specify the list of database names that are configured in this Oracle home [TESTDB]:

###### For Database 'TESTDB' ######

Single Instance Database
The diagnostic destination location of the database: /data/oracle/app/oracle/diag/rdbms/testdb
Storage type used by the Database:

The details of database(s) TESTDB have been discovered automatically. Do you still want to modify the details of TESTDB database(s)? [n]:

Database Check Configuration END

Enterprise Manager Configuration Assistant START

EMCA de-configuration trace file location: /tmp/deinstall2014-12-11_11-21-08AM/logs/emcadc_check2014-12-11_11-21-21-AM.log

Checking configuration for database TESTDB
Enterprise Manager Configuration Assistant END
Oracle Configuration Manager check START
OCM check log file location : /tmp/deinstall2014-12-11_11-21-08AM/logs//ocm_check3625.log
Oracle Configuration Manager check END

######################### CHECK OPERATION END #########################


####################### CHECK OPERATION SUMMARY #######################
Oracle Home selected for deinstall is: /data/oracle/app/oracle/product/11.2.0/db_1
Inventory Location where the Oracle home registered is: /data/oracle/app/oraInventory
Following Single Instance listener(s) will be de-configured: LISTENER
The following databases were selected for de-configuration : TESTDB
Database unique name : TESTDB
Storage used :
No Enterprise Manager configuration to be updated for any database(s)
No Enterprise Manager ASM targets to update
No Enterprise Manager listener targets to migrate
Checking the config status for CCR
Oracle Home exists with CCR directory, but CCR is not configured
CCR check is finished
Do you want to continue (y - yes, n - no)? [n]: Y
A log of this session will be written to: '/tmp/deinstall2014-12-11_11-21-08AM/logs/deinstall_deconfig2014-12-11_11-21-12-AM.out'
Any error messages from this session will be written to: '/tmp/deinstall2014-12-11_11-21-08AM/logs/deinstall_deconfig2014-12-11_11-21-12-AM.err'

######################## CLEAN OPERATION START ########################

Enterprise Manager Configuration Assistant START

EMCA de-configuration trace file location: /tmp/deinstall2014-12-11_11-21-08AM/logs/emcadc_clean2014-12-11_11-21-21-AM.log

Updating Enterprise Manager ASM targets (if any)
Updating Enterprise Manager listener targets (if any)
Enterprise Manager Configuration Assistant END
Database de-configuration trace file location: /tmp/deinstall2014-12-11_11-21-08AM/logs/databasedc_clean2014-12-11_11-21-29-AM.log
Database Clean Configuration START TESTDB
This operation may take few minutes.
Database Clean Configuration END TESTDB

Network Configuration clean config START

Network de-configuration trace file location: /tmp/deinstall2014-12-11_11-21-08AM/logs/netdc_clean2014-12-11_11-21-41-AM.log

De-configuring Single Instance listener(s): LISTENER

De-configuring listener: LISTENER
    Stopping listener: LISTENER
    Listener stopped successfully.
    Deleting listener: LISTENER
    Listener deleted successfully.
Listener de-configured successfully.

De-configuring Listener configuration file...
Listener configuration file de-configured successfully.

De-configuring Naming Methods configuration file...
Naming Methods configuration file de-configured successfully.

De-configuring Local Net Service Names configuration file...
Local Net Service Names configuration file de-configured successfully.

De-configuring backup files...
Backup files de-configured successfully.

The network configuration has been cleaned up successfully.

Network Configuration clean config END

Oracle Configuration Manager clean START
OCM clean log file location : /tmp/deinstall2014-12-11_11-21-08AM/logs//ocm_clean3625.log
Oracle Configuration Manager clean END
Setting the force flag to false
Setting the force flag to cleanup the Oracle Base
Oracle Universal Installer clean START

Detach Oracle home '/data/oracle/app/oracle/product/11.2.0/db_1' from the central inventory on the local node : Done

Delete directory '/data/oracle/app/oracle/product/11.2.0/db_1' on the local node : Done

Delete directory '/data/oracle/app/oraInventory' on the local node : Done

The Oracle Base directory '/data/oracle/app/oracle' will not be removed on local node. The directory is not empty.

Oracle Universal Installer cleanup was successful.

Oracle Universal Installer clean END


## [START] Oracle install clean ##

Clean install operation removing temporary directory '/tmp/deinstall2014-12-11_11-21-08AM' on node 'NVMBD1BZY150D00'

## [END] Oracle install clean ##


######################### CLEAN OPERATION END #########################


####################### CLEAN OPERATION SUMMARY #######################
Successfully de-configured the following database instances : TESTDB
Following Single Instance listener(s) were de-configured successfully: LISTENER
Cleaning the config for CCR
As CCR is not configured, so skipping the cleaning of CCR configuration
CCR clean is finished
Successfully detached Oracle home '/data/oracle/app/oracle/product/11.2.0/db_1' from the central inventory on the local node.
Successfully deleted directory '/data/oracle/app/oracle/product/11.2.0/db_1' on the local node.
Successfully deleted directory '/data/oracle/app/oraInventory' on the local node.
Oracle Universal Installer cleanup was successful.


Run 'rm -rf /etc/oraInst.loc' as root on node(s) 'NVMBD1BZY150D00' at the end of the session.

Run 'rm -rf /opt/ORCLfmap' as root on node(s) 'NVMBD1BZY150D00' at the end of the session.
Oracle deinstall tool successfully cleaned up temporary directories.
#######################################################################


############# ORACLE DEINSTALL & DECONFIG TOOL END #############

[oracle@NVMBD1BZY150D00 deinstall]$

We can also use following parameters while using deinstall utility.

./deinstall -home complete path of Oracle home [-silent] [-checkonly] [-local]
[-cleanupOBase] [-paramfile complete path of input parameter property file] [-params name1=value name2=value . . .]
[-o complete path of directory for saving files] [-help]

5. Check the logs created under <central_inventory>/logs folder for any issue.

6. Check the inventory is updated properly.

7. Check if Oracle Home folder is deleted or not. If not then you have to remove it manually.

LOG LOCATION

- deinstall tool creates logs as per this logic:

a) If there are other oracle home (OUI based) in this Host except one which you are installing then it will create log under <central_inventory>/log folder.

b) If this is last Oracle Home to be deinstalled then current central inventory will also get deleted along with deinstall , therefore in this case it will choose log locations in the following order:

- It will create log directory in current location where deinstall utility is launched.

- If current folder is not writable or remotely mounted (permission issues) then it will create user home directory (/home/oracle) as next option.

- If all criteria above is not met then it will proceed to create log directory under user TEMP location (/tmp).
by following the


I hope this article helped you. Your suggestions/feedback are most welcome.

Keep learning... Have a great day!!!