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 > Isolation Level

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-28-04, 07:04
BrianFineos BrianFineos is offline
Registered User
 
Join Date: Jan 2004
Posts: 18
Question Isolation Level

First off: I am relatively new to DB2, having worked on Oracle for 10 years.

Second: I have looked around the forums, etc for an answer!

Quite simply, how can you check what the current ISOLATION LEVEL is on your database?

I know you can change it using AUTOCONFIG, but how can you check what it is before you change it?

From what I have read, this seems to be somewhat of an enigma.

I am using DB2 UDB 8.1 EEE on NT.

Cheers,

Brian.

Brian-dot-Murray-at-FINEOS-dot-com
Reply With Quote
  #2 (permalink)  
Old 01-28-04, 07:33
nitingm nitingm is offline
Registered User
 
Join Date: Jul 2003
Location: Austin, TX, USA
Posts: 278
Nope

Hi Brian

Unfortunately there is no way by which you can see the isolation level set at the database level.

There has been many a discussion on the mentioned topic and you can refer those threads for a better clarity.

Cheers

Nitin
__________________
HTH

Nitin

Ask the experienced rather than the learned
Reply With Quote
  #3 (permalink)  
Old 01-28-04, 10:03
dbamota dbamota is offline
Registered User
 
Join Date: Sep 2003
Posts: 237
What about db2set DB2_RR_TO_RS=YES ? Does it not set Isolation level to RS at Instance level? There are so many places, you can override defaults e.g at general SQL level or individual SQL level. If you are using an application package, package should recommend the settings.
__________________
mota
Reply With Quote
  #4 (permalink)  
Old 01-28-04, 14:04
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
Here is some information that I previously posted about isolation level. You might be able to see the default isolation level, but that is no guarantee that a particular isolation level was used for a given SQL statement:

With Static SQL (programs with embedded SQL that get pre-compiled, compiled and the bound), the isolation level is an option on the pre-compile and bind commands.

For Dynamic SQL, there is a default isolation level set for the database by the Create Database command. It can be changed with the AUTOCONFIGURE command (either during or after database creation). The default is RR unless it has been changed. Not sure how to see what it is (maybe a registry value). This affects ODBC and CLI interfaces to DB2.

For a particular dynamic interface process into DB2, the isolation level can be changed dynamically with the CHANGE ISOLATION LEVEL command. This does not affect other process, but will apply to every connection made from the same command line processor back-end process.

For JDBC and SQLJ the CLI interface default is used, but can be changed with the setTransactionIsolation method in the java.sql interface connection. In SQLJ, you run the db2profc SQLJ optimizer to create a package. The options that you can specify for this package include its isolation level.

You can also override the isolation level with an SQL statement (at least certain statements) using the WITH clause (WITH UR, for example). This is valid on SELECT, SELECT INTO, Searched DELETE, INSERT, Searched UPDATE, and DECLARE CURSOR, SQL statements.
__________________
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
  #5 (permalink)  
Old 01-29-04, 05:44
BrianFineos BrianFineos is offline
Registered User
 
Join Date: Jan 2004
Posts: 18
Thanks for your help guys. I had read your earlier post Marcus (reproduced above) - good info.
Reply With Quote
  #6 (permalink)  
Old 01-29-04, 13:50
cchattoraj cchattoraj is offline
Registered User
 
Join Date: Mar 2003
Posts: 343
How does one set the default isolation level on the db2 client? I tried looking under client settings but couldn't find a place for it.
Reply With Quote
  #7 (permalink)  
Old 01-29-04, 14:12
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
db2cli.ini file can be used to configure the default isolation level for a connection ...

If none is specified, the default is CS

Cheers
Sathyaram
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #8 (permalink)  
Old 11-19-04, 00:05
meehange meehange is offline
Registered User
 
Join Date: Jul 2004
Posts: 256
If I have used the autoconfigure using isolation CS apply db and db command (is this even correct?) to set the isolation level, what other steps do I need to take?
For example do I need to do a db2rbind all?
Reply With Quote
  #9 (permalink)  
Old 11-19-04, 00:57
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
I believe that the isolation level specified (you specify the isolation level typically used by your clients) in the autoconfigure command is used to configure some of the other database parameters, but does not change the default isolation level of the server.

See the above posts to determine how to set the isolation level of your clients (or individual SQL statements).
__________________
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
  #10 (permalink)  
Old 11-21-04, 17:35
meehange meehange is offline
Registered User
 
Join Date: Jul 2004
Posts: 256
Basically I want to set the isolation level for all database operations (or as many as possible). It's the usual case of the developers think the problem is at DB end and I'm pretty sure it's at the developer end but want to be sure I've covered all possibly bases from mine.
Reply With Quote
  #11 (permalink)  
Old 11-22-04, 03:28
Romeo Romeo is offline
Registered User
 
Join Date: Feb 2002
Location: Philippines
Posts: 41
everything about the isolation level is discussed in the Administration Guide - Performance (db2d3e81.pdf) redbook... download a copy from the IBM website
__________________
There are 10 kinds of people,
those who know binary and those who don't.

http://www.linkedin.com/in/rtitong
Reply With Quote
  #12 (permalink)  
Old 11-24-04, 21:31
meehange meehange is offline
Registered User
 
Join Date: Jul 2004
Posts: 256
I have read through this, I have set everything I can think of but when the application attempts an insert or update on a table it obtains a table level IX lock as well as a row lock.
Are there Java client issues here anyone might be aware of?
Reply With Quote
  #13 (permalink)  
Old 11-25-04, 02:06
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
I am not exactly sure why you think there is a problem, but it would help to see the exact SQL statements in question and what problems you are encountering.

The locking can depend on whether DB2 had to do a tablespace scan, or a scan of the entire index (as opposed to a b-tree scan) to find the qualifying rows, or whether an index was used with b-tree access. Any access path other than using the b-tree of the index can cause addtional locking.

If you are still using DB2 V7, you should set the registery variable for RR_TO_RS (this is probably not the exact name of the variable to avoid next key locking problems. Type 2 indexes in Version 8 solve that problem.

Make sure you know whether you java apps are using any of the following J2EE isolation level commands:

Serializable - Repeatable Read (RR) in DB2

Repeatable Reads - Read stability (RS) in DB2

Read committed - Cursor stability (CS) in DB2

Read uncommitted - Uncommitted read (UR) in DB2
__________________
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
  #14 (permalink)  
Old 02-12-05, 15:20
jfkuser jfkuser is offline
Registered User
 
Join Date: Mar 2003
Posts: 59
Hi all,

I went thru this thread and sathya says default is CS and Marcus says its RR. I also found such conflicting documetation at IBM site and books.

Can anyone confirm what the real default isolation level is? I have opened another thread for this discussion for JDBC specific discussion.

thanks,
j
Reply With Quote
  #15 (permalink)  
Old 02-12-05, 17:16
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
As I mentioned in the other thread:

"I was probably incorrect when I said awhile back that the default is RR. I believe that at one time it was the default (I have been using DB2 LUW since 1989 when it was called OS/2 Database Manager). But I think that CS is the default now. But it is confusing, espcially with the link you provided regarding the default = RR for AUTOCONFIGURE.
__________________
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
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