|
How do I determine the free space in a tablespace?
(comments are locked)
|
|
Query DBA_FREE_SPACE. Possibly more usefully, understand how space is allocated in extents by Oracle. Each Segment (table, partition, index etc.) has one or more extents for storing data. The extents exist in a tablespace. When more storage is needed by a segment, another extent is allocated, the space in that extent may still mostly be unused, but now can only be used by that segment. DBA_FREE_SPACE will tell you about the unallocated extents in a tablespace. Use the procedures in DBMS_SPACE to query how much unused space has been allocated to an object. http://download.oracle.com/docs/cd/B28359_01/server.111/b28310/schema005.htm provides a good overview This can get tricky, if autoextend is on, then the tablespace can grow as needed, and won't really be 'full' until it hits it's quota or the device becomes full if set to 'UNLIMITED'. Toad tries to account for this if you happen to have it available...
Nov 10 '09 at 02:06 PM
HillbillyToad
The unallocated space isn't technically in the tablespace yet :-) Good point; though modern filesystems can be dynamically resized, and some (such as NetApp filers) are also capable of autogrow, so even just looking at space left in the filesystem isn't always sufficient to determine the growth limits.
Nov 11 '09 at 07:37 AM
Andrew Mobbs
(comments are locked)
|
|
Here's a query I use: SELECT a.TABLESPACE_NAME, a.BYTES bytes_used, b.BYTES bytes_free, b.largest, round(((a.BYTES-b.BYTES)/a.BYTES)*100,2) percent_used from ( select TABLESPACE_NAME, sum(BYTES) BYTES from dba_data_files group by TABLESPACE_NAME ) a left outer join ( select TABLESPACE_NAME, sum(BYTES) BYTES , max(BYTES) largest from dba_free_space group by TABLESPACE_NAME ) b on a.TABLESPACE_NAME=b.TABLESPACE_NAME order by ((a.BYTES-b.BYTES)/a.BYTES) desc
(comments are locked)
|

