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 > How can I find table access isolation level in SP ?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-12-10, 21:31
DBFinder DBFinder is offline
Registered User
 
Join Date: Sep 2008
Location: Toronto,Canada
Posts: 606
How can I find table access isolation level in SP ?

Hi,

DB2 V9.5.5 on Win 2003

Other than command line explain, how can I see the select statement's table access isolation level ?

I was able to use command line, still have a doubt.

Here is the story.

My developers want to execute all selects at UR level in an SP, default being CS.

Just for example

Code:
CREATE PROCEDURE TESTSP()
LANGUAGE SQL
BEGIN
   SET ISOLATION UR;
   insert into testsp SELECT CTIME FROM tests;
   SET ISOLATION RESET;
END
@
I want to see table access isolation level in tabscan in SELECT CTIME FROM tests statement.

Can some one help me with idea to test this. Using visual explain and/or IBM Data Studio.

I had used visual explain some times but do not know where the table access level could be found.

Thanks

DBFinder

Last edited by DBFinder; 07-12-10 at 21:39.
Reply With Quote
  #2 (permalink)  
Old 07-13-10, 08:23
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
You can use db2expln to show you this. But you need to know the package name that is generated when your Stored Procedure is created. This is in the catalog. You will need something like this:

Code:
select r.routineschema,r.routinename,r.specificname,rd.bname,r.text,p.last_bind_time,p.valid,r.fenced,r.language from syscat.routines as r inner join syscat.routinedep as rd on (r.routineschema = rd.routineschema and r.specificname = rd.routinename) inner join syscat.packages as p on (rd.bschema = p.pkgschema and rd.bname = p.pkgname) where r.routineschema = ? and r.routinetype = 'P' and r.language = 'SQL' and rd.btype = 'K' order by r.routinename
And then do this:

Code:
db2expln -d MyDB  -u MyUser MyPassword -c MySchema -p MyPackageName -g -t
Andy
Reply With Quote
  #3 (permalink)  
Old 07-13-10, 08:27
DBFinder DBFinder is offline
Registered User
 
Join Date: Sep 2008
Location: Toronto,Canada
Posts: 606
Great, Thanks.
Reply With Quote
  #4 (permalink)  
Old 07-13-10, 08:40
DBFinder DBFinder is offline
Registered User
 
Join Date: Sep 2008
Location: Toronto,Canada
Posts: 606
Is it true that SET ISOLATION does not work inside an SP.

Quote:
CREATE PROCEDURE TESTSP()
LANGUAGE SQL
BEGIN
SET ISOLATION UR;
insert into testsp SELECT CTIME FROM tests;
SET ISOLATION RESET;
END
@
Regards

DBFinder
Reply With Quote
  #5 (permalink)  
Old 07-13-10, 10:19
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
The documentation says that you can use them, but I think I might have tried it a few years ago and it did not work. You can use the preopts to set the isolation level when you create the SP.

Andy
Reply With Quote
  #6 (permalink)  
Old 07-13-10, 10:20
DBFinder DBFinder is offline
Registered User
 
Join Date: Sep 2008
Location: Toronto,Canada
Posts: 606
Got it.

Regards
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