473,397 Members | 1,960 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Execute runstats in a stored procedure

Hi,
we want to execute runstats for all database tables in one go.In db2 v9, there is no such option to run runstats schema vise or for complete database.So,can we execute runstats from a stored procedure.
Sep 26 '07 #1
2 4017
raimee
3
I use a shell script to accomplish what you want. You'll have to modify a bit
for you environment.

#!/usr/bin/ksh

################################################## ##

DBNAME="DBNAME"
TABSCHEMA="MYSCHEMA"

db2 activate db $DBNAME
export DB2DBDFT=$DBNAME

echo "Running..."

db2 connect to $DBNAME user user using pass

db2 -x "select tabname from syscat.tables where tabschema='MYSCHEMA' and TYPE='T'" |
while read TABNAME
do
db2 -v -x "runstats on table $TABSCHEMA.\"$TABNAME\" and indexes all"
done

db2 terminate
Sep 26 '07 #2
dewa81
14
If you want to runstats on all the tables in the database we can accomplish this with just a single command

Connect to the database and run the follwing command
reorgchk update statistics
Sep 26 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Matt | last post by:
I want to exexute stored procedure in ASP, but it has error "Microsoft VBScript compilation (0x800A0401) Expected end of statement" on line (1). The stored procedure "sp_emp" contain "select *...
1
by: Gerald Khin | last post by:
Calling a RUNSTATS statement through JDBC fails due to a syntax error. I guess that this is because RUNSTATS is no SQL. JNI is not an option for me. I wonder if there is some package or stored...
11
by: Spencer | last post by:
We are on 8.1.6 currently on AIX. Has anyone been able to come up with a solution that allows the ability to do a RUNSTATS from SQL prompt instead of the command line? I see lots of posts about...
2
by: Eli | last post by:
Hi all We currently have a strange problem with calling a Stored Procedure (SQL Database) in our C# Project. The only error I get is "System error" which says a lot :) Background: We have...
7
by: JIM.H. | last post by:
Hello, Is there any difference to between SLQ string in the code and call execute query and call a stored procedure and execute the query that way concerning speed, effectiveness, reliability,...
0
by: franjorge | last post by:
Hi, I have created two stored procedures via VB using this code: sql = "CREATE PROC " & nombre_proc & " AS SELECT *" & _ " From MBM_PUNTOS_SCE_SIN_COINCIDIR_SIEGE_FALTA_PM_NE_" & mes & _ "...
2
by: sansaniwal12 | last post by:
Hi, we want to execute runstats for all database tables in one go.In db2 v9, there is no such option to run runstats schema vise or for complete database.So,can we execute runstats from a stored...
0
by: jasonlyt | last post by:
Can anyone advise me how to run Runstats and Load command in a stored procedure? Thanks.
0
by: RG | last post by:
I have a stored procedure which is called by db2 "call ....." statement from ksh script. When running from AIX DB2 v. 9.1.3 environment, after a while the stored procedure starts to hang and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.