Tuesday, 10 October 2017


Query to find space usage in a Tablespace

Suppose a tablesapace is full and you want to find space used by different objects like tables and index , then use folllowing query to get results


SELECT owner, segment_name, segment_type, partition_name, ROUND(bytes/(1024*1024),2) SIZE_MB, tablespace_name

FROM DBA_SEGMENTS

WHERE SEGMENT_TYPE IN ('TABLE', 'TABLE PARTITION', 'TABLE SUBPARTITION','INDEX', 'INDEX PARTITION', 'INDEX SUBPARTITION', 'TEMPORARY', 'LOBINDEX', 'LOBSEGMENT', 'LOB PARTITION')
AND TABLESPACE_NAME  like 'Name%'
ORDER BY bytes DESC;

No comments:

Post a Comment