Home > database >  Oracle 11 g table space how to delete the redundant data file
Oracle 11 g table space how to delete the redundant data file

Time:12-03

For help! For help! When the data volume is too big, a table space added six 30 g data file, data archive to the FTP, now it only took less than 10 g database space, how to remove the other five data file?

CodePudding user response:

You directly delete this situation must be no good, there are two ways to
Now is a table space all objects remove to other table space, and then delete this table space directly,
2 it is, not to delete the data files, only do the resize, give you a reference script
 SELECT 
A.f ile_id,
A.f ile_name
File_name,
CEIL (NVL (HWM, 1) * blksize)/1024/1024) smallest,
CEIL (blocks * blksize/1024/1024) currsize,
CEIL (blocks * blksize/1024/1024) -
CEIL (NVL (HWM, 1) * blksize)/1024/1024) savings,
'the alter database datafile "' | | file_name | | ' 'resize' | |
CEIL (NVL (HWM, 1) * blksize)/1024/1024) | | 'm; 'CMD
The FROM
DBA_DATA_FILES a,
(
The SELECT file_id, MAX (block_id + blocks - 1) HWM
The FROM DBA_EXTENTS
GROUP BY file_id
B), and
(
The SELECT TO_NUMBER (value) blksize
The FROM V $PARAMETER
WHERE name='db_block_size'
)
WHERE
A.f ile_id=b. ile_id (+)
AND
CEIL (blocks * blksize/1024/1024) - CEIL ((NVL (HWM, 1) * blksize)/1024/1024) & gt; 0
ORDER BY 5 desc

CodePudding user response:

Under the contract, don't delete,
To delete or move the data file on all objects, to delete,

CodePudding user response:

For information, can be directly to do so?
The alter in tablespace tablespace_name drop datafile ';

CodePudding user response:

reference qq_44782417 reply: 3/f
for data, can be directly to do so?
The alter in tablespace tablespace_name drop datafile ';

If you can data file is empty, you have used in this case is not enough
  • Related