Thursday, April 14, 2011

Dropping a database in Oracle

Is very easy to drop (delete) an Oracle database, as you can see in this example:

myserver:mydb> sqlplus '/ as sysdba'

SQL*Plus: Release - Production on Fri Sep 24 08:50:22 2010

Copyright (c) 1982, 2007, Oracle. All Rights Reserved.

Connected to an idle instance.

SQL> startup mount exclusive;
ORACLE instance started.

Total System Global Area 268435456 bytes
Fixed Size 2083368 bytes
Variable Size 163579352 bytes
Database Buffers 100663296 bytes
Redo Buffers 2109440 bytes
Database mounted.

SQL> select instance_name, host_name from v$instance;

---------------- ----------------
mydb myserver

SQL> alter system enable restricted session;

System altered.

SQL> drop database;

Database dropped.

Disconnected from Oracle Database 10g Enterprise Edition Release - 64bit Production
With the Partitioning, Data Mining and Real Application Testing options
SQL> exit

In a related note, the sentence DROP DATABASE does not exist in Oracle 9i, you have to shutdown the database and erase all the database files with operating system commands:

Drop database in Oracle 9i

No comments:

Post a Comment