Search Blog Post

Monday, August 12, 2013

How to Drop Database 11gR2 on LINUX

Dropping a database will remove all corresponding datafiles, redo log files and control files. The database must be mounted in exclusive and restricted mode.
Drop database command will not do any effect on archived log files and backups of the database. Drop database command will not delete the files on RAW disks.
If you created your database with DBCA, you can use the same DBCA tool to drop the database.

1. Set the environment
[oraprod@oracleupk 11.2.0]$ . ./TEST_oracleupk.env


2. [oraprod@oracleupk ~]$ sqlplus '/as sysdba'

SQL*Plus: Release 11.2.0.3.0 Production on Mon Aug 12 05:45:20 2013

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options


NOTE :  Drop database does not work when the database is opened in normal open mode




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

SQL> select instance_name,status from v$instance;
select instance_name,status from v$instance
*
ERROR at line 1:
ORA-01034: ORACLE not available
Process ID: 31789
Session ID: 117 Serial number: 277



4. SQL> startup mount exclusive restrict;
ORACLE instance started.

Total System Global Area 1068937216 bytes
Fixed Size                  2235208 bytes
Variable Size             444597432 bytes
Database Buffers          608174080 bytes
Redo Buffers               13930496 bytes
Database mounted.

SQL> select instance_name,status from v$instance;

INSTANCE_NAME    STATUS
---------------- ------------
TEST             MOUNTED





5. SQL>  drop database;

Database dropped.

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

Now, all the Control files, redo log files and Datafiles are automatically removed but you can still see the Parameter file and archivelog files.

Note:     If your database is running on windows you have to remove the registry entries manually.




 

No comments:

Post a Comment