我有一个SQL Sever 2008 R2数据库安装程序和一个每小时运行一次查询(大约需要3分钟运行)的查询。该查询用其结果填充临时表。复制SQL Server数据库死锁查询受害者
然而,每隔一段时间我得到这个错误:
Transaction (Process ID 63) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction. [SQLSTATE 40001] (Error 1205)
这将停止正在运行的查询。
处理此错误的最佳做法是什么?
在此先感谢。
exec sp_executesql N'EXECUTE msdb.dbo.sp_sqlagent_log_jobhistory @job_id = @P1, @step_id = @P2, @sql_message_id = @P3, @sql_severity = @P4, @run_status = @P5, @run_date = @P6, @run_time = @P7, @run_duration = @P8, @operator_id_emailed = @P9, @operator_id_netsent = @P10, @operator_id_paged = @P11, @retries_attempted = @P12, @session_id = @P13, @message = @P14',N'@P1 uniqueidentifier,@P2 int,@P3 int,@P4 int,@P5 int,@P6 int,@P7 int,@P8 int,@P9 int,@P10 int,@P11 int,@P12 int,@P13 int,@P14 nvarchar(4000)','0A7AFD76-D2EC-463E-A802-8B66241B0D26',2,8153,13,0,20140320,110114,219,0,0,0,0,52,N'Executed as user: DOMAIN\sql. Transaction (Process ID 62) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction. [SQLSTATE 40001] (Error 1205) Warning: Null value is eliminated by an aggregate or other SET operation. [SQLSTATE 01003] (Error 8153). The step failed.'
上面是返回表单分析器。
是否有任何其他的工作修改您的查询访问表? –
@ shree.pat18我可以建议的唯一事情是复制本身? – LaLa