473,378 Members | 1,319 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,378 software developers and data experts.

db2 hangs when using snapshot monitor on linux

Hi all

I'm using DB2 UDB v8.2 on linux.
After minimizing the code in order to isolate the problem, I have a
simple jdbc client that executes the following SQL statement in loop :
SELECT * FROM TABLE (SNAPSHOT_LOCK (CAST (NULL AS CHAR), -1)) AS
LOCK_INFO

After each query the client sleeps for 100 ms, and then continues the
loop, so the database machine is not under load (cpu consumption is
about 5-10 %).
After couple of minutes the database process takes 100 % cpu, I cannot
stop the database, and the sometimes, the OS hangs, and I need to
reboot the machine (push the reset button).

Does anybody knows this problem ? How can I solve it ?

TIA
steingold.

Oct 25 '06 #1
4 1848
It would be easier to help you if you gave more information about the
environment. Without ALL of the code you are executing, it's guesswork
to determine what you've done.

The simplest error is that you aren't closing the statement after
retrieving the data rows. Your error is indicative of running out of DB2
agents or memory. Try some system monitoring tools (ie. "top") while
this is running and see if you can discover anything else about what is
happening.

I'd also think that checking locks every 0.1 second would generate a
awful lot of data to analyze.

Phil Sherman
st*******@gmail.com wrote:
Hi all

I'm using DB2 UDB v8.2 on linux.
After minimizing the code in order to isolate the problem, I have a
simple jdbc client that executes the following SQL statement in loop :
SELECT * FROM TABLE (SNAPSHOT_LOCK (CAST (NULL AS CHAR), -1)) AS
LOCK_INFO

After each query the client sleeps for 100 ms, and then continues the
loop, so the database machine is not under load (cpu consumption is
about 5-10 %).
After couple of minutes the database process takes 100 % cpu, I cannot
stop the database, and the sometimes, the OS hangs, and I need to
reboot the machine (push the reset button).

Does anybody knows this problem ? How can I solve it ?

TIA
steingold.
Oct 25 '06 #2
Hi Phil, thanks for your reply.

What kind of environmental data would be relevant ?

I do close the statement after retrieving the data rows. If it is a
memory issue, I cannot see it in "top" or in "vmstat".
Is there any db2 tool that might supply a better diagnostic ?

The origin application does not take the snapshot every 0.1 seconds,
and it still hanged. Only when I tried to isolate the problem, I
increased the frequency of the snapshot, to make sure that this is what
causes the database to hang.

Oct 26 '06 #3
Try putting your SQL statement into a file and using a shell script to
execute it. If you can run this without problems, you definitely have an
issue with the Java code interface.

A database snapshot will give you information about agents.

Check the APAR list from the most recent fixpack and look through it for
issues like yours. I believe that each fixpack's APAR list includes the
APARs repaired in prior fixpacks. If not, you'll need to check prior
fixpack APAR lists.

Make sure that your code does not do something like a connect for each
statement executed without corresponding disconnects.

Again, good luck

Phil Sherman

st*******@gmail.com wrote:
Hi Phil, thanks for your reply.

What kind of environmental data would be relevant ?

I do close the statement after retrieving the data rows. If it is a
memory issue, I cannot see it in "top" or in "vmstat".
Is there any db2 tool that might supply a better diagnostic ?

The origin application does not take the snapshot every 0.1 seconds,
and it still hanged. Only when I tried to isolate the problem, I
increased the frequency of the snapshot, to make sure that this is what
causes the database to hang.
Oct 27 '06 #4
Well, I found some APAR's about snapshots that cause the database to
crash or hang (though neither one of them is about the snapshots that I
take), so I installed FixPak 13 which should contain the fixes for all
of these known bugs, but it still happens.

I attached the client that demonstrates the problem.

public static void main(String[] args) throws InterruptedException {
Connection con = null;
Statement statement = null;
ResultSet rs = null;
try {
Class.forName("com.ibm.db2.jcc.DB2Driver");
con = DriverManager.getConnection("jdbc:db2://server:50000/dbname",
"user", "pasword");

int i = 0;
while (true) {
statement = con.createStatement();
rs = statement
.executeQuery("SELECT * FROM TABLE (SNAPSHOT_LOCK (CAST (NULL AS
CHAR), -1)) AS LOCK_INFO");
if (rs.next()) {
System.out.println(rs.getString(1));
}
Thread.sleep(100);
i++;
rs.close();
rs = null;
statement.close();
statement = null;
}
} catch (SQLException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
} finally {
try {
if (con != null)
con.close();
} catch (SQLException e) {
}
try {
if (statement != null)
statement.close();
} catch (SQLException e) {
}

try {
if (rs != null)
rs.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}

Oct 30 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Jean-Marc Blaise | last post by:
Dear all, It seems there is a problem with some snapshot table functions, if you try to divide by some element that is unset or equal to 0. This generates a trap file with the db2fmp.exe...
14
by: Ina Schmitz | last post by:
Hello, I would like to get the logical and physical reads for every sql statement executed. Thatfore, I used the command "db2 get snapshot for dynamic sql on <mydatabase>". There, I could see...
3
by: Tejas | last post by:
Hi, I have gone through the snapshot API. I need to use it for finding location of database files, tablespace containers etc on a remote machine. These parameters are present in the response....
5
by: Loane Sharp | last post by:
Hi there I've got a hang of a problem ... I'm running the .NET framework (2.0.40903), SQL Server 2000 and SQL Express 2005 on Windows XP Pro on a pretty good and new IBM Thinkpad X41. Some...
3
by: Yves Lange | last post by:
Hello, i'm searching a method to take a snapshot and save it in a jpg, bmp or gif file. I tried with win32api and win32con but it save the snapshot to the clipboard, so i tried to redirect this in...
1
by: shenanwei | last post by:
I have db2 v8.2.5 on AIX V5.3 with all the switches on Buffer pool (DFT_MON_BUFPOOL) = ON Lock (DFT_MON_LOCK) = ON Sort ...
0
by: mike | last post by:
Problem: the snapshot output for dynamic SQL shows some SELECT statements executed many times but all three CPU counters (total/system/user) in the dynamic-sql-snapshot are zero, but most other...
0
by: Arno Stienen | last post by:
Perhaps I should be a bit more specific. When using this code to connect to a remote XML-RPC server (C++, xmlrpc++0.7 library): import xmlrpclib server =...
1
by: malooga | last post by:
Hello, I'm having a problem connecting to DB2 on a remote iSeries host from a Linux server, both of which reside on my company's internal network. I'm using the IBM Linux Client V9.1. When I try...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.