If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > How to I see tables that need reorg?

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-31-10, 10:20
hozkr hozoryo hozkr hozoryo is offline
Registered User
 
Join Date: Aug 2010
Posts: 43
How to I see tables that need reorg?

Hi,

I need your help.

Where I see that my db need reorg on tables? or runstats?

The db2diag.log say me that need reorg and runstat!!! but I don't know wich ones.
Reply With Quote
  #2 (permalink)  
Old 08-31-10, 10:26
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,473
Which DB2 version and OS are you using?

For DB2 LUW:

To check the last runstats:

Select tabschema,tabname,stats_time from syscat.tables where type = 'T'

To check if reorg is necessary, look up REORGCHK in the manual.

Andy
Reply With Quote
  #3 (permalink)  
Old 08-31-10, 12:13
hozkr hozoryo hozkr hozoryo is offline
Registered User
 
Join Date: Aug 2010
Posts: 43
Thanks.
But de reorgchk I can run on line? I will not get problems such as Locks?


I read and found that "you can find table need reorg if clasterratio in sysibm.sysindexe is < 90 row overflow in sysibm.systables is > 5 need to run reorg"

What do you thing?
Reply With Quote
  #4 (permalink)  
Old 08-31-10, 12:17
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,473
If your runstats are up to date, the running REORGCHK will not be a problem and will actually give you valid results. It does those checks for you.

Andy
Reply With Quote
  #5 (permalink)  
Old 08-31-10, 12:20
nvk@vhv nvk@vhv is offline
Registered User
 
Join Date: Jan 2010
Posts: 291
The reorgchk command works with the statistics information. So if you use 'current statistics' with the reorgchk, then you don't have any issue with locks.

Your quotation shows indicators for reorg. DB2 lists the indicators with the output of the reorgchk command.
Reply With Quote
  #6 (permalink)  
Old 08-31-10, 12:57
hozkr hozoryo hozkr hozoryo is offline
Registered User
 
Join Date: Aug 2010
Posts: 43
Ok thanks, this forum is great.

and what about reorg command? I can run on line? maybe I will get locks? or the command is exclusive
Reply With Quote
  #7 (permalink)  
Old 08-31-10, 13:55
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,473
I suggest you read the manual on the REORG command and in doing reorgs in general.

Andy
Reply With Quote
  #8 (permalink)  
Old 08-31-10, 14:52
hozkr hozoryo hozkr hozoryo is offline
Registered User
 
Join Date: Aug 2010
Posts: 43
Ok thanks, what does the result of reorgchk means??
Reply With Quote
  #9 (permalink)  
Old 08-31-10, 14:53
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,473
Read the manual for REORGCHK and it will tell you what everything means.

Andy
Reply With Quote
  #10 (permalink)  
Old 09-07-10, 09:01
sabari321 sabari321 is offline
Registered User
 
Join Date: May 2009
Posts: 3
If its v9.1 you can use following cmd to list the tables needed reorg.

db2 "select TABSCHEMA, TABNAME from SYSIBMADM.ADMINTABINFO where REORG_PENDING = 'Y'"
Reply With Quote
  #11 (permalink)  
Old 09-07-10, 13:05
hozkr hozoryo hozkr hozoryo is offline
Registered User
 
Join Date: Aug 2010
Posts: 43
Thak you very much, I will try.
Reply With Quote
  #12 (permalink)  
Old 09-07-10, 14:29
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,473
Quote:
Originally Posted by sabari321 View Post
If its v9.1 you can use following cmd to list the tables needed reorg.

db2 "select TABSCHEMA, TABNAME from SYSIBMADM.ADMINTABINFO where REORG_PENDING = 'Y'"
I have some tables where reorgchk determines that a reorg is needed, but this say nothing. I am not sure where this will be useful.

Andy
Reply With Quote
  #13 (permalink)  
Old 09-07-10, 16:15
hozkr hozoryo hozkr hozoryo is offline
Registered User
 
Join Date: Aug 2010
Posts: 43
Quote:
Originally Posted by ARWinner View Post
I have some tables where reorgchk determines that a reorg is needed, but this say nothing. I am not sure where this will be useful.

Andy


Yes, I tried and this query say nothing, but I need a script for get all tables that need reorg because I have more than 1000 tables and It`s very hard get all tables with this command.

You Hava any idea?
Reply With Quote
  #14 (permalink)  
Old 09-07-10, 16:23
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,473
This is what I do:

Code:
call sysproc.reorgchk_tb_stats('T','ALL')


select card,tsize,f1,reorg,table_schema,table_name from session.tb_stats where reorg <> '---' order by tsize
Andy
Reply With Quote
  #15 (permalink)  
Old 09-07-10, 16:39
hozkr hozoryo hozkr hozoryo is offline
Registered User
 
Join Date: Aug 2010
Posts: 43
Quote:
Originally Posted by ARWinner View Post
This is what I do:

Code:
call sysproc.reorgchk_tb_stats('T','ALL')


select card,tsize,f1,reorg,table_schema,table_name from session.tb_stats where reorg <> '---' order by tsize
Andy
Thanks, but this sp work with "current statistics"?...I will try
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On