Sunday, February 19, 2012

DB Locks

I'm getting Db locks when inserting into a simple table. The locks are
showing as follows :
Locktype : DB
Mode : NULL
Owner : Xact
Resource : [bulk-op-db]
Can anyone shed any light on what the resource [bulk-op-db] is and why it is
causing a db lock?
Thanks.
What type of lock is it, Shared etc? Are you sure it is the result of the
insert operation you are doing and not something else? What is the insert
statement your using?
Andrew J. Kelly SQL MVP
"John" <jhughesy@.msn.com> wrote in message
news:uDEXeE$GEHA.2408@.TK2MSFTNGP10.phx.gbl...
> I'm getting Db locks when inserting into a simple table. The locks are
> showing as follows :
> Locktype : DB
> Mode : NULL
> Owner : Xact
> Resource : [bulk-op-db]
> Can anyone shed any light on what the resource [bulk-op-db] is and why it
is
> causing a db lock?
> Thanks.
>
|||The type of lock is NULL.
The insert statement :
CREATE procedure ip_Interaction
@.NewID uniqueidentifier,
@.TypeID int,
@.StatusID int,
@.CategoryID int,
@.Subject varchar(200),
@.PurseID bigint = null,
@.TicketID uniqueidentifier = null,
@.Body text = null,
@.Parameters text = null,
@.FromAddress varchar(100) = null,
@.ToAddress varchar(100) = null,
@.ProcessDate datetime = null,
@.AccessCode int = 0
as
begin
set nocount on
insert into Interaction
(
InteractionID,
InteractionTypeID,
InteractionStatusID,
InteractionCategoryID,
Subject,
PurseID,
TicketID,
Body,
Parameters,
FromAddress,
ToAddress,
ProcessDate,
AccessCode
)
values (
@.NewID,
@.TypeID,
@.StatusID,
@.CategoryID,
@.Subject,
@.PurseID,
@.TicketID,
@.Body,
@.Parameters,
@.FromAddress,
@.ToAddress,
@.ProcessDate,
@.AccessCode
)
return @.@.rowcount
"Andrew J. Kelly" <sqlmvpnoooospam@.shadhawk.com> wrote in message
news:#6OIRBDHEHA.3276@.TK2MSFTNGP09.phx.gbl...
> What type of lock is it, Shared etc? Are you sure it is the result of the
> insert operation you are doing and not something else? What is the insert
> statement your using?
> --
> Andrew J. Kelly SQL MVP
>
> "John" <jhughesy@.msn.com> wrote in message
> news:uDEXeE$GEHA.2408@.TK2MSFTNGP10.phx.gbl...
it
> is
>
|||What are you using to determine the locks being held? Do you have a valid
PK on the table being inserted into and is this a heap?
Andrew J. Kelly SQL MVP
"John" <jhughesy@.msn.com> wrote in message
news:umlBIKMHEHA.3836@.tk2msftngp13.phx.gbl...
> The type of lock is NULL.
> The insert statement :
> CREATE procedure ip_Interaction
> @.NewID uniqueidentifier,
> @.TypeID int,
> @.StatusID int,
> @.CategoryID int,
> @.Subject varchar(200),
> @.PurseID bigint = null,
> @.TicketID uniqueidentifier = null,
> @.Body text = null,
> @.Parameters text = null,
> @.FromAddress varchar(100) = null,
> @.ToAddress varchar(100) = null,
> @.ProcessDate datetime = null,
> @.AccessCode int = 0
> as
> begin
> set nocount on
>
> insert into Interaction
> (
> InteractionID,
> InteractionTypeID,
> InteractionStatusID,
> InteractionCategoryID,
> Subject,
> PurseID,
> TicketID,
> Body,
> Parameters,
> FromAddress,
> ToAddress,
> ProcessDate,
> AccessCode
> )
> values (
> @.NewID,
> @.TypeID,
> @.StatusID,
> @.CategoryID,
> @.Subject,
> @.PurseID,
> @.TicketID,
> @.Body,
> @.Parameters,
> @.FromAddress,
> @.ToAddress,
> @.ProcessDate,
> @.AccessCode
> )
>
> return @.@.rowcount
> "Andrew J. Kelly" <sqlmvpnoooospam@.shadhawk.com> wrote in message
> news:#6OIRBDHEHA.3276@.TK2MSFTNGP09.phx.gbl...
the
insert
> it
>
|||I'm using the current activity list in the Enterprise
Manager.
I have a primary key field non clustered which is
InteractionID. The table has a clustered index on
InteractionDate which is defaulted to getdate().

>--Original Message--
>What are you using to determine the locks being held?
Do you have a valid
>PK on the table being inserted into and is this a heap?
>--
>Andrew J. Kelly SQL MVP
>
>"John" <jhughesy@.msn.com> wrote in message
>news:umlBIKMHEHA.3836@.tk2msftngp13.phx.gbl...
in message
it is the result of
>the
else? What is the
>insert
table. The locks are
[bulk-op-db] is and why
>
>.
>
|||Try using sp_lock instead and see what that says. Without the sp wrapped in
a transaction it will be tough to get an accurate sample with EM on a single
insert. Make sure your looking at the right SPID.
Andrew J. Kelly SQL MVP
"John" <anonymous@.discussions.microsoft.com> wrote in message
news:19e4401c41d3d$7f489410$a401280a@.phx.gbl...
> I'm using the current activity list in the Enterprise
> Manager.
> I have a primary key field non clustered which is
> InteractionID. The table has a clustered index on
> InteractionDate which is defaulted to getdate().
>
>
> Do you have a valid
> in message
> it is the result of
> else? What is the
> table. The locks are
> [bulk-op-db] is and why

No comments:

Post a Comment