Sunday, November 07, 2010

Drop Oracle DB by sqlplus (RAC)

Just write about drop Oracle Database by using SQL*Plus. If we use Oracle Database RAC. we should stop Instances, except one node.

$ env | grep SID
ORACLE_SID=DB1

$ sqlplus / as sysdba

SQL> alter system set cluster_database=FALSE scope=spfile;

System altered.

SQL> shutdown immediate;

SQL> startup mount exclusive;
ORACLE instance started.

Total System Global Area 4294967296 bytes
Fixed Size 2089472 bytes
Variable Size 671092224 bytes
Database Buffers 3607101440 bytes
Redo Buffers 14684160 bytes
Database mounted.

SQL> alter system enable restricted session;

System altered.

SQL> select name from v$database;

NAME
---------
DB

SQL> drop database;

Database dropped.
done...

2 comments:

Martin Berger said...

What is the advantage of a drop database;?
At the end, I have to get rid of all the files,configs and resources in a clustered env. So for me the drop is just additional work without some additional value.
Did I miss any goodie here?

Surachart Opun said...

Don't to use GUI.
However on RAC resources, we have to remove database/instance manual.

srvctl remove database -d <name> [-f]
srvctl remove instance -d <name> -i <inst_name> [-f]