Sunday, February 19, 2012

DB Lock

What causes DB Locks to occur? We are running a store procedures that is
producing resulting an a database lock. It is just selecting data.
EM - Current Activity or sp_lock. I get it when making a connection to the
database and running some code.
HTH
Jerry
"newie" <newie@.discussions.microsoft.com> wrote in message
news:384BBAB4-B47A-4165-8A88-E4AB389EF5C0@.microsoft.com...
> What causes DB Locks to occur? We are running a store procedures that is
> producing resulting an a database lock. It is just selecting data.
|||As soon as you have a connection in a database, you have a database log for that connection in the
database. The only thing that this blocks are things like RESTORE, DROP DATABASE etc.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"newie" <newie@.discussions.microsoft.com> wrote in message
news:384BBAB4-B47A-4165-8A88-E4AB389EF5C0@.microsoft.com...
> What causes DB Locks to occur? We are running a store procedures that is
> producing resulting an a database lock. It is just selecting data.
|||Hi
What type of lock?
All connections to a DB always take a shared lock on the DB to ensure that
nobody deletes it whilst connected. This has no performance impact.
Regards
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"newie" <newie@.discussions.microsoft.com> wrote in message
news:384BBAB4-B47A-4165-8A88-E4AB389EF5C0@.microsoft.com...
> What causes DB Locks to occur? We are running a store procedures that is
> producing resulting an a database lock. It is just selecting data.
|||Locking is a mechanism that ensures ACID (Atomicity, Consistency, Isolation,
and Durability)
If I am updating a table The DB locks this so that you will not read the
value in case the update fails for example (this is just one example)
Lookup locking, architecture and locking in BOL
http://sqlservercode.blogspot.com/
"newie" wrote:

> What causes DB Locks to occur? We are running a store procedures that is
> producing resulting an a database lock. It is just selecting data.

No comments:

Post a Comment