SQL Server, Why doesn't my update come to an end? a light post!

Hi guys,

Today i present to you a light post at base level but however very useful!

There are questions that come back often.
For example:

Why doesn't my update come to an end?
Why I am not be able to drop an index?
The answer is always the same: Something is blocking!

Enjoy the reading!

Find who is locking!

Have you an update that doesn't come to an end?
Are you trying to drop and index but is not possible?
Well, your T-SQL statement is blocked by another T-SQL statement.

In this case you can run this command:


Sp_who2
 

This command display a list of processes (called SPID).

From this list you can identify your process through the command column.



In our example we are the SPID 106 and we are executing a DROP INDEX command.

Now look at the blkBy (blocked by)) columns.
A value in this column is the process id (SPID) of the command that is blocking.

So now we konow that is the SPID 90 that is blocking our drop index command.

If you kill it though the Kill command


Kill 90            
     

Your command will come to and end.


That's all for today people!
See you soo and feel free to ask me any questions or problems you have!

Luca Biondi @ SQLServerPerformance blog!



 

 

 

 

 

Next Post: SQL Server, How to find deadlocks: the easy way DBCC TRACEON (1204, 1222,-1)

Previuos post: Your biggest customer can’t work! It is stuck due to a SQL Server randomly crash? And now?

A song with the mood of the day: Here we go

Comments

Post a Comment

I Post più popolari

SQL Server, execution plan and the lazy spool (clearly explained)

SQL Server, datetime vs. datetime2

La clausola NOLOCK. Approfondiamo e facciamo chiarezza!