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: Block Dump Interpretation

RE: Block Dump Interpretation

From: Rajesh Dayal <Rajesh_at_ohitelecom.com>
Date: Tue, 25 Sep 2001 22:28:53 -0700
Message-ID: <F001.003988E7.20010925223017@fatcity.com>

But why do you need to take a pain of this kind just for checking the total no of rows in individual blocks......

Just run following SQLs and find better idea of space usage inside the blocks.......

REM Remember ......the Rowid format is
REM oooooofffbbbbbbrrr
REM
REM FOLLOWING QUERY IS TO DETERMINE TOTAL NO OF USED BLOCKS REM FOR A GIVEN TABLE THAT HAVE AT LEAST ONE ROW IN THEM REM
REM
prompt ENTER TABLE NAME AS OWNER.TABLE

SELECT COUNT(DISTINCT SUBSTR(ROWID,1,15)) FROM &&TABLE /

REM FOLLOWING QUERY IS TO DETERMINE MAX NO OF ROWS REM AMONG ALL THE DATABLOCKS FOR A GIVEN TABLE SELECT MAX(COUNT(*)) FROM &&TABLE
GROUP BY SUBSTR(ROWID,1,15)
/
REM FOLLOWING QUERY IS TO DETERMINE MIN NO OF ROWS REM AMONG ALL THE DATABLOCKS FOR A GIVEN TABLE SELECT MIN(COUNT(*)) FROM &&TABLE
GROUP BY SUBSTR(ROWID,1,15)
/

REM FOLLOWING QUERY IS TO DETERMINE AVG NO OF ROWS REM AMONG ALL THE DATABLOCKS FOR A GIVEN TABLE SELECT AVG(COUNT(*)) FROM &&TABLE
GROUP BY SUBSTR(ROWID,1,15)
/

REM FOLLOWING QUERY IS TO DETERMINE BLOCK IDs WHO HAVE REM SPECIFIC ROWCOUNT ....
REM Check Only last 6 characters for Block ids..

SELECT DISTINCT SUBSTR(ROWID,1,15) "OOOOOOFFFBBBBBB" , COUNT(*) FROM &&TABLE
GROUP BY SUBSTR(ROWID,1,15) HAVING COUNT(*) = &ROWCOUNT /

REM FOLLOWING QUERY IS TO GIVE COUNT OF ROWS IN ALL REM BLOCKS INDIVIDUALLY.....
REM
REM THIS WILL OUTPUT AS MANY ROWS AS TOTAL NO OF USED REM BLOCKS IN THE TABLE....... SELECT SUBSTR(ROWID,1,15) "OOOOOOFFFBBBBBB", COUNT(*) FROM &&TABLE GROUP BY SUBSTR(ROWID,1,15) ORDER BY COUNT(*) /

REM THIS IS EXCELLENT EXMAPLE OF ONLINE REMOVAL OF REM DATA BLOCK FRAGMENTATION.....
REM
REM FOLLOWING SQL IS TO CREATE A TEMP TABLE WHICH WILL HAVE REM ALL THE ROWS OF THE BLOCKS, WHO HAVE A SPECIFIC ROWCOUNT. REM AFTER CREATING THIS TEMP TABLE, ONE CAN DELETE THE ROWS REM FROM MAIN TABLE AND REINSERT THE ROWS FROM TEMP TABLE. REM THIS WILL ELIMINATE THE DATA BLOCK FRAGMENTATION FOR ALL REM THE BLOCKS HAVING ROWCOUNT SPECIFIED.... REM
REM HERE BEFORE REINSERTION INTO MAIN TABLE PCTFREE VALUE CAN REM BE SET TO A VERY LOW VALUE (2-5%)..... REM
REM AFTER REINSERTION IS COMPLETE, THE PCTFREE CAN BE RESET TO REM ORIGINAL VALUE.......
REM
REM THIS OPERATION CAN BE VERIFIED BY RECHECKING THE NO OF ROWS REM FOR THESE BLOCKS....
REM
REM
REM ALERT!!!!!!!DON'T FORGET ABOUT TRIGGERS AND CONSTRAINTS ......... REM
REM
REM CREATE TABLE TEMP11 AS SELECT * FROM &&TABLE REM WHERE SUBSTR(ROWID,10,6) IN (
REM SELECT DISTINCT SUBSTR(ROWID,10,6) FROM &&TABLE REM GROUP BY SUBSTR(ROWID,10,6) HAVING COUNT(*) = &ROWCOUNT REM )
REM / UNDEFINE TABLE NOTE: Would wait for the feedback.

Hope this helps a bit,
Rajesh

-----Original Message-----
bhatti
Sent: Wednesday, September 26, 2001 1:30 AM To: Multiple recipients of list ORACLE-L

Aha, you're right. I do indeed notice a value, nrow=87.

Thank you

mkb


Do You Yahoo!?
Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger. http://im.yahoo.com
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: mohammed bhatti
  INET: mkb125_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).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Rajesh Dayal
  INET: Rajesh_at_ohitelecom.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 Wed Sep 26 2001 - 00:28:53 CDT

Original text of this message

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