X

Alejandro Vargas' Blog

  • March 22, 2007

10g Drop Database Command

Alejandro Vargas
Technical Leader, ACS Global Delivery, Infrastructure & BigData

I'm testing cloning using RMAN, working with small databases, I'm performing several clones with different approaches, trying to find an optimal way to perform automatized cloning on demand.

As part of the tests I'm using the Drop Database command, that made a fast and efficient cleanup of all datafiles, redologs and control files in one command. That way I'm ready to execute the next clone immediately.

Drop database do require to mount the database in exclusive restricted mode, that made quite difficult to execute it by mistake on the wrong database.

The steps are as follows:

  • shutdown abort;
  • startup mount exclusive restrict;
  • drop database;
This is a sample session using this feature:

1) Check Datafile, Controlfile and Online log names before drop database

SQL> select name from v$datafile;

NAME
--------------------------------------------------------------------------------
/dbtst/oa01/r2dupl/R2DUPL/datafile/o1_mf_system_304kfl61_.dbf
/dbtst/oa01/r2dupl/R2DUPL/datafile/o1_mf_undotbs1_304kdoxf_.dbf
/dbtst/oa01/r2dupl/R2DUPL/datafile/o1_mf_sysaux_304kdrwx_.dbf
/dbtst/oa01/r2dupl/R2DUPL/datafile/o1_mf_users_304kgyyt_.dbf

SQL> select member from v$logfile;

MEMBER
--------------------------------------------------------------------------------
/dbtst/oa01/r2dupl/files1/R2DUPL/onlinelog/o1_mf_3_304klfwo_.log
/dbtst/oa01/r2dupl/files2/R2DUPL/onlinelog/o1_mf_3_304klhsq_.log
/dbtst/oa01/r2dupl/files1/R2DUPL/onlinelog/o1_mf_2_304klb3f_.log
/dbtst/oa01/r2dupl/files2/R2DUPL/onlinelog/o1_mf_2_304kld4z_.log
/dbtst/oa01/r2dupl/files1/R2DUPL/onlinelog/o1_mf_1_304kl63j_.log
/dbtst/oa01/r2dupl/files2/R2DUPL/onlinelog/o1_mf_1_304kl81x_.log

6 rows selected.

SQL> select name from v$controlfile;

NAME
--------------------------------------------------------------------------------
/dbtst/oa01/r2dupl/files1/R2TAPE/controlfile/r2dup_1.ctl
/dbtst/oa01/r2dupl/files2/R2TAPE/controlfile/r2dup_2.ctl

SQL> select name from v$database;

NAME
---------
R2DUPL

2) Drop Database

SQL> shutdown abort
ORACLE instance shut down.
SQL> startup mount exclusive restrict;
ORACLE instance started.

Total System Global Area  989855744 bytes
Fixed Size                  2077552 bytes
Variable Size             864029840 bytes
Database Buffers          117440512 bytes
Redo Buffers                6307840 bytes
Database mounted.
SQL> drop database;

Database dropped.

Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options

3) Check Datafile/Redologs/Controlfile after drop database

[dbtst2] > ls -ltr /dbtst/oa01/r2dupl/R2DUPL/datafile
ls: /dbtst/oa01/r2dupl/R2DUPL/datafile: No such file or directory

[dbtst2] > ls -ltr /dbtst/oa01/r2dupl/files1/R2TAPE/controlfile/
total 0
[dbtst2] > ls -ltr /dbtst/oa01/r2dupl/files2/R2TAPE/controlfile/
total 0

[dbtst2] > ls -ltr /dbtst/oa01/r2dupl/files1/R2DUPL/onlinelog/
ls: /dbtst/oa01/r2dupl/files1/R2DUPL/onlinelog/: No such file or directory
[dbtst2] > ls -ltr /dbtst/oa01/r2dupl/files2/R2DUPL/onlinelog/
ls: /dbtst/oa01/r2dupl/files2/R2DUPL/onlinelog/: No such file or directory





Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.