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 > lock level in tables

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-11-10, 15:28
georgipa georgipa is offline
Registered User
 
Join Date: Dec 2002
Location: Madrid - Spain
Posts: 282
lock level in tables

Hi Colleagues,

Somebody can tell me how to view the lock level in tables. por example page or row. what in the command to display this information and how to define this lock level in table.


Thank you for you help.
Reply With Quote
  #2 (permalink)  
Old 05-11-10, 16:29
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
The default behavior is to do row level locking. If too many row locks are held DB2 will escalate the locks to a table level lock. The only control you have is to issue "LOCK TABLE" statement--see the manual. Use the snapshot monitor to view the locks currently being held.

Andy
Reply With Quote
  #3 (permalink)  
Old 05-12-10, 03:37
georgipa georgipa is offline
Registered User
 
Join Date: Dec 2002
Location: Madrid - Spain
Posts: 282
Hi ARWinner, thank you for you quick answer. I am DBA Informix and some activities DB2. at informix when create a table exist the statement lock mode (page or row) then you can modify this lock level if you it prefers. also you can view the lock level for any table in specific.

Greetings.
Reply With Quote
  #4 (permalink)  
Old 05-12-10, 08:27
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Well this is not Informix. This is DB2. It works the way I stated.

Andy
Reply With Quote
  #5 (permalink)  
Old 05-13-10, 02:45
stiruvee stiruvee is offline
Registered User
 
Join Date: May 2010
Location: India
Posts: 34
Hi,

You can use locksize column in syscat.tables to view current lock size for the table.


To change lock size use alter table command

example:
alter table <table name> locksize TABLE
alter table <table name> locksize Row


Satya
Reply With Quote
  #6 (permalink)  
Old 05-13-10, 08:03
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Quote:
Originally Posted by stiruvee View Post
Hi,

You can use locksize column in syscat.tables to view current lock size for the table.


To change lock size use alter table command

example:
alter table <table name> locksize TABLE
alter table <table name> locksize Row


Satya
Well, I learned something new today.

Andy
Reply With Quote
  #7 (permalink)  
Old 05-20-10, 06:11
georgipa georgipa is offline
Registered User
 
Join Date: Dec 2002
Location: Madrid - Spain
Posts: 282
Hi All,

In my database there are a table lock in lock mode Z, ¿Anybody can tell me an procedure for detect what process or application is locking this table in DB2?

The version DB2 is the 9.5 and the system operation is Linux Suse 11.

thank you for you help.
Reply With Quote
  #8 (permalink)  
Old 05-20-10, 08:00
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Sure

Code:
select a.* 
from sysibmadm.snaplock as l 
inner join sysibm.snapappl_info as a on (l.agent_id = a.agent_id) 
where l.tabschema = MyTableSchema and l.tabname = MyTableName and 
l.lock_mode = 'Z'
Andy

Last edited by ARWinner; 05-20-10 at 10:21.
Reply With Quote
  #9 (permalink)  
Old 05-20-10, 10:17
georgipa georgipa is offline
Registered User
 
Join Date: Dec 2002
Location: Madrid - Spain
Posts: 282
Thank you for you quick answer, ¿in db2 exist an sequence of command for monitoring lock en tables? and any method for look the statement is executing in database?, what applications is generating the locks and what user?

Greetings.
Reply With Quote
  #10 (permalink)  
Old 05-20-10, 10:22
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
You can use the snapshot monitor or the administrative views (AS I gave you an inkling already). Look in the manual for more information.

Andy
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