Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: unused blocks BELOW HWM - Thanks

RE: unused blocks BELOW HWM - Thanks

From: Gene Gurevich <g_u_r_e_v_i_c_h_at_yahoo.com>
Date: Tue, 18 Dec 2001 10:22:28 -0800
Message-ID: <F001.003DF09F.20011218094532@fatcity.com>

Sure,

I haven't got around to using the dbms procedure yet, but these are two queries I ended up with. I have checked them on several tables and the results are the

same:

here, of course, 1 is the table name and 2 is the owner. the tables need to be analyzed before running these queries

select TOTAL_B_HWM - USED_B_HWM
from
(select blocks TOTAL_B_HWM from dba_tables where table_name = UPPER('&&1') and owner= UPPER('&&2')),
(select
count(unique(substr(dbms_rowid.rowid_to_restricted(rowid,0),15,4) ||                

substr(dbms_rowid.rowid_to_restricted(rowid,0),1,8))) USED_B_HWM
        from &&2..&&1);

OR

select TOTAL - TOTAL_A_HWM - 1 - USED_B_HWM from
(select blocks TOTAL FRom dba_segments
where segment_name = UPPER('&&1') and owner= UPPER('&&2')),
(select empty_blocks TOTAL_A_HWM from dba_tables where table_name = UPPER('&&1')),
(select
count(unique(substr(dbms_rowid.rowid_to_restricted(rowid,0),15,4) ||                

substr(dbms_rowid.rowid_to_restricted(rowid,0),1,8))) USED_B_HWM
        from &&2..&&1);
undef 1 2



Do You Yahoo!?
Check out Yahoo! Shopping and Yahoo! Auctions for all of your unique holiday gifts! Buy at http://shopping.yahoo.com or bid at http://auctions.yahoo.com
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Gene Gurevich
  INET: g_u_r_e_v_i_c_h_at_yahoo.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Tue Dec 18 2001 - 12:22:28 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US