A2oz

How to Delete a Database in Oracle 10g?

Published in Database Administration 1 min read

Deleting a database in Oracle 10g is a permanent action, so proceed with caution. Here's how to do it:

  1. Shut down the database:
    • Connect to SQL*Plus as the SYS user.
    • Execute the following command:
        SHUTDOWN IMMEDIATE;
  2. Stop the Oracle instance:
    • Navigate to the Oracle home directory.
    • Stop the Oracle instance using the srvctl command:
        srvctl stop database -d <database_name>
  3. Delete the database files:
    • Navigate to the ORACLE_HOME/dbs directory.
    • Identify and delete the files related to the database, including:
      • controlfile.ora
      • spfile.ora
      • Data files
      • Redo logs
  4. Remove the database entry from the Oracle instance:
    • Connect to SQL*Plus as the SYS user.
    • Execute the following command:
        DROP DATABASE <database_name> FORCE;

Important Notes:

  • Backup: Always back up your database before deleting it.
  • Permissions: You need sufficient privileges to delete a database.
  • Recovery: Once a database is deleted, it cannot be recovered.

Example:

Let's say the database you want to delete is named MYDB. You would replace <database_name> in the commands above with MYDB.

Related Articles