Tuesday, January 10, 2012

Oracle files deleted by SQL> drop database;

I knew when we dropped an Oracle database that it deleted the control files, data files, and the redo log files for that particular instance of the database. I was curious to what other files it deleted when we dropped an instance of the database

So on my Linux box I created a database called "testdel". The database "testdel" created it's files control files, data files, and the redo log files under /oracle/testdel

I used "strace" to see what files were unlinked during the "drop database" command by redirecting the strace output to the output_testdel.txt file as shown below.



-bash-3.2$ export ORACLE_SID=testdel
-bash-3.2$ strace -f -e unlink sqlplus / as sysdba 2> output_testdel.txt

SQL*Plus: Release 11.2.0.1.0 Production on Tue Jan 10 01:31:59 2012

Copyright (c) 1982, 2009, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup restrict mount;
ORACLE instance started.

Total System Global Area 2.6991E+10 bytes
Fixed Size                  2213976 bytes
Variable Size            1.7448E+10 bytes
Database Buffers         9395240960 bytes
Redo Buffers              145174528 bytes
Database mounted.
SQL> drop database;

Database dropped.

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>

Here are a list of file that get unlinked or deleted:

Automatic Memory Management(AMM) memory segments are memory mapped files in /dev/shm.

/u01/app/oracle/product/11.2.0/dbhome_1/dbs/lkinsttestdel

The files nder the /oracle/testdel directory

[pid 23376] unlink("/oracle/testdel/system01.dbf") = 0
[pid 23376] unlink("/oracle/testdel/sysaux01.dbf") = 0
[pid 23376] unlink("/oracle/testdel/undotbs01.dbf") = 0
[pid 23376] unlink("/oracle/testdel/users01.dbf") = 0
[pid 23376] unlink("/oracle/testdel/redo01.log") = 0
[pid 23376] unlink("/oracle/testdel/redo02.log") = 0
[pid 23376] unlink("/oracle/testdel/redo03.log") = 0
[pid 23376] unlink("/oracle/testdel/temp01.dbf") = 0

Here are some other files they that get deleted
/u01/app/oracle/product/11.2.0/dbhome_1/dbs/spfiletestdel.ora

/u01/app/oracle/diag/rdbms/testdel/testdel/alert/log.xml

Also, all metadata, lck, and trace files under the following directory
/u01/app/oracle/diag/rdbms/testdel/testdel/metadata

/u01/app/oracle/diag/rdbms/testdel/testdel/lck

/u01/app/oracle/diag/rdbms/testdel/testdel/trace/

And finally the control files under /oracle/testdel
[pid 23376] unlink("/oracle/testdel/control01.ctl") = 0
[pid 23376] unlink("/oracle/testdel/control02.ctl") = 0

No comments: