Friday, July 16, 2021

Drop Database Manually or Drop Database Using dbca and Deinstall/Uninstall Oracle Home

We can drop database and Deinstall Oracle Home:


We can drop database using:

1. Using command line - Manual method - "drop database"
2. Using GUI mode - Using dbca 
3. Using OEM 

[root@oraclelab3 ~]# ps -ef|grep smon
root      4528  4417  0 02:33 pts/2    00:00:00 grep --color=auto smon
oracle   14849     1  0 Jul05 ?        00:00:10 ora_smon_DEVDB
oracle   16256     1  0 Jul05 ?        00:00:10 ora_smon_DEV
oracle   19041     1  0 Jul05 ?        00:00:12 ora_smon_TESTDB
[root@oraclelab3 ~]#

[root@oraclelab3 ~]# cat /etc/oratab
#
# 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.
#
#
TESTDB:/u01/app/oracle/product/19.0.0.0/dbhome_1:N
DEVDB:/u01/app/oracle/product/19.0.0.0/dbhome_1:N
DEV:/u01/app/oracle/product/19.0.0.0/dbhome_1:N
[root@oraclelab3 ~]# 


Demo:

1. Drop DEVDB using manually command 
2. Drop DEV and TESTDB using dbca GUI mode.


DEVDB:

[oracle@oraclelab3 ~]$ . oraenv
ORACLE_SID = [oracle] ? DEVDB
The Oracle base has been set to /u01/app/oracle
[oracle@oraclelab3 ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Thu Jul 15 02:36:38 2021
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> shut immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.

SQL> startup mount exclusive restrict;
ORACLE instance started.

Total System Global Area 2432695144 bytes
Fixed Size                  8899432 bytes
Variable Size             536870912 bytes
Database Buffers         1879048192 bytes
Redo Buffers                7876608 bytes
Database mounted.
SQL> drop database;

Database dropped.

Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
SQL> 

DEV and TESTDB:

./dbca and sleeted delete option to drop the database

Cleanup OR Deinstall/Uninstall Oracle Home:

[oracle@oraclelab3 ~]$ cd /u01/app/oracle/product/19.0.0.0/dbhome_1/deinstall/
[oracle@oraclelab3 deinstall]$ ll
total 172
-rw-r-----. 1 oracle oinstall 55480 Apr 17  2019 bootstrap_files.lst
-rwxr-x---. 1 oracle oinstall 14927 Apr 17  2019 bootstrap.pl
-rwxr-x---. 1 oracle oinstall 11245 Jul  5 00:31 deinstall
-rwxr-x---. 1 oracle oinstall 33171 Apr 17  2019 deinstall.pl
-rw-r-----. 1 oracle oinstall  8479 Sep 19  2017 deinstall.xml
drwxr-xr-x. 2 oracle oinstall   102 Apr 17  2019 jlib
-rw-r-----. 1 oracle oinstall   401 Feb 10  2012 readme.txt
drwxr-xr-x. 2 oracle oinstall    32 Apr 17  2019 response
-rwxr-x---. 1 oracle oinstall 33333 Jan  7  2015 sshUserSetup.sh
drwxr-xr-x. 2 oracle oinstall    33 Apr 17  2019 utl
[oracle@oraclelab3 deinstall]$ cd
[oracle@oraclelab3 ~]$ 

[oracle@oraclelab3 ~]$ /u01/app/oracle/product/19.0.0.0/dbhome_1/deinstall/deinstall
Checking for required files and bootstrapping ...
Please wait ...
Location of logs /tmp/deinstall2021-07-15_02-44-17AM/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/19.0.0.0/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: /tmp/deinstall2021-07-15_02-44-17AM/logs/netdc_check2021-07-15_02-44-30AM.log

Specify all Single Instance listeners that are to be de-configured. Enter .(dot) to deselect all. [LISTENER_DEVDB]:

Network Configuration check config END

Database Check Configuration START

Database de-configuration trace file location: /tmp/deinstall2021-07-15_02-44-17AM/logs/databasedc_check2021-07-15_02-44-30AM.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

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

####################### DECONFIG CHECK OPERATION SUMMARY #######################
Oracle Home selected for deinstall is: /u01/app/oracle/product/19.0.0.0/dbhome_1
Inventory Location where the Oracle home registered is: /u01/app/oraInventory
Following Single Instance listener(s) will be de-configured: LISTENER_DEVDB
Do you want to continue (y - yes, n - no)? [n]: y
A log of this session will be written to: '/tmp/deinstall2021-07-15_02-44-17AM/logs/deinstall_deconfig2021-07-15_02-44-28-AM.out'
Any error messages from this session will be written to: '/tmp/deinstall2021-07-15_02-44-17AM/logs/deinstall_deconfig2021-07-15_02-44-28-AM.err'

######################## DECONFIG CLEAN OPERATION START ########################
Database de-configuration trace file location: /tmp/deinstall2021-07-15_02-44-17AM/logs/databasedc_clean2021-07-15_02-44-30AM.log

Network Configuration clean config START

Network de-configuration trace file location: /tmp/deinstall2021-07-15_02-44-17AM/logs/netdc_clean2021-07-15_02-44-30AM.log

De-configuring Single Instance listener(s): LISTENER_DEVDB

De-configuring listener: LISTENER_DEVDB
    Stopping listener: LISTENER_DEVDB
    Listener stopped successfully.
    Deleting listener: LISTENER_DEVDB
    Listener deleted successfully.
Listener 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

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

####################### DECONFIG CLEAN OPERATION SUMMARY #######################
Following Single Instance listener(s) were de-configured successfully: LISTENER_DEVDB
#######################################################################

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

Using properties file /tmp/deinstall2021-07-15_02-44-17AM/response/deinstall_2021-07-15_02-44-28-AM.rsp
Location of logs /tmp/deinstall2021-07-15_02-44-17AM/logs/

############ ORACLE DEINSTALL TOOL START ############

####################### DEINSTALL CHECK OPERATION SUMMARY #######################
A log of this session will be written to: '/tmp/deinstall2021-07-15_02-44-17AM/logs/deinstall_deconfig2021-07-15_02-44-28-AM.out'
Any error messages from this session will be written to: '/tmp/deinstall2021-07-15_02-44-17AM/logs/deinstall_deconfig2021-07-15_02-44-28-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-15_02-44-17AM/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/19.0.0.0/dbhome_1' from the central inventory on the local node : Done

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

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

The Oracle Base directory '/u01/app/oracle' will not be removed on local node. The directory is not empty. User needs to manually cleanup this directory.

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/oracle/product/19.0.0.0/dbhome_1' from the central inventory on the local node.
Successfully deleted directory '/u01/app/oracle/product/19.0.0.0/dbhome_1' on the local node.
Successfully deleted directory '/u01/app/oraInventory' on the local node.
Oracle Universal Installer cleanup was successful.

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

Run 'rm -r /opt/ORCLfmap' as root on node(s) 'oraclelab3' at the end of the session.
Run 'rm -r /etc/oratab' as root on node(s) 'oraclelab3' at the end of the session.
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 ~]$

