Friday, July 16, 2021

Cleanup Old GI and DB homes || Deinstall Old GI & DB After GI and DB upgradation

Deinstall Old GI & DB After GI and DB upgradation


Once we do GI upgrade we will be having old and new GI home on server, Also entry will be available on central inventory.

Once we do DB upgrade we will be having old and new DB home on server, Also entry will be available on central inventory.

We need to cleanup these Old GI and DB homes from server as well from central inventory

Steps:

1. Verify the current running ASM and DBs:
2. Verify central inventory which contains old and new GI and DB home information:
3. Old DB Home deinstallation:
4. Old GI Home deinstallation:

1. Verify the current running ASM and DBs:

[root@oraclelab3 ~]# ps -ef|grep smon
oracle   11757     1  0 Jul15 ?        00:00:01 ora_smon_DEVDB
oracle   17624     1  0 Jul15 ?        00:00:01 asm_smon_+ASM
root     18001 16233  0 08:07 pts/2    00:00:00 grep --color=auto smon
[root@oraclelab3 ~]# 

[root@oraclelab3 ~]# cat /etc/oratab
#Backup file is  /u01/app/oracle/crsdata/oraclelab3/output/oratab.bak.oraclelab3.oracle line added by Agent
#
# This file is used by ORACLE utilities.  It is created by root.sh
# and updated by either Database Configuration Assistant while creating
# a database or ASM Configuration Assistant while creating ASM instance.
# A colon, ':', is used as the field terminator.  A new line terminates
# the entry.  Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
#   $ORACLE_SID:$ORACLE_HOME:<N|Y>:
#
# The first and second fields are the system identifier and home
# directory of the database respectively.  The third field indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
+ASM:/u01/app/19.0.0.0/grid:N           # line added by Agent
DEVDB:/u01/app/oracle/product/19.0.0.0/dbhome_1:N               # line added by Agent
[root@oraclelab3 ~]#

2. Verify central inventory which contains old and new GI and DB home information:

[root@oraclelab3 ~]# cat /etc/oraInst.loc
inventory_loc=/u01/app/oraInventory
inst_group=oinstall
[root@oraclelab3 ~]#

[root@oraclelab3 ~]# cd /u01/app/oraInventory
[root@oraclelab3 oraInventory]# ll
total 8
drwxrwx---. 6 oracle oinstall 4096 Jul 15 10:49 backup
drwxrwx---. 2 oracle oinstall   81 Jul 15 10:49 ContentsXML
drwxrwx---. 6 oracle oinstall 4096 Jul 15 10:48 logs
drwxrwx---. 2 oracle oinstall   22 Jul 15 09:36 oui
[root@oraclelab3 oraInventory]# cd ContentsXML
[root@oraclelab3 ContentsXML]# ls -ltrh
total 16K
-rw-rw----. 1 oracle oinstall 732 Jul 15 10:49 inventory.xml
-rw-rw----. 1 oracle oinstall 174 Jul 15 10:49 oui-patch.xml
-rw-rw----. 1 oracle oinstall 292 Jul 15 10:49 libs.xml
-rw-rw----. 1 oracle oinstall 300 Jul 15 10:49 comps.xml
[root@oraclelab3 ContentsXML]# pwd
/u01/app/oraInventory/ContentsXML
[root@oraclelab3 ContentsXML]# cat inventory.xml
<?xml version="1.0" standalone="yes" ?>
<!-- Copyright (c) 1999, 2021, Oracle and/or its affiliates.
All rights reserved. -->
<!-- Do not modify the contents of this file by hand. -->
<INVENTORY>
<VERSION_INFO>
   <SAVED_WITH>12.2.0.7.0</SAVED_WITH>
   <MINIMUM_VER>2.1.0.6.0</MINIMUM_VER>
</VERSION_INFO>
<HOME_LIST>
<HOME NAME="OraGI12Home1" LOC="/u01/app/12.2.0.1/grid" TYPE="O" IDX="1"/>
<HOME NAME="OraDB12Home1" LOC="/u01/app/oracle/product/12.2.0.1/dbhome_1" TYPE="O" IDX="2"/>
<HOME NAME="OraGI19Home1" LOC="/u01/app/19.0.0.0/grid" TYPE="O" IDX="3" CRS="true"/>
<HOME NAME="OraDB19Home1" LOC="/u01/app/oracle/product/19.0.0.0/dbhome_1" TYPE="O" IDX="4"/>
</HOME_LIST>
<COMPOSITEHOME_LIST>
</COMPOSITEHOME_LIST>
</INVENTORY>
[root@oraclelab3 ContentsXML]#

