tags:

views:

524

answers:

2

I have a vendor reporting product executing queries to pull report data, no inserts, no updates just reading data.

We have double our heap size 3 times and are now at 1024 4k pages, The app will run fine for a week then we will begin to see DB2 SQL error: SQLCODE: -954, SQLSTATE: 57011 indicating the transaction log is not able to accomodate the request.

Its not the size of the reports since they run fine after a recycle. I spoke with another DBA on this. He believe the problem was in a difference between ORACLE and DB2 in that the vendor code is crappy and not issuing commits on the selects. This is causing the references to not be cleaned up and is slowly accumulating as garbage in the heap.

I wanted to know if this is accurate as I thought only inserts and updates needed to have commits included. Is there any IBM documentation on this?

We are currently recycling on a weekly basis to alleviate the problem but I would like to have a good handle on the issue before going back to the vendor asking them to alter their code.

+4  A: 

Any transaction needs to be properly terminated -- why did you think that only applies to inserts and updates? Consider running transactionally a "select a from b where c > 12" and then "select a from b where c <= 12"; within a transaction the DB has to guarantee that every a gets returned exactly once either from the first or second select, not both (assuming c is never null;-). Without transactionality, some a's might fall between the cracks or be returned twice if their corresponding c was changed by a different transaction, and that's just not ACID!-)

So when you do not need separate SELECT queries to be transactional wrt each other, tell the DB! And the way you tell, is by terminating the transaction after each select (normally commit is what you use for the purpose, though I guess you could, indifferently, choose to use rollback here;-).

Alex Martelli
thanks alex, Not a DBA myself hence the thinking only inserts/updates needed commits. Thanks for the detailed example this is alot easier to see now.
Knife-Action-Jesus
Doesn't this imply that the selects are run within a transaction? If they're not (and of course, that depends a lot on things that weren't specified), then this doesn't apply.
Harper Shelby
@Harper, yes, every DB2 query (as per general DB theory) runs transactionally (you may set a mode where each transaction is auto-committed after each query, but choosing explicit termination has advantages).
Alex Martelli
+2  A: 

Per Alex's response, the first SQL activity after any CONNECT, COMMIT, or ROLLBACK initiates a transaction.

To get a handle on your resource issue (transaction logs full), you should investigate your application that issues the reports - ensure that transactions are being closed out explicitly in code. I've seen cases where application developers rely upon the Garbage Collector to clean up database objects - while those objects are waiting for cleanup, the database resources (transactions) are held open.

It's always good practice to explicitly COMMIT or ROLLBACK your transactions as soon as you are done with the data - regardless of the programming methodology you use.

Michael Hvizdos
This was the DBA's assumption without seeing any of the code, just by my description of the symptoms we are seeing. After speaking with the vendor they questioned why you would need to issue a commit on a straight select. Which is what prompted me to come here and ask the experts :). I believe their application was originally written for Oracle and not DB2. Apparantly oracle handles poor coding a little more gracefully.
Knife-Action-Jesus