oracle中的真实表空间大小 [英] True tablespace size in oracle
问题描述
我需要知道Oracle中 true 表空间的大小.我有一些表空间,我需要知道它现在使用多少空间以及多少可用空间(也许是可用空间的百分比).我在网络上发现了一些sql,但是所有sql都基于水印显示了大小...这不是现在分配的真实空间,但据我所知,这是有史以来的最高价值... 因此,我的真正需求是知道我是否有足够的空间来存储不断写入的数据,在删除某些数据之前,我必须知道可以存储多少数据.
I need to know true tablespace size in Oracle. I have some tablespace and I need to know how many space it uses now and how many space is free (and maybe percent of free space). I found in web some sqls but all of them showed size based on water mark... which is not true space allocated now but as far as I know the highest value which has ever been reached... So my real need is to know if I have enough space for my data which constantly are written and I must know how much of them I can store before having to delete some of them.
谢谢
推荐答案
尝试一下:
-- Available space, by tablespace
SELECT * FROM
(SELECT tablespace_name FROM dba_tablespaces)
LEFT OUTER JOIN
(SELECT tablespace_name, SUM(bytes) AS total_bytes
FROM dba_data_files
GROUP BY tablespace_name)
USING (tablespace_name)
LEFT OUTER JOIN
(SELECT tablespace_name, sum(bytes) AS used_bytes
from dba_segments
GROUP BY tablespace_name)
USING (tablespace_name)
LEFT OUTER JOIN
(SELECT tablespace_name, SUM(bytes) AS free_bytes
FROM dba_free_space
GROUP BY tablespace_name)
USING (tablespace_name);
这篇关于oracle中的真实表空间大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!