3. Old DB Home deinstallation:

[root@oraclelab3 ContentsXML]# su - oracle
Last login: Fri Jul 16 03:45:31 IST 2021
[oracle@oraclelab3 ~]$

[oracle@oraclelab3 ~]$ cd /u01/app/oracle/product/12.2.0.1/dbhome_1/deinstall/
[oracle@oraclelab3 deinstall]$ ll
total 168
-rw-r-----. 1 oracle oinstall 53984 Jan 26  2017 bootstrap_files.lst
-rwxr-x---. 1 oracle oinstall 14198 Oct 12  2016 bootstrap.pl
-rwxr-x---. 1 oracle oinstall 11332 Jul 15 09:38 deinstall
-rwxr-x---. 1 oracle oinstall 32731 Jul 13  2016 deinstall.pl
-rw-r-----. 1 oracle oinstall  8800 Sep 25  2015 deinstall.xml
drwxr-xr-x. 2 oracle oinstall   102 Jul 15 09:36 jlib
-rw-r-----. 1 oracle oinstall   401 Feb 10  2012 readme.txt
drwxr-xr-x. 2 oracle oinstall    32 Jul 15 09:36 response
-rwxr-x---. 1 oracle oinstall 33333 Jan  7  2015 sshUserSetup.sh
drwxr-xr-x. 2 oracle oinstall    33 Jul 15 09:36 utl
[oracle@oraclelab3 deinstall]$ cd
[oracle@oraclelab3 ~]$ /u01/app/oracle/product/12.2.0.1/dbhome_1/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/oracle/product/12.2.0.1/dbhome_1
Oracle Home type selected for deinstall is: Oracle Single Instance Database
Oracle Base selected for deinstall is: /u01/app/oracle
Checking for existence of central inventory location /u01/app/oraInventory

## [END] Install check configuration ##

Network Configuration check config START

Network de-configuration trace file location: /u01/app/oraInventory/logs/netdc_check2021-07-16_08-14-10-AM.log

Network Configuration check config END

Database Check Configuration START

Database de-configuration trace file location: /u01/app/oraInventory/logs/databasedc_check2021-07-16_08-14-11-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 []:
Database Check Configuration END
Oracle Configuration Manager check START
OCM check log file location : /u01/app/oraInventory/logs//ocm_check5642.log
Oracle Configuration Manager check END

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

####################### DECONFIG CHECK OPERATION SUMMARY #######################
Oracle Home selected for deinstall is: /u01/app/oracle/product/12.2.0.1/dbhome_1
Inventory Location where the Oracle home registered is: /u01/app/oraInventory
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: '/u01/app/oraInventory/logs/deinstall_deconfig2021-07-16_08-14-09-AM.out'
Any error messages from this session will be written to: '/u01/app/oraInventory/logs/deinstall_deconfig2021-07-16_08-14-09-AM.err'

######################## DECONFIG CLEAN OPERATION START ########################
Database de-configuration trace file location: /u01/app/oraInventory/logs/databasedc_clean2021-07-16_08-15-09-AM.log

Network Configuration clean config START

Network de-configuration trace file location: /u01/app/oraInventory/logs/netdc_clean2021-07-16_08-15-09-AM.log

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 : /u01/app/oraInventory/logs//ocm_clean5642.log
Oracle Configuration Manager clean END

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

####################### DECONFIG CLEAN OPERATION SUMMARY #######################
Cleaning the config for CCR
As CCR is not configured, so skipping the cleaning of CCR configuration
CCR clean is finished
#######################################################################

############# ORACLE DECONFIG TOOL END #############

Using properties file /tmp/deinstall2021-07-16_08-13-53AM/response/deinstall_2021-07-16_08-14-09-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_deconfig2021-07-16_08-14-09-AM.out'
Any error messages from this session will be written to: '/u01/app/oraInventory/logs/deinstall_deconfig2021-07-16_08-14-09-AM.err'

