数据库(Database)由若干表空间(Tablespace)组成,表空间(Tablespace)由若干段(Segment)组成,段(Segment)由若干区(Extent)组成,区(Extent)又由若干块(Block)组成
随着表数据不断增加,区(EXTENT)及块(BLOCK)的个数也不断增多
Block越大,相同数据量的情况下存储的行就越多,Block需要的越少, 访问的逻辑读就越小,对应的consistent gets就越小
ps:实践情况并非Block越大越好,block越大,不同的访问的数据落在同一个Block的概率就越大,这个很容易产生热竞争
查看表空间的总体情况:
SELECT A.TABLESPACE_NAME "表空间名",
A.TOTAL_SPACE "总空间(G)",
NVL(B.FREE_SPACE, 0) "剩余空间(G)",
A.TOTAL_SPACE - NVL(B.FREE_SPACE, 0) "使用空间(G)",
CASE
WHEN A.TOTAL_SPACE = 0 THEN
0
ELSE
trunc(NVL(B.FREE_SPACE, 0) / A.TOTAL_SPACE * 100, 2)
END "剩余百分比%" --避免分母为0
FROM (SELECT TABLESPACE_NAME,
trunc(SUM(BYTES) / 1024 / 1024 / 1024, 2) TOTAL_SPACE
FROM DBA_DATA_FILES
GROUP BY TABLESPACE_NAME) A,
(SELECT TABLESPACE_NAME,
trunc(SUM(BYTES / 1024 / 1024 / 1024), 2) FREE_SPACE
FROM DBA_FREE_SPACE
GROUP BY TABLESPACE_NAME) B
WHERE A.TABLESPACE_NAME = B.TABLESPACE_NAME(+)
ORDER BY 5;
原创文章,作者:奋斗,如若转载,请注明出处:https://blog.ytso.com/5067.html