Solved

correct this blockage?

Posted on 2010-08-15
10
282 Views
Last Modified: 2012-05-10
and how I can correct this blockage?
0
Comment
Question by:enrique_aeo
10 Comments
 
LVL 4

Expert Comment

by:mingano
ID: 33443415
Which blockage?
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 33443493
I presume you wanted refer to this previous question?
http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SQL_Server_2008/Q_26402112.html

however, I don't see a "blockage" ?...
please clarify
0
 
LVL 13

Expert Comment

by:dwkor
ID: 33445477
Locking and blocking are always present in SQL. In most part of the cases it happens because of non-optimized queries and blocking due table/index scans. So in the long run the best option you have is analyze and optimize the queries.

Meanwhile, you can minimize blocking with either read uncommitted mode (or WITH (NOLOCK) hints in selects) - in such case readers are not obtaining shared locks or switching database to read committed snapshot mode (optimistic locking). Again, this is more or less temporary solution - in the long run you need to optimize the queries.
0
 

Author Comment

by:enrique_aeo
ID: 33447078
how I can fix a database lock?
0
 
LVL 13

Expert Comment

by:dwkor
ID: 33447171
What exactly do you mean by "database lock"?
0
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 

Author Comment

by:enrique_aeo
ID: 33447237
I made following test
--first session: la actualizacion debe actualizar registros
begin tran
  update HumanResources.Employee
  set fechaRegistro = '01/01/2010'

--second session:
select * from HumanResources.Employee

run in query block to see (attached file)
What I want to know is how to kill the Process that is blocking the database
resultPROCEDIMIENTO.JPG
0
 
LVL 13

Expert Comment

by:dwkor
ID: 33447242
I did the presentation on SQL Saturday #40 related with locking and blocking. You can download it from there: http://aboutsqlserver.com/sql-saturday-40-presentations/

It should give you some ideas why locking occurs and what could be done in order to minimize them.
0
 
LVL 13

Expert Comment

by:dwkor
ID: 33447261
As for your latest question - commit or rollback original transaction.
0
 

Author Comment

by:enrique_aeo
ID: 33447308
What I try to do is a demonstration, so the code is fine, the next step is to kill the lock (this is my question)
0
 
LVL 13

Accepted Solution

by:
dwkor earned 125 total points
ID: 33447337
KILL <SPID>

or commit/rollback transaction in the session 1
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now