######################## DEINSTALL CLEAN OPERATION START ########################
## [START] Preparing for Deinstall ##
Setting LOCAL_NODE to oraclelab3
Setting CRS_HOME to false
Setting oracle.installer.invPtrLoc to /tmp/deinstall2021-07-16_08-13-53AM/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/oracle/product/12.2.0.1/dbhome_1' from the central inventory on the local node : Done

Delete directory '/u01/app/oracle/product/12.2.0.1/dbhome_1' on the local node : Done

The Oracle Base directory '/u01/app/oracle' will not be removed on local node. The directory is in use by Oracle Home '/u01/app/12.2.0.1/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 #######################
Run '/u01/app/oracle/tfa/oraclelab3/tfa_home/bin/tfactl uninstall' as root to uninstall tfa.

Successfully detached Oracle home '/u01/app/oracle/product/12.2.0.1/dbhome_1' from the central inventory on the local node.
Successfully deleted directory '/u01/app/oracle/product/12.2.0.1/dbhome_1' on the local node.
Oracle Universal Installer cleanup was successful.

Review the permissions and contents of '/u01/app/oracle' on nodes(s) 'oraclelab3'.
If there are no Oracle home(s) associated with '/u01/app/oracle', manually delete '/u01/app/oracle' and its contents.
Oracle deinstall tool successfully cleaned up temporary directories.
#######################################################################

############# ORACLE DEINSTALL TOOL END #############
[oracle@oraclelab3 ~]$

[oracle@oraclelab3 ~]$ cd /u01/app/oracle/product/12.2.0.1/
[oracle@oraclelab3 12.2.0.1]$ ll
total 0
[oracle@oraclelab3 12.2.0.1]$ cd /u01/app/oraInventory/ContentsXML
[oracle@oraclelab3 ContentsXML]$ ll
total 16
-rw-rw----. 1 oracle oinstall 329 Jul 16 08:15 comps.xml
-rw-rw----. 1 oracle oinstall 744 Jul 16 08:15 inventory.xml
-rw-rw----. 1 oracle oinstall 292 Jul 16 08:15 libs.xml
-rw-rw----. 1 oracle oinstall 174 Jul 15 10:49 oui-patch.xml
[oracle@oraclelab3 ContentsXML]$ cat inventory.xml
<?xml version="1.0" standalone="yes" ?>
<!-- Copyright (c) 1999, 2021, Oracle and/or its affiliates.
All rights reserved. -->
<!-- Do not modify the contents of this file by hand. -->
<INVENTORY>
<VERSION_INFO>
   <SAVED_WITH>12.2.0.1.4</SAVED_WITH>
   <MINIMUM_VER>2.1.0.6.0</MINIMUM_VER>
</VERSION_INFO>
<HOME_LIST>
<HOME NAME="OraGI12Home1" LOC="/u01/app/12.2.0.1/grid" TYPE="O" IDX="1"/>
<HOME NAME="OraGI19Home1" LOC="/u01/app/19.0.0.0/grid" TYPE="O" IDX="3" CRS="true"/>
<HOME NAME="OraDB19Home1" LOC="/u01/app/oracle/product/19.0.0.0/dbhome_1" TYPE="O" IDX="4"/>
<HOME NAME="OraDB12Home1" LOC="/u01/app/oracle/product/12.2.0.1/dbhome_1" TYPE="O" IDX="2" REMOVED="T"/>
</HOME_LIST>
<COMPOSITEHOME_LIST>
</COMPOSITEHOME_LIST>
</INVENTORY>
[oracle@oraclelab3 ContentsXML]$ 

4. Old GI Home deinstallation:

