In a real time environment, most of the time we use automation to decommission a database which automatically drop and remove the resources at cluster level but even to run the automation we’ve to understand the basics of decommission process, so that even if a situation comes when the automation got stuck or fail during the decommission process then even after that we would be able to perform the decommission steps manually.
STEP 1: Create oem blackout for the database
In a very first step,
we’ve to create an oem blackout for the database so that we can prevent the
unnecessary flood of the database’s alert.
STEP 2: disable services using srvctl utility
[oracle@oratest2 ~]$
srvctl disable service -s ociprim_svc,uk_prim,uk_svc -d OCIPRIM
STEP 3: close all the pdbs
SQL> set lines 300
SQL> col name for a40
SQL> col restricted for
a30
SQL> select
name,open_mode,restricted from gv$pdbs where con_id>2;
NAME
OPEN_MODE RESTRICTED
----------------------------------------
---------- ------------------------------
UK_PDB
READ WRITE NO
UK_PDB READ WRITE NO
SQL> alter pluggable
database UK_PDB close immediate instances=all;
Pluggable database
altered.
SQL> select name,open_mode,restricted
from gv$pdbs where con_id>2;
NAME
OPEN_MODE RESTRICTED
----------------------------------------
---------- ------------------------------
UK_PDB
MOUNTED
UK_PDB MOUNTED
STEP 4: Set cluster_database parameter as false
SQL> show parameter
cluster_database
NAME TYPE
VALUE
------------------------------------
----------- ------------------------------
cluster_database
boolean TRUE
cluster_database_instances
integer 2
SQL> alter system set
cluster_database=false scope=spfile sid='*';
System altered.
STEP 5: stop cluster database and start only one instance in
mount exclusive restrict mode
[oracle@oratest2 ~]$
srvctl stop database -d OCIPRIM
[oracle@oratest2 ~]$
[oracle@oratest2 ~]$
srvctl status database -d OCIPRIM -v
Instance OCIPRIM1 is not
running on node oratest1
Instance OCIPRIM2 is not
running on node oratest2
[oracle@oratest2 ~]$
sqlplus "/as sysdba"
SQL*Plus: Release
19.0.0.0.0 - Production on Wed Oct 23 11:53:46 2024
Version 19.3.0.0.0
Copyright (c) 1982, 2019,
Oracle. All rights reserved.
Connected to an idle
instance.
SQL> startup mount exclusive restrict
ORACLE instance started.
Total System Global Area
2751459856 bytes
Fixed Size
9138704 bytes
Variable Size 805306368 bytes
Database Buffers 1929379840 bytes
Redo Buffers 7634944 bytes
Database mounted.
STEP 6: Execute drop database command
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
STEP 7: remove database at CRS level
[oracle@oratest2 ~]$ srvctl remove database -d OCIPRIM
Remove the database
OCIPRIM? (y/[n]) y
STEP 8: Remove database jobs scheduled through any other 3rd party tool
STEP 9: Remove rman backup script , if any automation exist
to execut the job
STEP 10: Remove Ldap entries
STEP 11: stop oem agent
STEP 12: Remove database entry from oem agent cosole.