Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Getting current space of a table ...
Thomas,
In Oracle7, to find out the total blocks of a table that contain rows, enter the following SQL
SELECT COUNT(DISTINCT(SUBSTR(ROWID,1,8))) FROM table_name;
In Oracle8, you can find the total blocks using DBMS_ROWID:
SELECT COUNT(DISTINCT(SUBSTR(DBMS_ROWID.ROWID_TO_RESTRICTED(ROWID),1,8))) FROM table_name;
You will get the total number of blocks that contain records of the table.
To determine the overall size, find the block size:
SELECT value FROM V$PARAMETER WHERE NAME = 'db_block_size';
The total space of the data is the multiplication of "Total Blocks" * "Block Size". This will be in bytes.
To find the free space in the table, subtract the size calculated above (used size) from the total size of the most recent extent.
Best regards,
-Ari Kaplan
Independent Oracle DBA Consultant
<-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-> <-> For 275+ Oracle tips, visit my Web Page: <-> <-> <-> <-> http://homepage.interaccess.com/~akaplan <-> <-> <-> <-> email: akaplan_at_interaccess.com <-> <-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><->Thomas Klinger wrote in message <36f7b376.26787321_at_194.48.138.240>...
![]() |
![]() |