Before 10 Gb, there are only two methods to completely delete the database. One is to delete the database using the dbca graphical tool, and the other is to close the database, manually delete data files, control files, and log files.
Starting from 10 Gb, Oracle provides the drop database syntax, making database deletion very simple.
However, drop database still has certain restrictions:
SQL> Conn/As sysdba
Connected.
SQL> DROP DATABASE;
DROP DATABASE
*
Error at line 1:
ORA-01586: database must be mounted exclusive and not open for this operation
SQL> alter database close;
Database altered.
SQL> DROP DATABASE;
DROP DATABASE
*
Error at line 1:
ORA-12719: operation requires database is in restricted mode
SQL> alter system enable restricted session;
System altered.
SQL> DROP DATABASE;
Database dropped.
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.3.0-64bit Production
With the partitioning, OLAP and Data Mining options
SQL> exit
[Oracle @ bjtest ~] $ PS-Ef | grep test102
Oracle 15805 14913 0 00:00:00 pts/1 grep test102
The database must be in the Mount state and the restricted session is set. After the drop database Command is executed, Oracle automatically deletes the control file, data files recorded in the control file, and online redo log files. If spfile is used in the database, the spfile file is also deleted. This command does not delete archive and backup files.
In the alert file, you can see the operation corresponding to the drop database:
drop database
mon May 18 06:13:01 2009
deleted file/data/Oracle Data/test102/system01.dbf
deleted file/data/oradata/test102/undotbs1.dbf
deleted file/data/oradata/test102/sysaux01.dbf
deleted file/data/oradata/test102/redo01.log
deleted file/data/oradata/test102/redo02.log
deleted file/data/oradata/test102/redo03.log
deleted file/data/oradata/test102/redo04.log
deleted file/data/oradata/test102/redo05.log
deleted file/data/oradata/test102/redo06.log
deleted file/data/oradata/test102/redo07.log
deleted file/data/oradata/test102/temp01.dbf
instance terminated by user, PID = 15795
deleted file/data/oradata/test102/control01.ctl
completed: drop database
mon May 18 06:13:08 2009
shutting down instance (abort)
license high water mark = 1