How to drop Oracle database

Como tudo na vida, é mais fácil destruir do que construir. Para dropar um Oracle database, basta usar o exemplo abaixo:

[oracle@oel7 12.2.0.1]$ sqlplus / as sysdba
 
SQL*Plus: Release 12.2.0.1.0 Production on Thu Jan 28 16:35:11 2021
 
Copyright (c) 1982, 2016, Oracle.  All rights reserved.
 
 
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
 
SQL> select instance_name,status from v$instance;
 
INSTANCE_NAME    STATUS
---------------- ------------
BSS              OPEN
 
SQL> DROP DATABASE;
DROP DATABASE
*
ERROR at line 1:
ORA-01586: database must be mounted EXCLUSIVE and not open for this operation

Como especificado na documentação, o banco deve estar montado e no modo exclusivo e restrito:

SQL> shu immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
SQL>
SQL> STARTUP MOUNT EXCLUSIVE RESTRICT
ORACLE instance started.
 
Total System Global Area 2147483648 bytes
Fixed Size                  8622776 bytes
Variable Size            1291849032 bytes
Database Buffers          838860800 bytes
Redo Buffers                8151040 bytes
Database mounted.
SQL> DROP DATABASE;
 
Database dropped.
 
Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL>

Leave a Comment

Your email address will not be published.