Wednesday, September 1, 2021

Manually Drop RAC Database and Remove From Clusterware

Manually Drop RAC Database and Remove From Clusterware


1. Verify RAC database status:

[oracle@oraclenode1 ~]$ . oraenv
ORACLE_SID = [oracle] ? RACSB1
The Oracle base has been set to /u01/app/oracle
[oracle@oraclenode1 ~]$ srvctl status database -d RACSB
Instance RACSB1 is running on node oraclenode1
Instance RACSB2 is running on node oraclenode2
[oracle@oraclenode1 ~]$

2. Stop RAC database and start in exclusive restrict mode

[oracle@oraclenode1 ~]$ srvctl stop database -d RACSB
[oracle@oraclenode1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Wed Sep 1 01:33:54 2021

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

Connected to an idle instance.

SQL> startup mount exclusive restrict and try to drop DB which will fail;
ORACLE instance started.

Total System Global Area 3070230528 bytes
Fixed Size                  8625416 bytes
Variable Size             838861560 bytes
Database Buffers         2214592512 bytes
Redo Buffers                8151040 bytes
Database mounted.

SQL> drop database;
drop database
*
ERROR at line 1:
ORA-01586: database must be mounted EXCLUSIVE and not open for this operation

SQL> shut immediate;
ORA-01109: database not open

Database dismounted.
ORACLE instance shut down.
SQL> startup nomount;
ORACLE instance started.

Total System Global Area 3070230528 bytes
Fixed Size                  8625416 bytes
Variable Size             838861560 bytes
Database Buffers         2214592512 bytes
Redo Buffers                8151040 bytes

### only way to open your RAC database is EXCLUSIVE session is to set cluster_database=FALSE ###

3. Set cluster_database=FALSE and start DB in exclusive restrict mode

SQL> alter system set cluster_database=FALSE scope=spfile sid='*';

System altered.

SQL> shut immediate;
ORA-01507: database not mounted

ORACLE instance shut down.
SQL> startup mount exclusive restrict;
ORACLE instance started.

Total System Global Area 3070230528 bytes
Fixed Size                  8625416 bytes
Variable Size             771752696 bytes
Database Buffers         2281701376 bytes
Redo Buffers                8151040 bytes
Database mounted.
SQL> select instance_name,status,logins from v$Instance;

INSTANCE_NAME    STATUS       LOGINS
---------------- ------------ ----------
RACSB1           MOUNTED      RESTRICTED

4. Drop Database

SQL> drop database;

Database dropped.

Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL> exit

5. Remove database from cluster

[oracle@oraclenode1 ~]$ srvctl remove database -d RACSB
Remove the database RACSB? (y/[n]) y
[oracle@oraclenode1 ~]$

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...