Wednesday, March 2, 2011

How to Drop Oracle Database.

RMAN is not only for backup and recovery . RMAN can be used to drop the database ( data files and log files ,...) .

Needless to say , this is VERY destructive operation . Please be mindful of this . 
For RMAN to drop the database  , the database needs to be mounted exclusively in restricted mode.

C:\Users\oracle>sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Wed Mar 2 15:20:17 2011
Copyright (c) 1982, 2010, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault and Real Application Testing options

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount EXCLUSIVE RESTRICT;
ORACLE instance started.

Total System Global Area 1.3696E+10 bytes
Fixed Size                  2188768 bytes
Variable Size            6878661152 bytes
Database Buffers         6777995264 bytes
Redo Buffers               37044224 bytes
Database mounted.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault and Real Application Testing options

C:\Users\oracle>rman target /
Recovery Manager: Release 11.2.0.1.0 - Production on Wed Mar 2 15:20:50 2011
Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
connected to target database: DUP2 (DBID=2709345826, not open)
RMAN> drop database ;
database name is "DUP2" and DBID is 2709345826

Do you really want to drop the database (enter YES or NO)? yes
database dropped

RMAN>

No comments:

Post a Comment