我有一个僵局:
<deadlock-list>
<deadlock victim="process296f390">
<process-list>
<process id="process296f390" taskpriority="0" logused="6540" waitresource="OBJECT: 10:1797581442:0 " waittime="7542" ownerId="1123440" transactionname="user_transaction" lasttranstarted="2016-01-13T13:26:58.650" XDES="0x211bdb30" lockMode="IS" schedulerid="2" kpid="3920" status="suspended" spid="66" sbid="2" ecid="0" priority="0" trancount="1" lastbatchstarted="2016-01-13T13:26:58.960" lastbatchcompleted="2016-01-13T13:26:58.960" lastattention="2016-01-13T13:26:34.623" clientapp="Ciel V7" hostname="GEORGEL" hostpid="10516" loginname="sa" isolationlevel="read committed (2)" xactid="1123440" currentdb="10" lockTimeout="4294967295" clientoption1="671088672" clientoption2="128056">
<executionStack>
<frame procname="adhoc" line="1" sqlhandle="0x020000004dda5901ca432e225cfc8d822e286c487bd004ce">
SELECT TOP (1)
[Extent1].[Id] AS [Id],
[Extent1].[StartDate] AS [StartDate],
[Extent1].[EndDate] AS [EndDate],
[Extent1].[IsClosed] AS [IsClosed],
[Extent1].[WarehouseId] AS [WarehouseId],
[Extent1].[ParentId] AS [ParentId],
[Extent1].[DischargeMethodId] AS [DischargeMethodId],
[Extent1].[RunDischargePerDocument] AS [RunDischargePerDocument]
FROM [dbo].[Periods] AS [Extent1]
WHERE ([Extent1].[ParentId] IS NULL) AND ([Extent1].[IsClosed] = 1)
ORDER BY [Extent1].[EndDate] DESC </frame>
</executionStack>
<inputbuf>
SELECT TOP (1)
[Extent1].[Id] AS [Id],
[Extent1].[StartDate] AS [StartDate],
[Extent1].[EndDate] AS [EndDate],
[Extent1].[IsClosed] AS [IsClosed],
[Extent1].[WarehouseId] AS [WarehouseId],
[Extent1].[ParentId] AS [ParentId],
[Extent1].[DischargeMethodId] AS [DischargeMethodId],
[Extent1].[RunDischargePerDocument] AS [RunDischargePerDocument]
FROM [dbo].[Periods] AS [Extent1]
WHERE ([Extent1].[ParentId] IS NULL) AND ([Extent1].[IsClosed] = 1)
ORDER BY [Extent1].[EndDate] DESC </inputbuf>
</process>
<process id="process296f558" taskpriority="0" logused="15780" waitresource="KEY: 10:72057594054377472 (e600db96a62a)" waittime="7482" ownerId="1123280" transactionname="user_transaction" lasttranstarted="2016-01-13T13:26:58.447" XDES="0x155c39f8" lockMode="S" schedulerid="2" kpid="5316" status="suspended" spid="73" sbid="2" ecid="0" priority="0" trancount="1" lastbatchstarted="2016-01-13T13:26:59.023" lastbatchcompleted="2016-01-13T13:26:59.007" clientapp="Ciel V7" hostname="TEST" hostpid="1812" loginname="sa" isolationlevel="read committed (2)" xactid="1123280" currentdb="10" lockTimeout="4294967295" clientoption1="671088672" clientoption2="128056">
<executionStack>
<frame procname="adhoc" line="1" stmtstart="140" sqlhandle="0x02000000348bd118f2d3eef1c2e464e6f2a2e3c731e41862">
SELECT TOP (1)
[Project1].[Id] AS [Id],
[Project1].[Date] AS [Date],
[Project1].[Series] AS [Series],
[Project1].[NrDoc] AS [NrDoc]
FROM ( SELECT
[Extent1].[Id] AS [Id],
[Extent1].[ValidationId] AS [ValidationId],
[Extent1].[NrDoc] AS [NrDoc],
[Extent1].[Date] AS [Date],
[Extent1].[Series] AS [Series]
FROM [dbo].[Documents] AS [Extent1]
WHERE ((DATEDIFF(day, [Extent1].[Date], @p__linq__0)) <= 0) AND ([Extent1].[LookupTypeId] = @p__linq__1) AND ([Extent1].[LookupStatusId] = @p__linq__2) AND ( NOT (([Extent1].[SourceTypeId] = @p__linq__3) AND ((CASE WHEN ([Extent1].[SourceTypeId] IS NULL) THEN cast(1 as bit) ELSE cast(0 as bit) END) = 0)))
) AS [Project1]
ORDER BY [Project1].[Date] DESC, [Project1].[ValidationId] DESC </frame>
<frame procname="unknown" line="1" sqlhandle="0x000000000000000000000000000000000000000000000000">
unknown </frame>
</executionStack>
<inputbuf>
(@p__linq__0 datetime,@p__linq__1 int,@p__linq__2 int,@p__linq__3 int)SELECT TOP (1)
[Project1].[Id] AS [Id],
[Project1].[Date] AS [Date],
[Project1].[Series] AS [Series],
[Project1].[NrDoc] AS [NrDoc]
FROM ( SELECT
[Extent1].[Id] AS [Id],
[Extent1].[ValidationId] AS [ValidationId],
[Extent1].[NrDoc] AS [NrDoc],
[Extent1].[Date] AS [Date],
[Extent1].[Series] AS [Series]
FROM [dbo].[Documents] AS [Extent1]
WHERE ((DATEDIFF(day, [Extent1].[Date], @p__linq__0)) <= 0) AND ([Extent1].[LookupTypeId] = @p__linq__1) AND ([Extent1].[LookupStatusId] = @p__linq__2) AND ( NOT (([Extent1].[SourceTypeId] = @p__linq__3) AND ((CASE WHEN ([Extent1].[SourceTypeId] IS NULL) THEN cast(1 as bit) ELSE cast(0 as bit) END) = 0)))
) AS [Project1]
ORDER BY [Project1].[Date] DESC, [Project1].[ValidationId] DESC </inputbuf>
</process>
</process-list>
<resource-list>
<objectlock lockPartition="0" objid="1797581442" subresource="FULL" dbid="10" objectname="CielStd_a1.dbo.Periods" id="lock30da0c80" mode="X" associatedObjectId="1797581442">
<owner-list>
<owner id="process296f558" mode="X"/>
</owner-list>
<waiter-list>
<waiter id="process296f390" mode="IS" requestType="wait"/>
</waiter-list>
</objectlock>
<keylock hobtid="72057594054377472" dbid="10" objectname="CielStd_a1.dbo.Documents" indexname="PK_Document" id="lock25c94700" mode="X" associatedObjectId="72057594054377472">
<owner-list>
<owner id="process296f390" mode="X"/>
</owner-list>
<waiter-list>
<waiter id="process296f558" mode="S" requestType="wait"/>
</waiter-list>
</keylock>
</resource-list>
</deadlock>
</deadlock-list>
表格定义:
CREATE TABLE [dbo].[Periods](
[Id] [int] IDENTITY(1,1) NOT NULL,
[StartDate] [int] NOT NULL,
[EndDate] [int] NOT NULL,
[IsClosed] [bit] NOT NULL,
[WarehouseId] [int] NULL,
[ParentId] [int] NULL,
[DischargeMethodId] [int] NULL,
[RunDischargePerDocument] [int] NULL,
CONSTRAINT [PK_Periods] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Periods] ADD CONSTRAINT [DF_Periods_IsClosed] DEFAULT ((1)) FOR [IsClosed]
GO
和
CREATE TABLE [dbo].[Documents](
[Id] [int] IDENTITY(1,1) NOT NULL,
[ValidationId] [int] NULL,
[PartnerId] [int] NULL,
[LookupStatusId] [int] NOT NULL,
[LookupTypeId] [int] NOT NULL,
[AppSeriesValueId] [int] NULL,
[AgentId] [int] NULL,
[BankAccountId] [int] NULL,
[Vat] [decimal](28, 6) NULL,
[VatLocalCurrency] [decimal](28, 6) NULL,
[NrDoc] [varchar](50) NULL,
[Date] [datetime] NOT NULL,
[DueDate] [datetime] NOT NULL,
[NetTotalAmount] [decimal](28, 6) NULL,
[NetTotalAmountLocalCurrency] [decimal](28, 6) NULL,
[Series] [varchar](50) NULL,
[WareHouseId] [int] NULL,
[DestinationWareHouseId] [int] NULL,
[Notes] [nvarchar](max) NULL,
[BadDocument] [bit] NOT NULL,
[CreatedBy] [uniqueidentifier] NULL,
[ModifiedBy] [uniqueidentifier] NULL,
[CreatedDate] [datetime] NULL,
[ModifiedDate] [datetime] NULL,
[Version] [timestamp] NULL,
[CurrencyId] [int] NULL,
[ExchangeRate] [decimal](28, 6) NULL,
[ReverseCharge] [bit] NULL,
[Transport] [bit] NULL,
[Total] [decimal](28, 6) NULL,
[TotalLocalCurrency] [decimal](28, 6) NULL,
[KindOfTransport] [nvarchar](300) NULL,
[TakenBy] [uniqueidentifier] NULL,
[TakenAt] [datetime] NULL,
[Discount] [decimal](28, 6) NULL,
[TotalPhysiscalStockValue] [decimal](28, 6) NULL,
[TotalCalculatedStockValue] [decimal](28, 6) NULL,
[TreasuryDocumentTypeId] [int] NULL,
[RemainingValue] [decimal](28, 6) NULL,
[RemainingValueLocalCurrency] [decimal](28, 6) NULL,
[NIRSeries] [nvarchar](max) NULL,
[ImportedDocumentsSeries] [nvarchar](max) NULL,
[ImportedByDocumentsSeries] [nvarchar](max) NULL,
[TreasuryHouseId] [int] NULL,
[RelatedDocumentTypeId] [int] NULL,
[InitialRemainingValue] [decimal](28, 6) NULL,
[TotalInWords] [nvarchar](max) NULL,
[AccountId] [int] NULL,
[TreasuryDocumentAccountId] [int] NULL,
[TotalPaymentWithCard] [decimal](28, 6) NULL,
[TotalPaymentWithTickets] [decimal](28, 6) NULL,
[TotalIn] [decimal](28, 6) NULL,
[TotalOut] [decimal](28, 6) NULL,
[TotalInLocalCurrency] [decimal](28, 6) NULL,
[TotalOutLocalCurrency] [decimal](28, 6) NULL,
[AccountingNoteAutoNumber] [int] NULL,
[BillingRepresentativeId] [int] NULL,
[DelegateId] [int] NULL,
[PartnerDeliveryAddressId] [int] NULL,
[HasStockDifferences] [bit] NOT NULL,
[IsVATCollectableOnPayment] [bit] NOT NULL,
[IsStorno] [bit] NOT NULL,
[IsInitialBalance] [bit] NOT NULL,
[EmployeeId] [int] NULL,
[SourceTypeId] [int] NULL,
[IsLinkedToDistribution] [bit] NOT NULL,
[WorksiteId] [int] NULL,
[TransportAccountingNoteLookupTypeId] [int] NULL,
[PartnerWorksiteId] [int] NULL,
[DocumentSeriesConfigurationId] [int] NULL,
[HasImo] [bit] NOT NULL,
[HasInventoryItem] [bit] NOT NULL,
[BaseExchangeRate] [decimal](28, 6) NULL,
[AdjustmentPercentExchangeRate] [decimal](28, 6) NULL,
[IdLookupDocumentFlowType] [int] NULL,
CONSTRAINT [PK_Document] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
ALTER TABLE [dbo].[Documents] WITH CHECK ADD CONSTRAINT [FK_Documents_AccountingPlans] FOREIGN KEY([AccountId])
REFERENCES [dbo].[AccountingPlans] ([Id])
GO
ALTER TABLE [dbo].[Documents] CHECK CONSTRAINT [FK_Documents_AccountingPlans]
GO
ALTER TABLE [dbo].[Documents] WITH CHECK ADD CONSTRAINT [FK_Documents_Addresses_PartnerDeliveryAddressId] FOREIGN KEY([PartnerDeliveryAddressId])
REFERENCES [dbo].[Addresses] ([Id])
GO
ALTER TABLE [dbo].[Documents] CHECK CONSTRAINT [FK_Documents_Addresses_PartnerDeliveryAddressId]
GO
ALTER TABLE [dbo].[Documents] WITH CHECK ADD CONSTRAINT [FK_Documents_Agents] FOREIGN KEY([AgentId])
REFERENCES [dbo].[Agents] ([Id])
GO
ALTER TABLE [dbo].[Documents] CHECK CONSTRAINT [FK_Documents_Agents]
GO
ALTER TABLE [dbo].[Documents] WITH CHECK ADD CONSTRAINT [FK_Documents_BankAccounts] FOREIGN KEY([BankAccountId])
REFERENCES [dbo].[BankAccounts] ([Id])
GO
ALTER TABLE [dbo].[Documents] CHECK CONSTRAINT [FK_Documents_BankAccounts]
GO
ALTER TABLE [dbo].[Documents] WITH CHECK ADD CONSTRAINT [FK_Documents_BillingRepresentatives] FOREIGN KEY([BillingRepresentativeId])
REFERENCES [dbo].[BillingRepresentatives] ([Id])
GO
ALTER TABLE [dbo].[Documents] CHECK CONSTRAINT [FK_Documents_BillingRepresentatives]
GO
ALTER TABLE [dbo].[Documents] WITH CHECK ADD CONSTRAINT [FK_Documents_ContactPersons] FOREIGN KEY([DelegateId])
REFERENCES [dbo].[ContactPersons] ([Id])
GO
ALTER TABLE [dbo].[Documents] CHECK CONSTRAINT [FK_Documents_ContactPersons]
GO
ALTER TABLE [dbo].[Documents] WITH CHECK ADD CONSTRAINT [FK_Documents_Currencies] FOREIGN KEY([CurrencyId])
REFERENCES [dbo].[Currencies] ([Id])
GO
ALTER TABLE [dbo].[Documents] CHECK CONSTRAINT [FK_Documents_Currencies]
GO
ALTER TABLE [dbo].[Documents] WITH CHECK ADD CONSTRAINT [FK_Documents_DocumentSeriesConfiguration] FOREIGN KEY([DocumentSeriesConfigurationId])
REFERENCES [dbo].[DocumentSeriesConfiguration] ([Id])
GO
ALTER TABLE [dbo].[Documents] CHECK CONSTRAINT [FK_Documents_DocumentSeriesConfiguration]
GO
ALTER TABLE [dbo].[Documents] WITH CHECK ADD CONSTRAINT [FK_Documents_DocumentSeriesValues] FOREIGN KEY([AppSeriesValueId])
REFERENCES [dbo].[DocumentSeriesValues] ([Id])
GO
ALTER TABLE [dbo].[Documents] CHECK CONSTRAINT [FK_Documents_DocumentSeriesValues]
GO
ALTER TABLE [dbo].[Documents] WITH CHECK ADD CONSTRAINT [FK_Documents_Employees] FOREIGN KEY([EmployeeId])
REFERENCES [dbo].[Employees] ([Id])
GO
ALTER TABLE [dbo].[Documents] CHECK CONSTRAINT [FK_Documents_Employees]
GO
ALTER TABLE [dbo].[Documents] WITH CHECK ADD CONSTRAINT [FK_Documents_LookupDocumentFlowType] FOREIGN KEY([IdLookupDocumentFlowType])
REFERENCES [dbo].[Lookup] ([Id])
GO
ALTER TABLE [dbo].[Documents] CHECK CONSTRAINT [FK_Documents_LookupDocumentFlowType]
GO
ALTER TABLE [dbo].[Documents] WITH CHECK ADD CONSTRAINT [FK_Documents_Partners] FOREIGN KEY([PartnerId])
REFERENCES [dbo].[Partners] ([Id])
GO
ALTER TABLE [dbo].[Documents] CHECK CONSTRAINT [FK_Documents_Partners]
GO
ALTER TABLE [dbo].[Documents] WITH CHECK ADD CONSTRAINT [FK_Documents_PartnerWorksites] FOREIGN KEY([PartnerWorksiteId])
REFERENCES [dbo].[PartnerAddresses] ([Id])
GO
ALTER TABLE [dbo].[Documents] CHECK CONSTRAINT [FK_Documents_PartnerWorksites]
GO
ALTER TABLE [dbo].[Documents] WITH CHECK ADD CONSTRAINT [FK_Documents_TreasuryDocumentTypes] FOREIGN KEY([TreasuryDocumentTypeId])
REFERENCES [dbo].[TreasuryDocumentTypes] ([Id])
GO
ALTER TABLE [dbo].[Documents] CHECK CONSTRAINT [FK_Documents_TreasuryDocumentTypes]
GO
ALTER TABLE [dbo].[Documents] WITH CHECK ADD CONSTRAINT [FK_Documents_TreasuryHouses] FOREIGN KEY([TreasuryHouseId])
REFERENCES [dbo].[TreasuryHouses] ([Id])
GO
ALTER TABLE [dbo].[Documents] CHECK CONSTRAINT [FK_Documents_TreasuryHouses]
GO
ALTER TABLE [dbo].[Documents] WITH CHECK ADD CONSTRAINT [FK_Documents_Warehouses] FOREIGN KEY([WareHouseId])
REFERENCES [dbo].[Warehouses] ([Id])
GO
ALTER TABLE [dbo].[Documents] CHECK CONSTRAINT [FK_Documents_Warehouses]
GO
ALTER TABLE [dbo].[Documents] WITH CHECK ADD CONSTRAINT [FK_Documents_Warehouses1] FOREIGN KEY([DestinationWareHouseId])
REFERENCES [dbo].[Warehouses] ([Id])
GO
ALTER TABLE [dbo].[Documents] CHECK CONSTRAINT [FK_Documents_Warehouses1]
GO
ALTER TABLE [dbo].[Documents] WITH CHECK ADD CONSTRAINT [FK_Documents_Worksites] FOREIGN KEY([WorksiteId])
REFERENCES [dbo].[Worksites] ([Id])
GO
ALTER TABLE [dbo].[Documents] CHECK CONSTRAINT [FK_Documents_Worksites]
GO
ALTER TABLE [dbo].[Documents] ADD CONSTRAINT [DF_Documents_HasStockDifferences] DEFAULT ((0)) FOR [HasStockDifferences]
GO
我花了一整天的时间来寻找这种僵局发生的原因,但没有!请帮助。
涉及相同表的另一个死锁:
<deadlock-list>
<deadlock victim="process2d15caa8">
<process-list>
<process id="process2d15caa8" taskpriority="0" logused="0" waitresource="OBJECT: 10:1797581442:0 " waittime="2585" ownerId="1123615" transactionname="user_transaction" lasttranstarted="2016-01-13T13:26:58.867" XDES="0x20162280" lockMode="IS" schedulerid="1" kpid="3788" status="suspended" spid="76" sbid="2" ecid="0" priority="0" trancount="1" lastbatchstarted="2016-01-13T13:26:58.913" lastbatchcompleted="2016-01-13T13:26:58.900" clientapp="Ciel V7" hostname="PAULP" hostpid="11944" loginname="sa" isolationlevel="read committed (2)" xactid="1123615" currentdb="10" lockTimeout="4294967295" clientoption1="671088672" clientoption2="128056">
<executionStack>
<frame procname="adhoc" line="1" stmtstart="66" sqlhandle="0x020000005707df11bae6fb9a7a8dd71635ee331c03da99d9">
SELECT
[Limit1].[Id] AS [Id],
[Limit1].[IsClosed] AS [IsClosed]
FROM ( SELECT TOP (1)
[Extent1].[Id] AS [Id],
[Extent1].[IsClosed] AS [IsClosed]
FROM [dbo].[Periods] AS [Extent1]
WHERE ([Extent1].[StartDate] <= @p__linq__0) AND ([Extent1].[EndDate] >= @p__linq__1)
) AS [Limit1] </frame>
<frame procname="unknown" line="1" sqlhandle="0x000000000000000000000000000000000000000000000000">
unknown </frame>
</executionStack>
<inputbuf>
(@p__linq__0 int,@p__linq__1 int)SELECT
[Limit1].[Id] AS [Id],
[Limit1].[IsClosed] AS [IsClosed]
FROM ( SELECT TOP (1)
[Extent1].[Id] AS [Id],
[Extent1].[IsClosed] AS [IsClosed]
FROM [dbo].[Periods] AS [Extent1]
WHERE ([Extent1].[StartDate] <= @p__linq__0) AND ([Extent1].[EndDate] >= @p__linq__1)
) AS [Limit1] </inputbuf>
</process>
<process id="process296f390" taskpriority="0" logused="6540" waitresource="OBJECT: 10:1797581442:0 " waittime="2542" ownerId="1123440" transactionname="user_transaction" lasttranstarted="2016-01-13T13:26:58.650" XDES="0x211bdb30" lockMode="IS" schedulerid="2" kpid="3920" status="suspended" spid="66" sbid="2" ecid="0" priority="0" trancount="1" lastbatchstarted="2016-01-13T13:26:58.960" lastbatchcompleted="2016-01-13T13:26:58.960" lastattention="2016-01-13T13:26:34.623" clientapp="Ciel V7" hostname="GEORGEL" hostpid="10516" loginname="sa" isolationlevel="read committed (2)" xactid="1123440" currentdb="10" lockTimeout="4294967295" clientoption1="671088672" clientoption2="128056">
<executionStack>
<frame procname="adhoc" line="1" sqlhandle="0x020000004dda5901ca432e225cfc8d822e286c487bd004ce">
SELECT TOP (1)
[Extent1].[Id] AS [Id],
[Extent1].[StartDate] AS [StartDate],
[Extent1].[EndDate] AS [EndDate],
[Extent1].[IsClosed] AS [IsClosed],
[Extent1].[WarehouseId] AS [WarehouseId],
[Extent1].[ParentId] AS [ParentId],
[Extent1].[DischargeMethodId] AS [DischargeMethodId],
[Extent1].[RunDischargePerDocument] AS [RunDischargePerDocument]
FROM [dbo].[Periods] AS [Extent1]
WHERE ([Extent1].[ParentId] IS NULL) AND ([Extent1].[IsClosed] = 1)
ORDER BY [Extent1].[EndDate] DESC </frame>
</executionStack>
<inputbuf>
SELECT TOP (1)
[Extent1].[Id] AS [Id],
[Extent1].[StartDate] AS [StartDate],
[Extent1].[EndDate] AS [EndDate],
[Extent1].[IsClosed] AS [IsClosed],
[Extent1].[WarehouseId] AS [WarehouseId],
[Extent1].[ParentId] AS [ParentId],
[Extent1].[DischargeMethodId] AS [DischargeMethodId],
[Extent1].[RunDischargePerDocument] AS [RunDischargePerDocument]
FROM [dbo].[Periods] AS [Extent1]
WHERE ([Extent1].[ParentId] IS NULL) AND ([Extent1].[IsClosed] = 1)
ORDER BY [Extent1].[EndDate] DESC </inputbuf>
</process>
<process id="process296f558" taskpriority="0" logused="15780" waitresource="KEY: 10:72057594054377472 (e600db96a62a)" waittime="2481" ownerId="1123280" transactionname="user_transaction" lasttranstarted="2016-01-13T13:26:58.447" XDES="0x155c39f8" lockMode="S" schedulerid="2" kpid="5316" status="suspended" spid="73" sbid="2" ecid="0" priority="0" trancount="1" lastbatchstarted="2016-01-13T13:26:59.023" lastbatchcompleted="2016-01-13T13:26:59.007" clientapp="Ciel V7" hostname="TEST" hostpid="1812" loginname="sa" isolationlevel="read committed (2)" xactid="1123280" currentdb="10" lockTimeout="4294967295" clientoption1="671088672" clientoption2="128056">
<executionStack>
<frame procname="adhoc" line="1" stmtstart="140" sqlhandle="0x02000000348bd118f2d3eef1c2e464e6f2a2e3c731e41862">
SELECT TOP (1)
[Project1].[Id] AS [Id],
[Project1].[Date] AS [Date],
[Project1].[Series] AS [Series],
[Project1].[NrDoc] AS [NrDoc]
FROM ( SELECT
[Extent1].[Id] AS [Id],
[Extent1].[ValidationId] AS [ValidationId],
[Extent1].[NrDoc] AS [NrDoc],
[Extent1].[Date] AS [Date],
[Extent1].[Series] AS [Series]
FROM [dbo].[Documents] AS [Extent1]
WHERE ((DATEDIFF(day, [Extent1].[Date], @p__linq__0)) <= 0) AND ([Extent1].[LookupTypeId] = @p__linq__1) AND ([Extent1].[LookupStatusId] = @p__linq__2) AND ( NOT (([Extent1].[SourceTypeId] = @p__linq__3) AND ((CASE WHEN ([Extent1].[SourceTypeId] IS NULL) THEN cast(1 as bit) ELSE cast(0 as bit) END) = 0)))
) AS [Project1]
ORDER BY [Project1].[Date] DESC, [Project1].[ValidationId] DESC </frame>
<frame procname="unknown" line="1" sqlhandle="0x000000000000000000000000000000000000000000000000">
unknown </frame>
</executionStack>
<inputbuf>
(@p__linq__0 datetime,@p__linq__1 int,@p__linq__2 int,@p__linq__3 int)SELECT TOP (1)
[Project1].[Id] AS [Id],
[Project1].[Date] AS [Date],
[Project1].[Series] AS [Series],
[Project1].[NrDoc] AS [NrDoc]
FROM ( SELECT
[Extent1].[Id] AS [Id],
[Extent1].[ValidationId] AS [ValidationId],
[Extent1].[NrDoc] AS [NrDoc],
[Extent1].[Date] AS [Date],
[Extent1].[Series] AS [Series]
FROM [dbo].[Documents] AS [Extent1]
WHERE ((DATEDIFF(day, [Extent1].[Date], @p__linq__0)) <= 0) AND ([Extent1].[LookupTypeId] = @p__linq__1) AND ([Extent1].[LookupStatusId] = @p__linq__2) AND ( NOT (([Extent1].[SourceTypeId] = @p__linq__3) AND ((CASE WHEN ([Extent1].[SourceTypeId] IS NULL) THEN cast(1 as bit) ELSE cast(0 as bit) END) = 0)))
) AS [Project1]
ORDER BY [Project1].[Date] DESC, [Project1].[ValidationId] DESC </inputbuf>
</process>
</process-list>
<resource-list>
<objectlock lockPartition="0" objid="1797581442" subresource="FULL" dbid="10" objectname="CielStd_a1.dbo.Periods" id="lock30da0c80" mode="X" associatedObjectId="1797581442">
<owner-list>
<owner id="process296f558" mode="X"/>
</owner-list>
<waiter-list>
<waiter id="process2d15caa8" mode="IS" requestType="wait"/>
</waiter-list>
</objectlock>
<objectlock lockPartition="0" objid="1797581442" subresource="FULL" dbid="10" objectname="CielStd_a1.dbo.Periods" id="lock30da0c80" mode="X" associatedObjectId="1797581442">
<owner-list/>
<waiter-list>
<waiter id="process296f390" mode="IS" requestType="wait"/>
</waiter-list>
</objectlock>
<keylock hobtid="72057594054377472" dbid="10" objectname="CielStd_a1.dbo.Documents" indexname="PK_Document" id="lock25c94700" mode="X" associatedObjectId="72057594054377472">
<owner-list>
<owner id="process296f390" mode="X"/>
</owner-list>
<waiter-list>
<waiter id="process296f558" mode="S" requestType="wait"/>
</waiter-list>
</keylock>
</resource-list>
</deadlock>
</deadlock-list>
经过一些调查,我发现在我们的交易中,我们执行类似于此的查询: SELECT 1 FROM SomeTable WITH(HOLDLOCK,TABLOCKX)
“Sometable”表与上面的给定表没有任何关系。看起来像TABLOCKX提示块以某种方式阻止其他数据库对象。有人能告诉我这种行为的原因吗?