Databases 6 min read

How to Manually Delete an Oracle Database and Clean Up ASM Files

This guide provides step‑by‑step commands for safely stopping listeners, locating data, log and control files, dropping the database, and removing residual files both for file‑system and ASM Oracle databases.

ITPUB
ITPUB
ITPUB
How to Manually Delete an Oracle Database and Clean Up ASM Files

When a graphical interface is unavailable, you may need to manually delete an Oracle database. The process begins by stopping the listener and Enterprise Manager console to prevent new connections:

lsnrctl stop listener_name
emctl stop dbconsole

Next, gather information about data files, log files, control files, and archive logs using SQL*Plus:

sqlplus /as sysdba
SQL> show parameter control   -- control file path
SQL> select file_name from dba_data_files;   -- data file locations
SQL> select * from v$logfile;   -- log file locations
SQL> archive log list;   -- archive log path
SQL> shutdown immediate abort;   -- shut down the database

Start the instance in mount exclusive restrict mode and verify the instance name:

SQL> startup mount exclusive restrict;
SQL> show parameter instance;

Enable restricted sessions and drop the database:

SQL> alter system enable restricted session;
SQL> drop database;
SQL> exit

Manually delete the files identified earlier (using Windows Explorer or rm on Linux). Remove listener configuration files if static listeners were used, and update oratab and .bash_profile as needed.

Removing an ASM Database

ASM databases store data, control, log, and parameter files within the ASM system, so additional steps are required.

Perform steps 3‑4 of the file‑system database removal (shutdown first).

Use drop database to delete data, log, and temporary files.

Connect to the ASM instance:

Delete residual files with ASM commands, for example:

Alternatively, use asmcmd to list and remove files:

For files directly under a disk group, standard rm can be used.

Finally, clean up other related files such as those in $ORACLE_HOME/dbs, trace files (location varies by version, e.g., $ORACLE_BASE/diag/rdbms/sid_name for 11g), and then repeat steps 7‑8 from the file‑system procedure.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

command-lineOracleASMdatabase deletionSQL*Plus
ITPUB
Written by

ITPUB

Official ITPUB account sharing technical insights, community news, and exciting events.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.