1SELECT DISTINCT TABLESPACE_NAME FROM DBA_EXTENTS ORDER BY TABLESPACE_NAME;
2
3SELECT TABLESPACE_NAME,
4 sum(BYTES / 1024 / 1024) AS MB
5FROM DBA_DATA_FILES GROUP BY TABLESPACE_NAME;
1-- Size and usage of tablespaces
2SELECT T1.TABLESPACE_NAME,
3 T1.BYTES / 1024 / 1024 as "bytes_used (Mb)",
4 T2.BYTES / 1024 / 1024 as "bytes_free (Mb)",
5 T2.largest / 1024 / 1024 as "largest (Mb)",
6 round(((T1.BYTES - T2.BYTES) / T1.BYTES) * 100, 2) percent_used
7FROM (
8 select TABLESPACE_NAME,
9 sum(BYTES) BYTES
10 from dba_data_files
11 group by TABLESPACE_NAME
12 ) T1,
13 (
14 select TABLESPACE_NAME,
15 sum(BYTES) BYTES,
16 max(BYTES) largest
17 from dba_free_space
18 group by TABLESPACE_NAME
19 ) T2
20where T1.TABLESPACE_NAME = T2.TABLESPACE_NAME
21order by ((T1.BYTES - T2.BYTES) / T1.BYTES) desc;
1SELECT e.OWNER, e.SEGMENT_NAME, e.TABLESPACE_NAME, sum(e.bytes) / 1048576 AS Megs
2FROM dba_extents e
3WHERE
4 e.OWNER = 'MY_USER' AND
5 e.TABLESPACE_NAME = 'MY_TABLESPACE'
6GROUP BY e.OWNER, e.SEGMENT_NAME, e.TABLESPACE_NAME
7ORDER BY e.TABLESPACE_NAME, e.SEGMENT_NAME;
1CREATE TABLESPACE
2TBS_NOME_TABLESPACE
3DATAFILE 'NOME_DATAFILE.dbf' SIZE 40M ONLINE;
1CREATE TABLE TB_NOME_TABELA
2(
3CODIGO NUMBER(38)
4)TABLESPACE TBS_NOME_TABLESPACE;