Unix Technical Forum

SQL Server Hanging

This is a discussion on SQL Server Hanging within the SQL Server forums, part of the Microsoft SQL Server category; --> Hi, Periodically I run some very complex queries or stored procedures that "hang", and the bigger problem is that ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-29-2008, 10:10 AM
paulmac106@hotmail.com
 
Posts: n/a
Default SQL Server Hanging

Hi,

Periodically I run some very complex queries or stored procedures that
"hang", and the bigger problem is that it locks up all of the database
clients ie 50 users connecting to the db via a windows application.

I never know when this is going to happen, but when it does it leaves
all the users completely hung up.

1. Can I avoid this?
2. Is there a way to "clear" what I was doing so that I don't have to
restart the SQL Server serive?

thanks,

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-29-2008, 10:10 AM
SQL
 
Posts: n/a
Default Re: SQL Server Hanging

Yes you can clear it
run spWho2 find your login and spID
run DBCC INPUTBUFFER (spID) to verify that it is the correct SQL
statement (if you have multiple sessions open)
run the following command KILL spID
The spID will be greater than 50, everything below 50 is used by SQL
Server

http://sqlservercode.blogspot.com/

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-29-2008, 10:10 AM
Simon Hayes
 
Posts: n/a
Default Re: SQL Server Hanging

paulmac106@hotmail.com wrote:
> Hi,
>
> Periodically I run some very complex queries or stored procedures that
> "hang", and the bigger problem is that it locks up all of the database
> clients ie 50 users connecting to the db via a windows application.
>
> I never know when this is going to happen, but when it does it leaves
> all the users completely hung up.
>
> 1. Can I avoid this?
> 2. Is there a way to "clear" what I was doing so that I don't have to
> restart the SQL Server serive?
>
> thanks,
>


What does 'hang' mean, exactly? You can use sp_who2 to see if one client
process is blocked by another, and sp_lock can identify what objects are
being locked. Erland has a useful tool for investigating locking:

http://www.sommarskog.se/sqlutil/aba_lockinfo.html

You might also check out the MSSQL server log, in case something unusual
shows up there.

As for clearing what you were doing, KILL will terminate a process, but
MSSQL will still have to roll back any open transaction started by that
process, so there might be a delay until things 'unblock' (assuming that
blocking is what's causing your issue in the first place).

Also see the recent thread "Connecting Trace info to blocked users?" in
this newsgroup.

Simon
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-29-2008, 10:11 AM
dbahooker@hotmail.com
 
Posts: n/a
Default Re: SQL Server Hanging

you do have SP3 or SP4 installed right?

i would reccomend using either the NOLOCK query hint on the long
running query.. or the READPAST query hint on the other machines

right?

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-29-2008, 02:30 PM
paulmac106@hotmail.com
 
Posts: n/a
Default Re: SQL Server Hanging

Great, I will definitley give this a try on the next "hang"

thanks!
Paul

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 10:38 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com