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;
1) Check Datafile, Controlfile and Online log names before drop database
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
[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