Dear Sheryl Philip :
1.you can use the DROP DATAFILE clauses of the ALTER TABLESPACE command to drop a single datafile . The datafile must be empty. (A datafile is considered to be empty when no extents remain allocated from it.) , also there are some restrictions for dropping datafiles :
The database must be open.
If a datafile is not empty, it cannot be dropped.
If you must remove a datafile that is not empty and that cannot be made empty by dropping schema objects, you must drop the tablespace that contains the datafile.
You cannot drop the first or only datafile in a tablespace.
This means that DROP DATAFILE cannot be used with a bigfile tablespace.
You cannot drop datafiles in a read-only tablespace.
You cannot drop datafiles in the SYSTEM tablespace.
If a datafile in a locally managed tablespace is offline, it cannot be dropped.
2. you can use the under query to find out which object were in the datafile , then you can use aleter xxx move to move them :
select *
from (select owner, segment_name, segment_type, block_id
from dba_extents
where file_id =
(select file_id from dba_data_files where file_name = :FILE) --your datafile name
order by block_id desc)
3. that's a good idea to use exp/imp tool to do this .
4. hehe , of course not , if the datafile is not empty , you can not resize it to 0k, that's a restriction of resizing a datafile , It is not always possible to decrease the size of a file to a specific value. It could be that the file contains data beyond the specified decreased size, in which case the database will return an error.
2008-03-26
Alan Lee(cnoug)
Oracle LazyDBA home page