[oracle@oraclelab3 ContentsXML]$ cd /u01/app/12.2.0.1/grid/deinstall/
[oracle@oraclelab3 deinstall]$ ll
total 180
-rw-r-----. 1 oracle oinstall 53984 Jan 26  2017 bootstrap_files.lst
-rwxr-x---. 1 oracle oinstall 14198 Oct 12  2016 bootstrap.pl
-rwxr-x---. 1 oracle oinstall 11313 Jul 15 09:28 deinstall
-rw-r-----. 1 oracle oinstall 11328 Jan 26  2017 deinstall.ouibak
-rwxr-x---. 1 oracle oinstall 32731 Jul 14  2016 deinstall.pl
-rw-r-----. 1 oracle oinstall  8800 Sep 26  2015 deinstall.xml
drwxr-xr-x. 2 oracle oinstall   102 Jul 15 10:24 jlib
-rw-r-----. 1 oracle oinstall   401 Feb 10  2012 readme.txt
drwxr-xr-x. 2 oracle oinstall    32 Jan 26  2017 response
-rwxr-x---. 1 oracle oinstall 33333 Jan  7  2015 sshUserSetup.sh
drwxr-xr-x. 2 oracle oinstall    33 Jan 26  2017 utl
[oracle@oraclelab3 deinstall]$ cd
[oracle@oraclelab3 ~]$ /u01/app/12.2.0.1/grid/deinstall/deinstall/deinstall
-bash: /u01/app/12.2.0.1/grid/deinstall/deinstall/deinstall: Not a directory
[oracle@oraclelab3 ~]$ /u01/app/12.2.0.1/grid/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/12.2.0.1/grid
Oracle Home type selected for deinstall is: Oracle Grid Infrastructure for a Standalone Server
Oracle Base selected for deinstall is: /u01/app/oracle
Checking for existence of central inventory location /u01/app/oraInventory
Checking for existence of the Oracle Grid Infrastructure home /u01/app/19.0.0.0/grid

## [END] Install check configuration ##

Traces log file: /u01/app/oraInventory/logs//crsdc_2021-07-16_08-18-10-AM.log

Network Configuration check config START

Network de-configuration trace file location: /u01/app/oraInventory/logs/netdc_check2021-07-16_08-18-10-AM.log

Network Configuration check config END

Asm Check Configuration START

ASM de-configuration trace file location: /u01/app/oraInventory/logs/asmcadc_check2021-07-16_08-18-11-AM.log

ASM was not detected in the Oracle Home
Database Check Configuration START

Database de-configuration trace file location: /u01/app/oraInventory/logs/databasedc_check2021-07-16_08-18-11-AM.log

Database Check Configuration END

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

####################### DECONFIG CHECK OPERATION SUMMARY #######################
Oracle Grid Infrastructure Home is: /u01/app/19.0.0.0/grid
Oracle Home selected for deinstall is: /u01/app/12.2.0.1/grid
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.0.0.0/grid)
ASM was not detected in the Oracle 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_deconfig2021-07-16_08-18-08-AM.out'
Any error messages from this session will be written to: '/u01/app/oraInventory/logs/deinstall_deconfig2021-07-16_08-18-08-AM.err'

######################## DECONFIG CLEAN OPERATION START ########################
Database de-configuration trace file location: /u01/app/oraInventory/logs/databasedc_clean2021-07-16_08-18-45-AM.log
ASM de-configuration trace file location: /u01/app/oraInventory/logs/asmcadc_clean2021-07-16_08-18-45-AM.log
ASM Clean Configuration END

Network Configuration clean config START

Network de-configuration trace file location: /u01/app/oraInventory/logs/netdc_clean2021-07-16_08-18-45-AM.log

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 backup files...
Backup files de-configured successfully.

The network configuration has been cleaned up successfully.

Network Configuration clean config END

---------------------------------------->

Run the following command as the root user or the administrator on node "oraclelab3".

/u01/app/12.2.0.1/grid/crs/install/roothas.sh -unlock -hahome /u01/app/12.2.0.1/grid -paramfile "/tmp/deinstall2021-07-16_08-17-53AM/response/deinstall_OraGI12Home1.rsp"

Press Enter after you finish running the above commands

<----------------------------------------

***************************************************************
Note:
***************************************************************
Take a new session and run the above command:
[root@oraclelab3 ~]# /u01/app/12.2.0.1/grid/crs/install/roothas.sh -unlock -hahome /u01/app/12.2.0.1/grid -paramfile "/tmp/deinstall2021-07-16_08-17-53AM/response/deinstall_OraGI12Home1.rsp"
Using configuration parameter file: /tmp/deinstall2021-07-16_08-17-53AM/response/deinstall_OraGI12Home1.rsp
The log of current session can be found at:
  /u01/app/oraInventory/logs/haunlock__2021-07-16_08-19-23AM.log
