In Oracle datafiles cannot simply be dropped, like a tablespace or
schema for example, but there are other techniques you can use to "drop" or remove a datafile.
If the datafile you wish to drop is the only datafile present in the
tablespace in which it resides, you can simply drop the tablespace with
the following command:
DROP TABLESPACE <tablespace name> INCLUDING CONTENTS;
Please Note: Dropping a tablespace will result in the
removal of the tablespace, any datafiles presents, and any other
tablespace contents. Be sure that you have a full backup if you wish to
have the ability to recover any data in the tablespace. If other
datafiles you wish to keep reside in the tablespace, it will be
necessary to export them prior to dropping the tablespace.
Once the tablespace has been dropped, you can then physically remove
the datafile from your system using an operating system command, if you
so choose.
Dropping a datafile and physically removing it is not normally used to save space,
as disk space is cheap. Normally it is not necessary to physically remove
the datafile. If this is the case, you can simply take the datafile
offline with the following command:
ALTER DATABASE DATAFILE <datafile name> OFFLINE DROP
This command will not drop the datafile, it will simply take the
datafile offline and Oracle will no longer attempt to access it.
Offlining the datafile is typically used when your intention is to drop
the tablespace. This will also give you the ability to recover the
datafile at a later date.