Important Notes:
- Backup first! Ensure you have a proper backup before dropping the database.
- This operation cannot be undone.
- If using Oracle RAC, additional steps are required for all nodes.
- Make sure no other services or users are connected to the database before shutting down.
- After deleting files, the database is effectively gone from the system.
SQL> select name,database_role,open_mode,log_mode from v$database; NAME DATABASE_ROLE OPEN_MODE LOG_MODE --------- ---------------- -------------------- ------------ TGDB PRIMARY READ WRITE ARCHIVELOG SQL> SQL> shut immediate ; Database closed. Database dismounted. ORACLE instance shut down. SQL> exit Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.23.0.0.0 C:\Windows\system32>set ORACLE_SID=tgdb C:\Windows\system32>sqlplus sys/sys as sysdba SQL*Plus: Release 19.0.0.0.0 - Production on Thu Apr 10 19:02:39 2025 Version 19.23.0.0.0 Copyright (c) 1982, 2023, Oracle. All rights reserved. Connected to an idle instance. SQL> startup restrict mount; ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance ORACLE instance started. Total System Global Area 2.6374E+10 bytes Fixed Size 23288328 bytes Variable Size 1.1677E+10 bytes Database Buffers 1.4630E+10 bytes Redo Buffers 43819008 bytes Database mounted. SQL> SQL> select name,database_role,open_mode,log_mode from v$database; NAME DATABASE_ROLE OPEN_MODE LOG_MODE --------- ---------------- -------------------- ------------ TGDB PRIMARY MOUNTED ARCHIVELOG SQL> drop database; Database dropped. Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.23.0.0.0 Alert log :2025-04-10T19:04:48.337048+05:30 Errors in file I:\APP\ORACLE\PRODUCT\19.0.0\diag\rdbms\tgdr\tgdb\trace\tgdb_ora_11048.trc: ORA-48117: error encountered when attempting to remove a directory [I:\APP\ORACLE\PRODUCT\19.0.0\diag\rdbms\tgdr\tgdb] ORA-48195: OS command to remove a directory failed OSD-00005: additional error information O/S-Error: (OS 145) The directory is not empty. 2025-04-10T19:04:48.337048+05:30 USER (ospid: 11048): terminating the instance 2025-04-10T19:04:52.618275+05:30 Instance terminated by USER, pid = 11048 2025-04-10T19:04:57.623682+05:30 Deleted file D:\ORACLE\TGDB\CONTROLFILES\CONTROL01.CTL Deleted file E:\ORACLE\TGDB\CONTROLFILES\CONTROL02.CTL Completed: drop database Shutting down ORACLE instance (abort) (OS id: 11048) Shutdown is initiated by sqlplus.exe. License high water mark = 1 2025-04-10T19:05:05.733062+05:30 Instance shutdown complete (OS id: 11048)
Note: The command DROP DATABASE will completely remove the database including control files, datafiles, and redo logs. Use this command only when you're certain the database is no longer required—such as after a successful migration to a new environment.
Toufique Khan