[root@oraclelab3 ~]# rm -r /etc/oraInst.loc
rm: remove regular file ‘/etc/oraInst.loc’? y
[root@oraclelab3 ~]# rm -r /opt/ORCLfmap
rm: descend into directory ‘/opt/ORCLfmap’? y
rm: descend into directory ‘/opt/ORCLfmap/prot1_64’? y
rm: descend into directory ‘/opt/ORCLfmap/prot1_64/bin’? y
rm: remove regular file ‘/opt/ORCLfmap/prot1_64/bin/fmputl’? y
rm: remove regular file ‘/opt/ORCLfmap/prot1_64/bin/fmputlhp’? y
rm: remove directory ‘/opt/ORCLfmap/prot1_64/bin’? y
rm: descend into directory ‘/opt/ORCLfmap/prot1_64/etc’? y
rm: remove regular file ‘/opt/ORCLfmap/prot1_64/etc/filemap.ora’? y
rm: remove directory ‘/opt/ORCLfmap/prot1_64/etc’? y
rm: remove directory ‘/opt/ORCLfmap/prot1_64/log’? y
rm: remove directory ‘/opt/ORCLfmap/prot1_64’? y
rm: remove directory ‘/opt/ORCLfmap’? y
[root@oraclelab3 ~]# rm -r /etc/oratab
rm: remove regular file ‘/etc/oratab’? y
[root@oraclelab3 ~]#

Post Verification:

[oracle@oraclelab3 ~]$ cat /etc/oratab
cat: /etc/oratab: No such file or directory

[oracle@oraclelab3 ~]$ cat /etc/oraInst.loc
cat: /etc/oraInst.loc: No such file or directory

[oracle@oraclelab3 ~]$ cd /u01/app/oracle/product/19.0.0.0
[oracle@oraclelab3 19.0.0.0]$ cd ../../..
[oracle@oraclelab3 app]$ ll
total 0
drwxr-xr-x. 5 oracle oinstall 49 Jul 15 02:45 oracle
[oracle@oraclelab3 app]$


Regards,
Mallik

No comments:

Post a Comment

Oracle Enterprise Manager Cloud Control 13c Installation on Oracle Linux 64 bit

Oracle Enterprise Manager Cloud Control 13c Installation on Oracle Linux 64 bit 0. Overview 1. Environment 2. Verify Certification ...