Feb 5, 2010

Drop database including backups using RMAN

Prior to 10g, dropping a database consisted of shutting the instance down and manually removing its associated datafiles, logfiles, controlfiles and associated init.ora file at operating system level. You might also want to remove any reference to it in /etc/oratab or /var/opt/oracle/oratab.

It could be a problem to get rid of all the Backup information in the RMAN CATALOG after you had deleted a database with DBCA for instance. You had to manually remove all the records from the catalog.
Starting with Oracle 10gR1 we can now use RMAN to drop a database and remove all its records from the RMAN CATALOG.

Here is a demo how it works:

Login to the target database server and make sure you export the correct ORACLE_SID

$Export ORACLE_SID=target_db_name

$ rman target / catalog rman_user@rman_db

RMAN> startup mount

RMAN> sql ‘alter system enable restricted session’;

RMAN> drop database including backups;

Database name is “ORCL” and DBID is 1114494726
Do you really want to drop all backups and the database (enter YES or NO)? Yes

database name is “ORCL” and DBID is 1114494726
database dropped
database name is “ORCL” and DBID is 1114494726
database unregistered from the recovery catalog

RMAN> exit

RMAN will not delete the entry in the /etc/oratab, so we have to do this either by editing /etc/oratab or by using dbca to delete the service

Search This Blog