db2 Cert9183 PDF
db2 Cert9183 PDF
db2 Cert9183 PDF
24 May 2007
Explore the topic of troubleshooting for IBM® Informix® Dynamic Server. After a brief
overview, you'll learn about the various tools that are available for troubleshooting,
and then look at examples of how to examine the database server to solve problems.
The third in a series of eight tutorials, use this tutorial to help prepare for the IDS 11
exam 918.
Troubleshooting Trademarks
© Copyright IBM Corporation 2007. All rights reserved. Page 1 of 37
developerWorks® ibm.com/developerWorks
This tutorial is designed to introduce you to a variety of monitoring tools that are
available with IDS 11 and to show you how each are used. In this tutorial, you will
learn about:
Objectives
After completing this tutorial, you should be able to:
Prerequisites
IDS 11 installation is covered in part 1 of this tutorial series. If you haven't already
done so, consider downloading and installing a copy of IBM IDS 11. Installing IDS
will help you understand many of the concepts that are tested on the System
Administration for IBM IDS V11 Certification exam.
System requirements
You do not need a copy of IDS to complete this tutorial. However, you will get more
out of the tutorial if you download the free trial version of IBM IDS 11 to work along
with this tutorial.
Troubleshooting Trademarks
© Copyright IBM Corporation 2007. All rights reserved. Page 2 of 37
ibm.com/developerWorks developerWorks®
This tutorial shows general techniques to approach the following kinds of issues:
• Memory issues
• Disk space issues
• Networking issues
• Buffer pool issues
• Locking and concurrency
Tracing is not covered in this tutorial.
Getting started
One of the big problems with an application such as IDS is knowing where to start.
Typically, it is very helpful to try to state the problem in a single sentence to codify
what the issue is. The closer that you can codify this to IDS terms, the easier it is to
apply.
As an example, an issue that a DBA may run into is that a client application appears
locked.
Troubleshooting Trademarks
© Copyright IBM Corporation 2007. All rights reserved. Page 3 of 37
developerWorks® ibm.com/developerWorks
So, to look at the problem with IDS perspective, you can ask "What is the application
waiting on?"
From understanding the architecture you understand that the entry point of an
application to the engine is the sqlexec. So, the next question to ask is "Which
sqlexec thread?"
You can then look at all userthreads by doing an onstat -u, which you can tie
back to your application (using of the tty column OR the username).
Now, from the flags of the onstat -u, you may get exactly what you need. Say that
the first column of the flags is a B. That explains that you are waiting on a buffer.
The questions you then have to ask are "Which buffer? And who owns it?"
In that line is the owner column. You can map the owner column back to the owner
with an onstat -u | grep <address in the owner column>.
You can then get the session id from that onstat -u output.
This information can also be gathered by querying the sysmaster database. The
benefit of the sysmaster database is that queries can be saved for future use. So
once a problem has been tracked down, the methodology can then be reused with
sql rather than typing the commands out. It's just a matter of preference
Throughout the tutorial, there are examples of how to apply the techniques to help
narrow down problems with IDS.
Memory usage
There are several commands that track memory usage:
Troubleshooting Trademarks
© Copyright IBM Corporation 2007. All rights reserved. Page 4 of 37
ibm.com/developerWorks developerWorks®
onstat -g mem
Troubleshooting Trademarks
© Copyright IBM Corporation 2007. All rights reserved. Page 5 of 37
developerWorks® ibm.com/developerWorks
onstat -g ses
onstat -g ses can show memory usage for a single session. This can be very
handy in looking for such things as a memory leak if you do an onstat -g ses
-r and see memory allocation growing constantly but the memory usage is not.
$ onstat -g ses
IBM Informix Dynamic Server Version 11.10.FB5TL -- On-Line -- Up 2 days 01:52:52
-- 39936 Kbytes
session #RSAM total used dynamic
id user tty pid hostname threads memory memory explain
35 informix - 0 - 0 12288 11592 off
18 informix - 0 - 1 425984 338128 off
17 informix - 0 - 1 434176 337408 off
16 informix - 0 - 1 282624 227560 off
5 informix - 0 - 0 12288 11592 off
3 informix - 0 - 0 16384 13176 off
2 informix - 0 - 0 12288 11592 off
35 informix - 0 - 0 81920 76360 off
The most important parts are the total memory and used memory. But you can
granulate even further by using onstat -g ses for a particular session id.
$ onstat -g ses 35
IBM Informix Dynamic Server Version 11.10.FB5TL -- On-Line -- Up 2 days 01:55:28
-- 39936 Kbytes
session #RSAM total used dynamic
id user tty pid hostname threads memory memory explain
35 informix 53 15046 ryleh 1 81920 76360 off
tid name rstcb flags curstk status
59 sqlexec 10afaa7d0 Y--P--- 7791 cond wait(sm_read)
Memory pools count 2
name class addr totalsize freesize #allocfrag #freefrag
35 V 10bf99040 77824 4720 110 5
35*O0 V 10c072040 4096 840 1 1
name free used name free used
overhead 0 6512 scb 0 144
opentable 0 2568 filetable 0 496
log 0 12096 temprec 0 1696
keys 0 800 ralloc 0 18992
gentcb 0 1640 ostcb 0 2864
sqscb 0 18880 sql 0 7
rdahead 0 160 hashfiletab 0 552
osenv 0 2880 buft_buffer 0 2168
sqtcb 0 3216 fragman 0 488
sapi 0 64
Troubleshooting Trademarks
© Copyright IBM Corporation 2007. All rights reserved. Page 6 of 37
ibm.com/developerWorks developerWorks®
sqscb info
scb sqscb optofc pdqpriority sqlstats optcompind directives
10bde6400 10bf63028 0 0 0 2 1
onstat -g afr
The onstat -g afr option prints allocated memory fragments for a specified
session or shared-memory pool. Each session is allocated a pool of shared memory.
This is a good command to start when trying to granulate which pool of memory is
being allocated to. For instance, if you constantly see the ralloc pool growing as you
run this repetitively (onstat -g afr -r), then you may have isolated what pool of
memory is growing unchecked.
$ onstat -g afr 35
IBM Informix Dynamic Server Version 11.10.FB5TL -- On-Line -- Up 2 days 02:12:18
-- 39936 Kbytes
Allocations for pool name 35:
addr size memid
10bf99000 3256 overhead
10bf99cb8 80 scb
10bf99d08 64 scb
1bf99d48 64 ostcb
10bf99d88 552 opentable
10bf99fb0 80 osenv
10bf63000 6856 sqscb
10bf64ac8 64 sqscb
10bf64b08 72 sql
10bf64b50 72 filetable
10bf64b98 80 fragman
10bf64be8 80 sqscb
10bf64c38 64 sqscb
.
.
.
.
.
.
10bf57f78 136 fragman
10c071000 2744 ralloc
10c071ab8 1024 ralloc
10c073000 2168 buft_buffer
Troubleshooting Trademarks
© Copyright IBM Corporation 2007. All rights reserved. Page 7 of 37
developerWorks® ibm.com/developerWorks
onstat -g ffr
Much like the afr is the ffr, which shows the free fragments for a pool of shared
memory.
$ onstat -g ffr 35
IBM Informix Dynamic Server Version 11.10.FB5TL -- On-Line -- Up 2 days 02:15:57
-- 39936 Kbytes
Free lists for pool name 35:
addr size idx
10c073878 1928 1
10bf9ba40 104 11
10c071eb8 328 39
10bf9cdd8 552 66
10bf548a8 1808 99
Let's say that the System Administrator calls you and says that IDS is taking up too
much memory, and that it's constantly growing. If you have not made any
configuration changes, the first thing to investigate is if there are any sessions that
are taking up a lot of memory.
$ onstat -g ses
Troubleshooting Trademarks
© Copyright IBM Corporation 2007. All rights reserved. Page 8 of 37
ibm.com/developerWorks developerWorks®
You can see that there is an app that has grabbed only uses around 16KB of
memory and yet has allocated, at least in one session, over a gigabyte of memory.
Wow! It's still growing. What you have here is a memory leak. At this point, you can
put a call in to your developers and ask what changes they have made.
Network usage
onstat -g nta
Using the onstat -g nta prints combined network statistics from -g ntd, -g
ntm, -g ntt, and -g ntu. If MaxConnect is installed, this command prints
statistics that you can use to tune MaxConnect performance.
onstat -g ntd
Troubleshooting Trademarks
© Copyright IBM Corporation 2007. All rights reserved. Page 9 of 37
developerWorks® ibm.com/developerWorks
sqlexec yes 1 0 7 8
srvinfx yes 0 0 0 0
onspace yes 0 0 0 0
onlog yes 0 0 0 0
onparam yes 0 0 0 0
oncheck yes 0 0 0 0
onload yes 0 0 0 0
onunload yes 0 0 0 0
onmonitor yes 0 0 0 0
dr_accept yes 0 0 0 0
cdraccept no 0 0 0 0
ontape yes 0 0 0 0
srvstat yes 0 0 0 0
asfecho yes 0 0 0 0
listener yes 0 0 1 0
crsamexec yes 0 0 0 0
onutil yes 0 0 0 0
safe yes 0 0 0 0
drdaexec no 0 0 0 0
smx yes 0 0 0 0
Totals 1 0 8 8
onstat -g ntm
$ onstat -g ntm
IBM Informix Dynamic Server Version 11.10.FB5TL -- On-Line -- Up 00:03:35
-- 38912 Kbytes
global network information:
#netscb connects read write q-free q-limits q-exceed alloc/max
6/ 6 1 8 8 0/ 0 135/ 10 0/ 0 1/ 1
Network mailbox information:
box netscb thread name max received in box max in box full signal
5 10b239928 tlitcppoll 10 4 0 2 0 yes
6 10b250928 tlitcplst 10 0 0 0 0 no
onstat -g ntt
$ onstat -g ntt
IBM Informix Dynamic Server Version 11.10.FB5TL -- On-Line -- Up 00:04:55
-- 38912 Kbytes
global network information:
#netscb connects read write q-free q-limits q-exceed alloc/max
6/ 6 1 8 8 0/ 0 135/ 10 0/ 0 1/ 1
Individual thread network information (times):
netscb thread name sid open read write address
10b4bf368 sqlexec 4 07:34:44 07:34:55 07:34:55
10c10ccd0 17 07:34:28
Troubleshooting Trademarks
© Copyright IBM Corporation 2007. All rights reserved. Page 10 of 37
ibm.com/developerWorks developerWorks®
10b270790 16 07:34:28
10b3abd18 15 07:34:28
10b250928 tlitcplst 3 07:34:22 07:34:44 ryleh|1537|tlitcp
10b239928 tlitcppoll 2 07:34:22
Notice that the output shows a great deal of information in the write address column.
It gives the server | port | protocol combination out of the sqlhosts file. This can be
handy in trying to track down problems if you have multiple listener threads.
onstat -g ntu
$ onstat -g ntu
IBM Informix Dynamic Server Version 11.10.FB5TL -- On-Line -- Up 00:08:28
-- 38912 Kbytes
global network information:
#netscb connects read write q-free q-limits q-exceed alloc/max
6/ 6 1 8 8 0/ 0 135/ 10 0/ 0 1/ 1
Individual thread network information (basic):
netscb type thread name sid fd poll reads writes q-nrm q-pvt q-exp
10b4bf368 tlitcp sqlexec 4 2 5 8 8 0/ 1 1/1 0/ 0
10c10ccd0 tlitcp unknown 17 0 0 0 0 0/ 0 0/ 0 0/ 0
10b270790 tlitcp unknown 16 0 0 0 0 0/ 0 0/0 0/ 0
10b3abd18 tlitcp unknown 15 0 0 0 0 0/ 0 0/ 0 0/ 0
10b250928 tlitcp tlitcplst 3 1 5 1 0 0/ 0 0/0 0/ 0
10b239928 tlitcp tlitcppoll 2 0 5 7 0 0/ 0 0/0/ 0
Let's say that as a DBA you start getting calls from users saying that some of them
are having trouble getting connected.
A quick look at the online log doesn't show anything. So, let's run an onstat -g
nta to see if there is anything anomalous.
Troubleshooting Trademarks
© Copyright IBM Corporation 2007. All rights reserved. Page 11 of 37
developerWorks® ibm.com/developerWorks
Troubleshooting Trademarks
© Copyright IBM Corporation 2007. All rights reserved. Page 12 of 37
ibm.com/developerWorks developerWorks®
smx yes 0 0 0 0
Totals 15 0 936 714
From the onstat -g ntm output (the mailboxes), you see that one of the listener
threads has not done any reading in quite a while.
DBSERVERALIASES demo_alias
So, in a production environment, the facile solution is to have your users switch to
another DBSERVERALIAS or DBSERVERNAME. To pursue the root cause is
beyond the scope of this tutorial.
Session activities
onstat -g ses
As mentioned earlier, this command is very useful in tracking down memory leaks on
a client application.
It can be run with the -r option ( onstat -g ses -r ) and watch if the total
memory is growing constantly while the total amount of used memory is static.
Troubleshooting Trademarks
© Copyright IBM Corporation 2007. All rights reserved. Page 13 of 37
developerWorks® ibm.com/developerWorks
$ onstat -g ses
IBM Informix Dynamic Server Version 11.10.FB5TL -- On-Line -- Up 00:14:47
-- 38912 Kbytes
session #RSAM total used dynamic
id user tty pid hostname threads memory memory explain
18 informix - 0 - 0 12288 11592 off
17 informix - 0 - 1 303104 260672 off
16 informix - 0 - 1 307200 265480 off
15 informix - 0 - 1 278528 227640 off
4 informix 53 25457 ryleh 1 98304 91928 off
3 informix - 0 - 0 16384 13176 off
2 informix - 0 - 0 12288 11592 off
From here you can look at the pid of a process that is a compliant application,
number of threads it may have, and total memory.
For more information about a particular session, you can use onstat -g ses with
a particular session id:
$ onstat -g ses 35
IBM Informix Dynamic Server Version 11.10.FB5TL -- On-Line -- Up 2 days 01:55:28
-- 39936 Kbytes
session #RSAM total used dynamic
id user tty pid hostname threads memory memory explain
35 informix 53 15046 ryleh 1 81920 76360 off
tid name rstcb flags curstk status
59 sqlexec 10afaa7d0 Y--P--- 7791 cond wait(sm_read)
Memory pools count 2
name class addr totalsize freesize #allocfrag #freefrag
35 V 10bf99040 77824 4720 110 5
35*O0 V 10c072040 4096 840 1 1
name free used name free used
overhead 0 6512 scb 0 144
opentable 0 2568 filetable 0 496
log 0 12096 temprec 0 1696
keys 0 800 ralloc 0 18992
gentcb 0 1640 ostcb 0 2864
sqscb 0 18880 sql 0 7
rdahead 0 160 hashfiletab 0 552
osenv 0 2880 buft_buffer 0 2168
sqtcb 0 3216 fragman 0 488
sapi 0 64
sqscb info
scb sqscb optofc pdqpriority sqlstats optcompind directives
10bde6400 10bf63028 0 0 0 2 1
Troubleshooting Trademarks
© Copyright IBM Corporation 2007. All rights reserved. Page 14 of 37
ibm.com/developerWorks developerWorks®
As you can see, there is far more information about the session here. You can find
the isolation level, the current sql statement, the front end version, as well as
memory usage (previously discussed).
A note about the rstcb. This corresponds to the first column in the output of onstat
-u.
Let's say that after you resolve your issue with that DBSREVERALIAS, there is still
one user who is complaining that his application is still hung. So, you ask him his
username: bad_user.
There isn't anything really alarming here. The memory used is pretty close to what is
allocated. Let's use onstat -g ses to see what this user is doing:
$ onstat -g ses 35
IBM Informix Dynamic Server Version 11.10.FB5TL -- On-Line -- Up 2 days 01:55:28
-- 39936 Kbytes
session #RSAM total used dynamic
id user tty pid hostname threads memory memory explain
2257 bad_user 15098 ryleh 1 122288 121592 off
tid name rstcb flags curstk status
2070 sqlexec 10afaa7d0 Y--P--- 7791 cond wait(sm_read)
Memory pools count 2
name class addr totalsize freesize #allocfrag #freefrag
35 V 10bf99040 77824 4720 110 5
35*O0 V 10c072040 4096 840 1 1
name free used name free used
overhead 0 6512 scb 0 144
opentable 0 2568 filetable 0 496
log 0 12096 temprec 0 1696
keys 0 800 ralloc 0 18992
gentcb 0 1640 ostcb 0 2864
Troubleshooting Trademarks
© Copyright IBM Corporation 2007. All rights reserved. Page 15 of 37
developerWorks® ibm.com/developerWorks
That is a complicated insert. But wait. Look at the flags and the state of the thread.
The flags are Y--P---. From looking in the manual, you can see that the thread is
yielding to some condition. And from the state of the thread, you know which
condition that is: cond_wait(smread).
So, at this point, you ask the customer to look at the client application because the
sqlexec is waiting for the client app to tell it to do something.
Troubleshooting Trademarks
© Copyright IBM Corporation 2007. All rights reserved. Page 16 of 37
ibm.com/developerWorks developerWorks®
onstat -p
$ onstat -p
IBM Informix Dynamic Server Version 11.10.FB5TL -- On-Line -- Up 00:17:03
-- 3812 Kbytes
Profile
dskreads pagreads bufreads %cached dskwrits pagwrits bufwrits %cached
933 961 101742 99.08 173 441 6221 97.22
The first thing to look at is the ovbuff. Ovbuff is the number of times that the engine
ran out of buffers to work with. If ovbuffs is increasing, then increasing the size of the
buffer pool is warranted.
onstat -F
$ onstat -F
IBM Informix Dynamic Server Version 11.10.FB5TL -- On-Line -- Up 00:20:45
-- 38912 Kbytes
Fg Writes LRU Writes Chunk Writes
0 0 98
address flusher state data # LRU Chunk Wakeups Idle Time
10afa5820 0 I 0 0 1 1239 1237.670
states: Exit Idle Chunk Lru
onstat -R
Troubleshooting Trademarks
© Copyright IBM Corporation 2007. All rights reserved. Page 17 of 37
developerWorks® ibm.com/developerWorks
onstat -R is used to monitor the LRU queues. For each queue, onstat -R lists
the number of buffers in the queue, and the number and percentage of buffers that
have been modified.
$ onstat -R
IBM Informix Dynamic Server Version 11.10.FB5TL -- On-Line -- Up 00:30:51
-- 3812 Kbytes
Buffer pool page size: 2048
8 buffer LRU queue pairs priority levels
# f/m pair total % of length LOW HIGH
0 F 624 100.0% 624 624 0
1 m 0.0% 0 0 0
2 f 625 100.0% 625 625 0
3 m 0.0% 0 0 0
4 f 626 100.0% 626 626 0
5 m 0.0% 0 0 0
6 f 625 100.0% 625 625 0
7 m 0.0% 0 0 0
8 f 625 100.0% 625 625 0
9 m 0.0% 0 0 0
10 f 625 100.0% 625 625 0
11 m 0.0% 0 0 0
12 f 625 100.0% 625 625 0
13 m 0.0% 0 0 0>
14 f 625 100.0% 625 625 0
15 m 0.0% 0 0 0
0 dirty, 5000 queued, 5000 total, 8192 hash buckets, 2048 buffer size
start clean at 60.000% (of pair total) dirty, or 374 buffs dirty, stop at
50.000%
Troubleshooting Trademarks
© Copyright IBM Corporation 2007. All rights reserved. Page 18 of 37
ibm.com/developerWorks developerWorks®
Summary information follows the individual LRU queue information. You can
interpret the summary information as follows:
Troubleshooting Trademarks
© Copyright IBM Corporation 2007. All rights reserved. Page 19 of 37
developerWorks® ibm.com/developerWorks
Let's say that as the DBA you are starting to get users who call in and say that
performance is slowing down.
One thing you may run just to see if there is any bottlenecks is an onstat -p
output. Running it once is not necessarily helpful because it is just a snapshot But
you can use the -r output to see if there is anything that is really slowing you down.
$ onstat -pr
IBM Informix Dynamic Server Version 11.10.FB5TL -- On-Line -- Up 00:17:03
-- 3812 Kbytes
Profile
dskreads pagreads bufreads %cached dskwrits pagwrits bufwrits %cached
2007 1000 201742 99.08 173 441 6221 97.22
Troubleshooting Trademarks
© Copyright IBM Corporation 2007. All rights reserved. Page 20 of 37
ibm.com/developerWorks developerWorks®
38 5 162 203 3
IBM Informix Dynamic Server Version 11.10.FB5TL -- On-Line -- Up 00:17:03
-- 3812 Kbytes
Profile
dskreads pagreads bufreads %cached dskwrits pagwrits bufwrits %cached
2103 1020 206641 99.08 173 441 6221 97.22
From looking at the Listing 10, you know that bufwaits is increasing very quickly.
There must be some page(s) that are very hot.
There are a couple of ways to try to dig down from this angle. My personal
preference is try to find out what buffer is hot by looking at the onstat -X. The
onstat -X output will print buffer accessor information.
$ onstat -X
IBM Informix Dynamic Server Version 11.10.FB5TL -- On-Line -- Up 01:38:47 -- 389
12 Kbytes
Buffers (Access)
address owner flags pagenum memaddr nslots
10a21ede0 0 103 11:5893 10a627800 9
pgflgs scount waiter
80e 90 10afa5028
10afa5820
10afa6028
.
.
.
10afaa028
Buffer pool page size: 2048
200 modified, 5000 total, 8192 hash buckets, 2048 buffer size
You have one page that has a lot of people trying to access that page. From there, it
becomes a simple matter of mapping that to the onstat -u/onstat -g ses level,
and try to find out what that page is and how it is being used.
There is a big clue in the pgflags output. 0x80e means that it is a page from a big
chunk and that it is a blob bitmap page.
Troubleshooting Trademarks
© Copyright IBM Corporation 2007. All rights reserved. Page 21 of 37
developerWorks® ibm.com/developerWorks
The waiter and owner columns correspond to the first column in the onstat -u
output.
Disk usage
onstat -d
onstat -d
IBM Informix Dynamic Server Version 11.10.FB5TL -- On-Line -- Up 00:39:25
-- 3812 Kbytes
Dbspaces
address number flags fchunk nchunks pgsize flags owner name
10aedee78 1 0x40001 1 1 2048 N B informix rootdbs
1 active, 2047 maximum
Chunks
address chunk/dbs offset size free bpages flags pathname
10aedf028 1 1 0 15000 1238 PO-B /testing/prod/1110FC1B5/SERVER
/chunks/rootchunk
1 active, 32766 maximum
Note: The values in the "size" and "free" columns for DBspace chunks are displayed
in terms of "pgsize" of the DBspace to which they belong.
onstat -D
$ onstat -D
IBM Informix Dynamic Server Version 11.10.FB5TL -- On-Line -- Up 00:42:00
-- 38912 Kbytes
Dbspaces
Troubleshooting Trademarks
© Copyright IBM Corporation 2007. All rights reserved. Page 22 of 37
ibm.com/developerWorks developerWorks®
Note: The values in the "page Rd" and "page Wr" columns for DBspace chunks are
displayed in terms of system base page size.
Instead of the size of the chunks, what you see are the amounts of pages read and
written per chunk.
I/O at a chunk level can be monitored with this command run repetitively. It is not as
fine or as granulated as looking at I/O at the partition level (onstat -P). But it is a
good way to look at stuff in a high level.
onstat -g iof
The onstat -g iof option displays the number of reads from each chunk and the
number of writes to each chunk. If one chunk has a disproportionate amount of I/O
activity against it, this chunk might be a system bottleneck. This option is useful for
monitoring the distribution of I/O requests against the different fragments of a
fragmented table.
$ onstat -g iof
IBM Informix Dynamic Server Version 11.10.FB5TL -- On-Line -- Up 01:21:55
-- 38912 Kbytes
AIO global files:
gfd pathname bytes read page reads bytes write page writes io/s
3 rootchunk 2697216 1317 2418688 1181 224.8
op type count avg. time
seeks 0 N/A
reads 904 0.0010
writes 454 0.0112
kaio_reads 0 N/A
kaio_writes 0 N/A
onstat -g iob
onstat -g iov
Troubleshooting Trademarks
© Copyright IBM Corporation 2007. All rights reserved. Page 23 of 37
developerWorks® ibm.com/developerWorks
The onstat -g iov option shows asynchronous I/O statistics for each virtual
processor.
onstat -g ioa
The onstat -g ioa combines the onstat -g iob, the onstat -g iof, and
the onstat -g iov in one output.
Say a user calls in, is trying to update several million rows of a table, and wants to
know why it's taking so long.
Chunks
address chunk/dbs offset page Rd page Wr pathname
10aedf028 12 2 0 157000 42790 /dev/chunksdatadbschunk
.
.
Troubleshooting Trademarks
© Copyright IBM Corporation 2007. All rights reserved. Page 24 of 37
ibm.com/developerWorks developerWorks®
So, in looking at the output, you see that even though the datadbs dbspace is not
filling very fast, the idxdbs is extremely busy.
Why would the idxdbs be busy? Well, a simple dbschema could be run at that point
that would verify if the user has indexes on that table. A simple solution then is to
disable indexes and re-enable them after the mass update.
The database server creates the sysmaster database when it initializes disk space.
The database server creates the database with unbuffered logging. You cannot drop
the database or any of the tables in it through the normal drop database commands.
To rebuild the sysmaster database, you should contact technical support to lead you
through the $INFORMiXDIR/etc/buildsmi utility.
Let's start by looking at the syslocks table in the sysmaster database and see how it
can help troubleshoot locking problems.
Example: Syslocks
The syslocks table tracks locks and is analogous to the output from onstat -k.
Troubleshooting Trademarks
© Copyright IBM Corporation 2007. All rights reserved. Page 25 of 37
developerWorks® ibm.com/developerWorks
>
Locks
address wtlist owner lklist type tblsnum rowid key#/bsiz
10a166f68 0 10afa7008 10a166ce8 HDR+X 10015f 100 0
There is a fair amount of data here, but it involves some work to get meaningful
information.
Let's look at the same locks by executing the command in Listing 27 in sysmaster.
(Note that the "where" clause is omitted.)
The first thing to notice is that instead of a cryptic partnum, there is an actual
database name and a table name. This is more meaningful for us. The other thing to
notice is that instead of the address for the owner given in the onstat -k output,
we are actually given a session id. So, you can run an onstat-g ses, -g sql,
-g stm to find out what the user is doing that has locked that resource.
One thing to note is that the results from querying the sysmaster database is usually
given in decimal format, whereas onstat output may be given in hexadecimal
format. This can cause some confusion if you are trying to track down a problem
using both modalities.
There are many pseudo-tables that are usually intuitively named to correspond with
the resource they are tracking.
Troubleshooting Trademarks
© Copyright IBM Corporation 2007. All rights reserved. Page 26 of 37
ibm.com/developerWorks developerWorks®
sysptntab onstat -t
sysusers onstat -u
The sysadmin database, which contains tables is a logged database. You use the
task properties (not configuration parameters) to define the information that the
scheduler collects and the statements the scheduler executes.
PH_TASK
The PH_TASK table contains information about how and when a task will be
updated.
Troubleshooting Trademarks
© Copyright IBM Corporation 2007. All rights reserved. Page 27 of 37
developerWorks® ibm.com/developerWorks
Troubleshooting Trademarks
© Copyright IBM Corporation 2007. All rights reserved. Page 28 of 37
ibm.com/developerWorks developerWorks®
PH_RUN
The PH_RUN table contains information about how and when each scheduler task
ran
Troubleshooting Trademarks
© Copyright IBM Corporation 2007. All rights reserved. Page 29 of 37
developerWorks® ibm.com/developerWorks
The time this was executed was April 9 at 11:46. It is run once a day, and there is a
row for each and every run. The return code 0 shows that it was successful.
PH_GROUP
The PH_GROUP table contains names about the scheduling group names.
There are several different groups: MISC, DISK, NETWORK, MEMORY, CPU,
TABLES, INDEXES, SERVER, USER, BACKUP, and PERFORMANCE.
PH_ALERT
Troubleshooting Trademarks
© Copyright IBM Corporation 2007. All rights reserved. Page 30 of 37
ibm.com/developerWorks developerWorks®
PH_THRESHOLD
The PH_THRESHOLD table holds information about the thresholds before tasks are
Troubleshooting Trademarks
© Copyright IBM Corporation 2007. All rights reserved. Page 31 of 37
developerWorks® ibm.com/developerWorks
Section 6. Concurrency
When using a multiple thread, or multiple process architecture, concurrency is
important. Accessing the data in a single-threaded manner causes bottlenecks, as
processes or threads have to wait for resources. This can slow processing
dramatically. It is more efficient to have multiple applications connecting in parallel to
the database.
Troubleshooting Trademarks
© Copyright IBM Corporation 2007. All rights reserved. Page 32 of 37
ibm.com/developerWorks developerWorks®
Global transactions, in which one transaction spans multiple databases over multiple
connections, is not supported by the WITH CONCURRENT TRANSACTION clause.
The COMMIT WORK and ROLLBACK WORK statements do not act on databases
across multiple connections.
The database server imposes a system of locks to guard against these eventualities.
A lock is a claim, or reservation, that a client can place on data. As long as the data
is locked, no other client can modify it. Depending on the SET LOCK MODE setting,
if another client requests the data, the database server either makes the other client
wait or tells the client the resource is not available, generating an error.
To control the effect that locks have on your data access, use a combination of SQL
statements: SET LOCK MODE, and either SET ISOLATION or SET
TRANSACTION.
If the isolation level is COMMITTED READ (and SET LOCK MODE is not set to
WAIT), locks which are held by other sessions can cause SQL operations to fail if
the current session cannot acquire a lock. Another situation that even SET LOCK
MODE to WAIT will not help is a deadlock. (A deadlock occurs when two users are
holding locks that the other wants) The LAST COMMITTED keyword option to the
SET ISOLATION COMMITTED READ statement of SQL reduces the risk of locking
conflicts. This syntax instructs the server to return the most recently committed
version of the rows, even if another concurrent session holds an exclusive lock. You
can use the LAST COMMITTED keyword option for both B-tree and functional
indexes, logged tables, and tables that do not have page-level locking or exclusive
locks.
USELASTCOMMITTED specifies the isolation level for which the LAST COMMITTED
feature of the COMMITTED READ isolation level is implicitly in effect.
Troubleshooting Trademarks
© Copyright IBM Corporation 2007. All rights reserved. Page 33 of 37
developerWorks® ibm.com/developerWorks
Range of values:
When the database server is in online mode, you can use the onmode -wm and
onmode -wf options to change the values of the USELASTCOMMITTED
configuration parameter.
To specify a new value for either configuration parameter for the current session,
use this syntax:
To change the value of either configuration parameter in the ONCONFIG file, use
this syntax:
SET ENVIRONMENT
The SET ENVIRONMENT SQL statement can specify options at runtime that affect
subsequent queries submitted within the same routine. This is an extension to the
ANSI/ISO standard for SQL.
Troubleshooting Trademarks
© Copyright IBM Corporation 2007. All rights reserved. Page 34 of 37
ibm.com/developerWorks developerWorks®
Section 7. Conclusion
This has been a very brief overview of how to approach troubleshooting in IDS.
The onstat utility has been covered in some detail. onstat options to look at
memory usage, session information, disk usage, and locks have been
demonstrated.
The sysmaster database has been introduced. The syslocks table has been
examined in detail, as well as introducing such tables as sysconfig, syschunks,
syslogs, sysprofile, sysdbspaces, sysptntab, and sysusers.
The sysadmin database was introduced also. This database is tied to the scheduler,
which is covered in part 2 of the series.
Lastly, this tutorial included some mention of the functionality of lock concurrency
and how to adjust it. This would be utilized in an environment with multiple
databases (and database servers) involved in a production architecture
Troubleshooting Trademarks
© Copyright IBM Corporation 2007. All rights reserved. Page 35 of 37
developerWorks® ibm.com/developerWorks
Resources
Learn
• developerWorks Informix zone: Read articles and tutorials and connect to other
resources to expand your Informix skills.
• IBM Informix Dynamic Server Information Center: Learn more about Informix.
• IBM Informix Dynamic Server 11 BETA Information Center: Learn more about
IDS 11.
• developerWorks IDS Experts blog: Find technical notes on Informix Dynamic
Server by a worldwide team of Development and Technical Support engineers.
• IBM Information Management certification page: Learn more about resources
for IDS certification.
• developerWorks Information Management zone: Learn more about Information
Management. Find technical documentation, how-to articles, education,
downloads, product information, and more.
• Stay current with developerWorks technical events and webcasts.
• Technology bookstore: Browse for books on these and other technical topics.
Get products and technologies
• Informix Dynamic Server Enterprise Edition V10.0: Download a free trial
version.
• Informix Dynamic Server 11: Download the free trial version to work along with
this tutorial.
• IBM product evaluation versions: Download and get your hands on application
development tools and middleware products from Information Management,
Lotus®, Rational®, Tivoli®, and WebSphere®.
Discuss
• Participate in the discussion forum for this content.
• Check out developerWorks blogs and get involved in the developerWorks
community.
Troubleshooting Trademarks
© Copyright IBM Corporation 2007. All rights reserved. Page 36 of 37
ibm.com/developerWorks developerWorks®
Joe Baric has been working in Advanced Support for Informix Products
for over ten years. In that time he has coded new features, provided
bug fixes, served as a subject matter expert, helped develop course
materials, and taught various classes on IDS. He can be reached at
jbaric@us.ibm.com.
Trademarks
IBM and Informix are trademarks of IBM Corporation in the United States, other
countries, or both.
Linux is a registered trademark of Linux Torvalds in the United States, other
countries, or both..
Microsoft and Windows are trademarks of Microsoft Corporation in the United States,
other countries, or both.
UNIX is a registered trademark of The Open Group in the United States and other
countries.
Other company, product, or service names may be trademarks or service marks of
others.
Troubleshooting Trademarks
© Copyright IBM Corporation 2007. All rights reserved. Page 37 of 37