Search This Blog

Saturday, September 8, 2007

Dropping a Database


Dropping a database involves removing its datafiles, redo log files, control files, and initialization parameter files. The DROP DATABASE statement deletes all control files and all other database files listed in the control file. To use the DROP DATABASE statement successfully, all of the following conditions must apply:



The database must be mounted and closed.


SQL> select status from v$instance;

STATUS
------------
MOUNTED


The database must be mounted as RESTRICTED.


SQL> select logins from v$instance;

LOGINS
----------
RESTRICTED



The DROP DATABASE statement has no effect on archived log files, nor does it have any effect on copies or backups of the database. It is best to use RMAN to delete such files. If the database is on raw disks, the actual raw disk special files are not deleted.



SQL> drop database;

Database dropped.


Note: Manually delete below folder.
1. $ORACLE_BASE/oradata/[sid]
2. $ORACLE_BASE/admin/[sid]
3. $ORACLE_BASE/flash_recovery_area/[sid]
4. If database created through DBCA then you have to also delete ORACLE_SID through DBCA otherwise you will get error message when you create new database with same ORACLE_SID.

No comments: