service_name=global_dbname=db_name.db_domain
oracle_sid=instance_name
顺便给出一个alter database datafile x resize时每个数据文件可以收缩的大小:
SELECT TABLESPACE_NAME,FILE_ID,Trunc(BYTES/1024/1024)||'M' shrink_size FROM dba_free_space a WHERE (TABLESPACE_NAME,FILE_ID,BLOCK_ID) IN
(
SELECT TABLESPACE_NAME,FILE_ID,First_Value(BLOCK_ID) over(PARTITION BY TABLESPACE_NAME,FILE_ID ORDER BY BLOCK_ID desc) FROM dba_free_space
)
AND NOT EXISTS (SELECT 1 FROM dba_extents WHERE TABLESPACE_NAME=a.TABLESPACE_NAME AND FILE_ID=a.FILE_ID AND BLOCK_ID>=a.BLOCK_ID+a.BLOCKS)
ORDER BY bytes desc
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10597822/viewspace-979763/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/10597822/viewspace-979763/