|
-
To calculate free size on table.
The average of the sizes of column is the placed size divided for the total lines.
Select SUBSTR (owner, 1, 20) "Owner",
SUBSTR (tabela, 1, 20) "Table",
TO_CHAR (SUM (blocos) , '999,999,999') "Blocks Used",
TO_CHAR (SUM (vazios) , '999,999,999') "Blocks Empty",
TO_CHAR (SUM (alocado) / 1048576, '99,999.9999') "Alocad MB",
TO_CHAR (SUM (blocos + vazios) , '999,999,999') "Total Blocks",
TO_CHAR (SUM (alocado) / SUM (blocos + vazios) / 1024, '999,999.9999') "Size Block KB",
TO_CHAR((SUM (alocado) / SUM (blocos + vazios)) * SUM (vazios) / 1048576, '999,999.9999') "Empty MB"
From (
Select owner, table_name tabela, blocks blocos, empty_blocks vazios, 0 alocado
from dba_tables
Where owner not in ('SYS', 'SYSTEM')
union
Select owner, segment_name tabela, 0 blocos, 0 vazios, bytes alocado
from dba_segments
Where owner not in ('SYS', 'SYSTEM') and segment_type = 'TABLE'
)
group by Owner, Tabela
having SUM (blocos) > 0
;
Márcio de Souza Almeida
DBA Oracle / SQLServer / PostgreSQL
Rua Cupa, 139 Apto 85 A
Penha - São Paulo - SP
03640-000 - Brasil
http://www.directory.com.br
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|