Solved

correct this blockage?

Posted on 2010-08-15
10
280 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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

INTRODUCTION: While tying your database objects into builds and your enterprise source control system takes a third-party product (like Visual Studio Database Edition or Red-Gate's SQL Source Control), you can achieve some protection using a sing…
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
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, fr…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

747 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

12 Experts available now in Live!

Get 1:1 Help Now