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 > Sybase > Locks issue.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-17-11, 06:29
krish_princi krish_princi is offline
Registered User
 
Join Date: Aug 2011
Posts: 5
Exclamation Locks issue.

I have an interesting question to all friends over here.
How can we automatically capture the sqltext information by writing a stored procedue or by doing anything which captures the sqltext information of any spid which crosses a certain threshold of the number of locks? (In this case, let us assume the total locks configured is 500000 and threshold for reference is 200000)

As the error log doesn't contain the information about the sqltext of the queries which holds maximum number of locks, we wouldn't come to know which query crossed the threshold and things like that. Requesting memebers to help.


*****Failed Methods********
1. I tried to quey the syslocks table by using,
declare @lockvar
select @lockvar = spid, count(*) from master..syslocks group by spid having count(*) > 200000
dbcc traceon(3604)
dbcc sqltext(@lockvar)

Error : This says that the variable used in a select statement should not be used for retrieving value.

2. Storing the details in a temp table and accessing it.
This shows some weird syntax error.


Responses will greatly be appreciated. Thanks in advance.
Reply With Quote
  #2 (permalink)  
Old 09-01-11, 15:33
pdreyer pdreyer is offline
Registered User
 
Join Date: May 2005
Location: South Africa
Posts: 1,268
"select @lockvar = spid, count(*)"
1) Your error is: you are assigning spid to variable @lockvar and then also select count(*)
Use
select @lockvar = spid, @cnt=count(*)

2) Can't see your weird syntax error from here
Reply With Quote
Reply

Tags
locks issue, sybase ase 15

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