2021/07/16 08:19:29 CLSRSC-347: Successfully unlock /u01/app/12.2.0.1/grid
[root@oraclelab3 ~]#
***************************************************************
***************************************************************

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

####################### DECONFIG CLEAN OPERATION SUMMARY #######################
The home being deconfigured is NOT a configured Grid Infrastructure home (/u01/app/19.0.0.0/grid)
Oracle Restart was successfully unlocked on node "oraclelab3".
#######################################################################

############# ORACLE DECONFIG TOOL END #############

Using properties file /tmp/deinstall2021-07-16_08-17-53AM/response/deinstall_2021-07-16_08-18-08-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_deconfig2021-07-16_08-18-08-AM.out'
Any error messages from this session will be written to: '/u01/app/oraInventory/logs/deinstall_deconfig2021-07-16_08-18-08-AM.err'

######################## DEINSTALL CLEAN OPERATION START ########################
## [START] Preparing for Deinstall ##
Setting LOCAL_NODE to oraclelab3
Setting CRS_HOME to false
Setting oracle.installer.invPtrLoc to /tmp/deinstall2021-07-16_08-17-53AM/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/12.2.0.1/grid' from the central inventory on the local node : Done

Delete directory '/u01/app/12.2.0.1/grid' on the local node : Done

The Oracle Base directory '/u01/app/oracle' will not be removed on local node. The directory is in use by Oracle Home '/u01/app/19.0.0.0/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/12.2.0.1/grid' from the central inventory on the local node.
Successfully deleted directory '/u01/app/12.2.0.1/grid' on the local node.
Oracle Universal Installer cleanup was successful.

Review the permissions and contents of '/u01/app/oracle' on nodes(s) 'oraclelab3'.
If there are no Oracle home(s) associated with '/u01/app/oracle', manually delete '/u01/app/oracle' and its contents.
Oracle deinstall tool successfully cleaned up temporary directories.
#######################################################################

############# ORACLE DEINSTALL TOOL END #############

[oracle@oraclelab3 ~]$

[oracle@oraclelab3 ~]$ cd /u01/app/oraInventory/ContentsXML
[oracle@oraclelab3 ContentsXML]$ ll
total 16
-rw-rw----. 1 oracle oinstall 329 Jul 16 08:20 comps.xml
-rw-rw----. 1 oracle oinstall 756 Jul 16 08:19 inventory.xml
-rw-rw----. 1 oracle oinstall 292 Jul 16 08:20 libs.xml
-rw-rw----. 1 oracle oinstall 174 Jul 15 10:49 oui-patch.xml
[oracle@oraclelab3 ContentsXML]$ cat inventory.xml
<?xml version="1.0" standalone="yes" ?>
<!-- Copyright (c) 1999, 2021, Oracle and/or its affiliates.
All rights reserved. -->
<!-- Do not modify the contents of this file by hand. -->
<INVENTORY>
<VERSION_INFO>
   <SAVED_WITH>12.2.0.1.4</SAVED_WITH>
   <MINIMUM_VER>2.1.0.6.0</MINIMUM_VER>
</VERSION_INFO>
<HOME_LIST>
<HOME NAME="OraGI19Home1" LOC="/u01/app/19.0.0.0/grid" TYPE="O" IDX="3" CRS="true"/>
<HOME NAME="OraDB19Home1" LOC="/u01/app/oracle/product/19.0.0.0/dbhome_1" TYPE="O" IDX="4"/>
<HOME NAME="OraDB12Home1" LOC="/u01/app/oracle/product/12.2.0.1/dbhome_1" TYPE="O" IDX="2" REMOVED="T"/>
<HOME NAME="OraGI12Home1" LOC="/u01/app/12.2.0.1/grid" TYPE="O" IDX="1" REMOVED="T"/>
</HOME_LIST>
<COMPOSITEHOME_LIST>
</COMPOSITEHOME_LIST>
</INVENTORY>
[oracle@oraclelab3 ContentsXML]$ cd /u01/app/12.2.0.1/
[oracle@oraclelab3 12.2.0.1]$ ll
total 0
[oracle@oraclelab3 12.2.0.1]$

Regards,
Mallik

No comments:

Post a Comment

Automation Script | Archivelog Generation Hourly Monitoring

1. List out all the running databases and pic one database where we want to monitore the archive log generation from last 1 month. [oracle@o...