8.5 Deleting a Database with RMAN

You may need to remove a database from the operating system. For example, you create a test database and then no longer have a use for it. In such a situation, use the DROP DATABASE command from within RMAN, or the DROP DATABASE statement in SQL*Plus.

DROP DATABASE requires that RMAN be connected to the target database, and that the target database be mounted. The command does not require connection to the recovery catalog. If RMAN is connected to the recovery catalog, and if you specify the option INCLUDE COPIES AND BACKUPS, then RMAN also unregisters the database.

See Also:

Oracle Database Backup and Recovery Advanced User's Guide to learn how to use the SQL*Plus DROP DATABASE command

To drop a database:

  1. Connect RMAN to the target database and (optionally) recovery catalog. For example:

    rman TARGET / CATALOG rman/rman@catdb
  2. Catalog all backups that are associated with the database. For example, the following commands catalogs files in the flash recovery area, and then in a secondary archiving destination:

    RMAN> CATALOG START WITH '+disk1';    # all files from flash recovery area 
                                          # (stored on ASM disk)
    RMAN> CATALOG START WITH '/arch_dest2';  # all files from second arch dest
  3. Delete all backups and copies associated with the database. For example:

    RMAN> DELETE BACKUPSET; # deletes all backups
    RMAN> DELETE COPY; # delete all image copies (including archived logs)
  4. Remove the database from the operating system (and automatically unregister it from the recovery catalog if you are connected to the catalog). For example:

    DROP DATABASE; # delete all database files and unregister the database