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 > reorg ALL tables and indexes in a db

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-11-09, 10:30
MarkhamDBA MarkhamDBA is offline
Registered User
 
Join Date: Dec 2008
Location: Toronto, Canada
Posts: 381
reorg ALL tables and indexes in a db

Is there a way to reorg ALL tables and indexes in a db besides running reorg on each table one by one and then tables indexes? Our db has more than 700 tables so running reorgs on all of them one by one would be time consuming (not to say ridiculous ). Same with runstats...

May be there is a script doing it (reading table names of the db from system catalog and than doing reorgs and runstats on them)? I checked the library (searched on reorg) and did not find anything.

Thanks in advance
__________________
DB2 v9.5 ESE on AIX v6.1/ v9./10 on z/OS

Last edited by MarkhamDBA; 01-11-09 at 21:38.
Reply With Quote
  #2 (permalink)  
Old 01-11-09, 22:32
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Quote:
Originally Posted by MarkhamDBA
Our db has more than 700 tables so running reorgs on all of them one by one would be time consuming (not to say ridiculous ).
In my opinion, it will indeed be ridiculous, but for a different reason. It is highly unlikely that you need to reorg all 700 tables at once. Besides, only you can decide which will be the best clustering index, if any, for each table - you cannot automate that decision.

You would have to analyze the results of REORGCHK and make appropriate decisions. Nobody said being a DBA is easy...

As for statistics, you could use REORGCHK UPDATE STATISTICS FOR SCHEMA ... to, well, update statistics for all tables in a schema.
Reply With Quote
  #3 (permalink)  
Old 01-12-09, 10:33
mdx34 mdx34 is offline
Registered User
 
Join Date: Oct 2004
Posts: 238
See if this hepls............

Help - WebSphere Commerce version 5.6.1.4
Reply With Quote
  #4 (permalink)  
Old 01-14-09, 21:16
stephen.song stephen.song is offline
Registered User
 
Join Date: Aug 2004
Posts: 24
try this sql and save the result as a file and then "db2 -tf filename"

select 'REORG INDEXES ALL FOR TABLE '||tabschema||'.'||tabname||';' from syscat.tables where tabschema='xxx' and type='T'
union all
select 'REORG TABLE '||tabschema||'.'||tabname||';' from syscat.tables where tabschema='xxx' and type='T';
__________________
I am a java and database developer.
Reply With Quote
  #5 (permalink)  
Old 01-15-09, 08:56
dav1mo dav1mo is offline
Registered User
 
Join Date: Dec 2007
Location: Richmond, VA
Posts: 782
I would not run the script as mentioned, yes use the SQL to generate the list of objects to reorg. Reorg is an asynchronous command, so you need to add logic to ensure the prior reorg is complete prior to submitting the next one. Otherwise you are reorging your entire db at the same time, if your machine can handle that workload, then by all means go for it.
Reply With Quote
  #6 (permalink)  
Old 01-15-09, 09:03
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
Only inplace reorg is asynchronos, AFAIK

Quote:
Reorg is an asynchronous
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #7 (permalink)  
Old 01-15-09, 12:33
MarkhamDBA MarkhamDBA is offline
Registered User
 
Join Date: Dec 2008
Location: Toronto, Canada
Posts: 381
SCHEMA NAME CARD LEAF ELEAF LVLS ISIZE NDEL KEYS F4 F5 F6 F7 F8 REORG
Table: DBA.XXS_XXXXXXXXX
DBA xxxXNTYPEIX 7560 13 0 2 4 0 64 100 79 9 0 0 -----
IPLF xxxXNIX 7560 92 0 3 34 0 7560 75 89 86 0 0 *----
IPLF TXNPOSTIX 7560 12 0 2 12 0 41 95 87 9 0 0 -----
SYSIBM SQL050621141422620 7560 97 0 3 37 0 7560 75 90 75 0 0 *----

Table: DBA.XX_XXXXXX
DBA XXXTXNIX11 235 6 0 2 72 0 235 95 95 18 0 0 -----
DBA XXXTXNIX22 235 1 0 1 42 0 25 100 - - 0 0 -----
DBA XXXTXNIX33 235 2 0 2 42 0 105 50 150 59 0 0 *----

So in the above example should I do anything with IPLF.xxxXNIX, SYSIBM.SQL050621141422620, DBA.XXXTXNIX33 indexes if there is a * in the REORG col? What is SYSIBM.SQL050621141422620 anyway?
__________________
DB2 v9.5 ESE on AIX v6.1/ v9./10 on z/OS
Reply With Quote
  #8 (permalink)  
Old 01-17-09, 04:46
przytula_guy przytula_guy is offline
Registered User
 
Join Date: Apr 2006
Location: Belgium
Posts: 1,159
it is a key/index that has been created implicitely for you
eg alter table .. primary key ... will create an index for you..if not exist
__________________
Best Regards, Guy Przytula
Database Software Consultant
DB2 UDB LUW Certified V7-V8-V9-V9.7 DB Admin - Dprop..
Information Server Datastage Certified
http://www.infocura.be
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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