我们最近升级到sql server 2012.我们有xxx-D-011作为OLTP服务器,yyy-D-011作为分发服务器。 该日志每天都在应用程序查询/更新和复制作业之间显示死锁。
下面列出了有关死锁的日志片段。任何可以帮助我完成后续步骤的意见/想法将不胜感激。谢谢!
2014-07-10 15:31:05.94 spid13s deadlock-list
2014-07-10 15:31:05.94 spid13s deadlock victim=process37ced3498
2014-07-10 15:31:05.94 spid13s process-list
2014-07-10 15:31:05.94 spid13s process id=process37ced3498 taskpriority=0 logused=0 waitresource=OBJECT: 8:532249001:0 waittime=357 ownerId=860304057 transactionname=SELECT lasttranstarted=2014-07-10T15:31:05.090 XDES=0x4674fbca0 lockMode=Sch-S schedulerid=2 kpid=10128 status=suspended spid=111 sbid=0 ecid=0 priority=0 trancount=0 lastbatchstarted=2014-07-10T15:31:05.090 lastbatchcompleted=2014-07-10T15:31:05.090 lastattention=1900-01-01T00:00:00.090 clientapp=.Net SqlClient Data Provider hostname=DIT3330W7DT hostpid=1092 loginname=xuser isolationlevel=read uncommitted (1) xactid=860304057 currentdb=8 lockTimeout=4294967295 clientoption1=673316896 clientoption2=128056
2014-07-10 15:31:05.94 spid13s executionStack
2014-07-10 15:31:05.94 spid13s frame procname= dbo.UpdatePurchaseOrderWorkQueueStatus line=39 stmtstart=2232 stmtend=2756 sqlhandle=0x0300080013baae0b4974c5004aa3000001000000000000000000000000000000000000000000000000000000
2014-07-10 15:31:05.94 spid13s SELECT @XDate = dbo.fn_getxdate(C.ClinicID)
2014-07-10 15:31:05.94 spid13s FROM dbo.Station S
2014-07-10 15:31:05.94 spid13s INNER JOIN dbo.Clinic C ON C.ClinicID = S.ClinicID
2014-07-10 15:31:05.94 spid13s INNER JOIN dbo.PurchaseOrder PO ON PO.StationID = S.StationID
2014-07-10 15:31:05.94 spid13s WHERE S.Active = 1
2014-07-10 15:31:05.94 spid13s AND PO.PurchaseOrderID = @PurchaseOrderID
2014-07-10 15:31:05.94 spid13s inputbuf
2014-07-10 15:31:05.94 spid13s Proc [Database Id = 8 Object Id = 196000275]
2014-07-10 15:31:05.94 spid13s process id=process37ced3c38 taskpriority=0 logused=60504 waitresource=OBJECT: 8:644249400:0 waittime=313 ownerId=860303537 transactionname=user_transaction lasttranstarted=2014-07-10T15:31:04.830 XDES=0x1da8ead28 lockMode=Sch-M schedulerid=2 kpid=5544 status=suspended spid=119 sbid=0 ecid=0 priority=0 trancount=5 lastbatchstarted=2014-07-10T15:31:04.880 lastbatchcompleted=2014-07-10T15:31:04.880 lastattention=1900-01-01T00:00:00.880 clientapp=xxx-D-011-x-x_OrgHierarchy_Publication-13 hostname=yyy-D-011 hostpid=3360 loginname=svcadminsqldev isolationlevel=read committed (2) xactid=860303537 currentdb=8 lockTimeout=4294967295 clientoption1=538968096 clientoption2=128024
2014-07-10 15:31:05.94 spid13s executionStack
2014-07-10 15:31:05.94 spid13s frame procname=mssqlsystemresource.sys.sp_MSsetfilteredstatus line=30 stmtstart=1570 stmtend=1796 sqlhandle=0x0300ff7f66f82acd71e2fc00efa0000001000000000000000000000000000000000000000000000000000000
2014-07-10 15:31:05.94 spid13s EXEC %%Object(MultiName = @qualified_name).LockMatchID(ID = @object_id, Exclusive = 1, BindInternal = 0)
2014-07-10 15:31:05.94 spid13s frame procname=mssqlsystemresource.sys.sp_MSrepl_changesubstatus line=909 stmtstart=66056 stmtend=66312 sqlhandle=0x0300ff7f48dddfc2bfe2fc00efa0000001000000000000000000000000000000000000000000000000000000
2014-07-10 15:31:05.94 spid13s exec sys.sp_MSsetfilteredstatus @tabid
2014-07-10 15:31:05.94 spid13s -- clear nonsqlsub status for this article.
2014-07-10 15:31:05.94 spid13s frame procname=mssqlsystemresource.sys.sp_changesubstatus line=52 stmtstart=3496 stmtend=5162 sqlhandle=0x0300ff7f5eea5ef792d8fa00efa0000001000000000000000000000000000000000000000000000000000000
2014-07-10 15:31:05.94 spid13s EXEC @retcode = @cmd
2014-07-10 15:31:05.94 spid13s @publication,
2014-07-10 15:31:05.94 spid13s @article,
2014-07-10 15:31:05.94 spid13s @subscriber,
2014-07-10 15:31:05.94 spid13s @status,
2014-07-10 15:31:05.94 spid13s @previous_status,
2014-07-10 15:31:05.94 spid13s @destination_db,
2014-07-10 15:31:05.94 spid13s @frequency_type,
2014-07-10 15:31:05.94 spid13s @frequency_interval,
2014-07-10 15:31:05.94 spid13s @frequency_relative_interval,
2014-07-10 15:31:05.94 spid13s @frequency_recurrence_factor,
2014-07-10 15:31:05.94 spid13s @frequency_subday,
2014-07-10 15:31:05.94 spid13s @frequency_subday_interval,
2014-07-10 15:31:05.94 spid13s @active_start_time_of_day,
2014-07-10 15:31:05.94 spid13s @active_end_time_of_day,
2014-07-10 15:31:05.94 spid13s @active_start_date,
2014-07-10 15:31:05.94 spid13s @active_end_date,
2014-07-10 15:31:05.94 spid13s @optional_command_line,
2014-07-10 15:31:05.94 spid13s @distribution_jobid OUTPUT,
2014-07-10 15:31:05.95 spid13s @from_auto_sync,
2014-07-10 15:31:05.95 spid13s @ignore_distributor,
2014-07-10 15:31:05.95 spid13s -- Agent offload
2014-07-10 15:31:05.95 spid13s @offloadagent,
2014-07-10 15:31:05.95 spid13s @offloadserver,
2014-07-10 15:31:05.95 spid13s @dts_package_name,
2014-07-10 15:31:05.95 spid13s @dts_package_password,
2014-07-10 15:31:05.95 spid13s @dts_package_location,
2014-07-10 15:31:05.95 spid13s @skipobjectactivation,
2014-07-10 15:31:05.95 spid13s @distribution_job_name,
2014-07-10 15:31:05.95 spid13s @publisher,
2014-07-10 15:31:05.95 spid13s @publisher_type
2014-07-10 15:31:05.95 spid13s ,@ignore_distributor_failure
2014-07-10 15:31:05.95 spid13s frame procname=mssqlsystemresource.sys.sp_MSactivate_auto_sub line=92 stmtstart=4236 stmtend=4768 sqlhandle=0x0300ff7f6366c5c4d8e2fc00efa0000001000000000000000000000000000000000000000000000000000000
2014-07-10 15:31:05.95 spid13s *sp_changesubstatus------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2014-07-10 15:31:05.95 spid13s inputbuf
2014-07-10 15:31:05.95 spid13s Proc [Database Id = 32767 Object Id = -993696157]
2014-07-10 15:31:05.95 spid13s resource-list
2014-07-10 15:31:05.95 spid13s objectlock lockPartition=0 objid=532249001 subresource=FULL dbid=8 objectname=X.dbo.Station id=lock389908f00 mode=Sch-M associatedObjectId=532249001
2014-07-10 15:31:05.95 spid13s owner-list
2014-07-10 15:31:05.95 spid13s owner id=process37ced3c38 mode=Sch-M
2014-07-10 15:31:05.95 spid13s waiter-list
2014-07-10 15:31:05.95 spid13s waiter id=process37ced3498 mode=Sch-S requestType=wait
2014-07-10 15:31:05.95 spid13s objectlock lockPartition=0 objid=644249400 subresource=FULL dbid=8 objectname=X.dbo.Clinic id=lock3f2864b00 mode=S associatedObjectId=644249400
2014-07-10 15:31:05.95 spid13s owner-list
2014-07-10 15:31:05.95 spid13s owner id=process37ced3498 mode=Sch-S
2014-07-10 15:31:05.95 spid13s waiter-list
2014-07-10 15:31:05.95 spid13s waiter id=process37ced3c38 mode=Sch-M requestType=convert
答案 0 :(得分:1)
这很不寻常。
您使用普通的香草出版物/订阅吗?
混合中是否有过滤器?如果您使用过滤器,我们可以看到过滤器吗?
发布文章中的触发器中的本地表变量存在一些问题。
我怀疑问题出在fn_getxdate上,我能看到该函数的代码吗?