我有一個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