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 > Script to show Top-Users and/or Top-DBs

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-05-04, 05:54
blackbrain blackbrain is offline
Registered User
 
Join Date: Nov 2003
Posts: 24
Script to show Top-Users and/or Top-DBs

I have the following Problem, we have a big DB2-Server with 63 Databases.
And the Hardware is crap.

So sometimes the phone rings and someone asks me "Why is the server so slow" and then i had to connect to the DB and start looking.

Now i have the idea to write a script in some language to do this automated for me. So when the phone again rings, i only have to start the script and see why the server is at 100% CPU usage.

I hope someone could help, or give me an idea.

jhp
black_
Reply With Quote
  #2 (permalink)  
Old 05-05-04, 06:23
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,198
If you are running DB2 for Linx, Windows, or UNIX then having 63 active databases at one time is not a good idea. Each database uses a certain amount of memory that is not shared between the databases. You might want to consider consolodating databases and using schemas to keep the data seperate.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #3 (permalink)  
Old 05-05-04, 08:34
blackbrain blackbrain is offline
Registered User
 
Join Date: Nov 2003
Posts: 24
Its our Development Server so the performance is not so critical.
But if someone locks the server complete up, i want to know who it is.

About the transfer in schemas, i recommend this a time ago, but noone wants it.
And if they are pleased with the performance, why should i keep trying.

jhp
black_
Reply With Quote
  #4 (permalink)  
Old 05-05-04, 10:06
hanyheggy hanyheggy is offline
Registered User
 
Join Date: Jan 2004
Location: Egypt
Posts: 61
if u running UNIX or linux try this sheel script, then see which process get max CPU tics "C" column



if [ $1 eq '']
then
a=1
else
a=$1
fi

if [ $1 eq '']
then
b=25
else
b=$2
fi

while true
do
vmstat 1 2 > /tmp/process.out
echo "-------------------------------------------------------------------" >> /tmp/process.out
print " ORDER BY CPU Ticks [ C ]" >> /tmp/process.out
print " UID PID PPID C STIME TTY TIME CMD " >> /tmp/process.out
echo "-------- ---- ------ --- -------- ------ ----- --------------------" >> /tmp/process.out
ps -ef | sort -rn +3 | head -n $b >> /tmp/process.out

clear
head -n $b /tmp/process.out
sleep $a
done
__________________
hany heggy,
IBM certified Professional, AIX system support
www.melodyhits.tv
Reply With Quote
  #5 (permalink)  
Old 05-05-04, 10:42
blackbrain blackbrain is offline
Registered User
 
Join Date: Nov 2003
Posts: 24
Thx for the script, but i forget to mention that the server is UDB 8.1 on Windows 2000 Server.

jhp
black_
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