How to drop a RAC database manually

As we’re all used since the advent of the “new” command “drop database” on oracle, that sometimes, for a clean and total remove of oracle’s database it’s used. But if you try just use on a RAC environment, it’s necessary a little trick.

The steps are:

1) on cluster (or on the instance it self) do a:

srvctl stop database -d <databasename>

2) startup on restrict mode:

sqlplus / as sysdba

startup mount restrict exclusive;

3) The Trick !!! Change the parameter CLUSTER_DATABASE to false!!!

alter system set cluster_database=false scope=spfile;

4) restart it again restricted:

shutdown immediate;
startup mount restricted exclusive;

5) Finally: drop database !!! (becareful, it has no rollback!!!)

drop database;

6) Done !

Cheers!

  1. Please note that this doesnot remove the entry from cluster registry…You will have to do below

    srvctl remove database -d dbname

  2. Just to be accurate, it is recommended by Oracle to drop RAC databases using dbca:
    While it is possible to create RAC databases through means outside of DBCA (such as by using SQL scripts) and while it is possible to drop RAC databases through means outside of DBCA (such as starting just one instance of the database using cluster_database=false and issuing the ‘drop database’ command), DBCA should be used in all cases to perform these operations.

    Using DBCA for creating and/or dropping RAC databases ensures that Oracle Clusterware / Grid Infrastructure (specifically the Oracle Cluster Registry (OCR) file) is correctly modified to remain in keeping with the true state of the resources (database, instances) it’s managing within the cluster.

    • Hi,

      If in all the cases DBCA (that we agree that’s the recommended tool) worked 100% of times, should not be needed to write an article about drop “manually” a RAC database šŸ˜‰

      Cheers

  3. Please note that there is a typo.

    This line:
    startup mount restricted exclusive

    Should be:
    startup mount restrict exclusive

    It should say restrict and not restricted.

    -JJ

  4. Manual dropping and removing RAC DB using srvctl doesn’t remove the entry in oratab, do you know why?

  5. That will not work as it is. You have to change the spfile before shutting down.
    This is what I have on my code.

    BKUP_ORACLE_SID=$ORACLE_SID
    export ORACLE_SID=`ps -ef | grep pmon | grep $ORACLE_SID | cut -d_ -f3,4`
    echo “alter system set cluster_database=false scope=spfile;” | $ORACLE_HOME/bin/sqlplus / as sysdba
    ${ORACLE_HOME}/bin/srvctl stop database -d ${BKUP_ORACLE_SID}
    echo “startup mount exclusive restrict;” | $ORACLE_HOME/bin/sqlplus / as sysdba
    echo “drop database;” | $ORACLE_HOME/bin/sqlplus / as sysdba
    ORACLE_SID=$BKUP_ORACLE_SID

    Thanks,
    Alex.

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Optimization WordPress Plugins & Solutions by W3 EDGE