SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Deadlocked SQL Agent job


Deadlocked SQL Agent job

Author
Message
Casper101
Casper101
Old Hand
Old Hand (327 reputation)Old Hand (327 reputation)Old Hand (327 reputation)Old Hand (327 reputation)Old Hand (327 reputation)Old Hand (327 reputation)Old Hand (327 reputation)Old Hand (327 reputation)

Group: General Forum Members
Points: 327 Visits: 1268
Hi,

I have a SQL 2000 Agent job that executes a stored procedure which populates a table from a file.
The code in the SP is not within a transaction and the EXEC of the proc is also not in a transaction. It is just a SQL Agent job.
It happens every now and again that this job fails with an error message indicating that it was a deadlock victim.

My question is:
Will the queries in the proc roll back when this deadlock occurs?
OR
Will it import the file up to a the point of deadlock and then just stop - meaning an incomplete import?
arunyadav007
arunyadav007
Valued Member
Valued Member (68 reputation)Valued Member (68 reputation)Valued Member (68 reputation)Valued Member (68 reputation)Valued Member (68 reputation)Valued Member (68 reputation)Valued Member (68 reputation)Valued Member (68 reputation)

Group: General Forum Members
Points: 68 Visits: 299
Hello Casper,

According to my knowledge of deadlocks,

Deadlocking occurs when two or more user processes have locks on separate objects and each process is trying to acquire a lock on the object that the other process has locked. When this happens, SQL Server resolves the deadlock by automatically aborting one process, the "victim" process, allowing the other processes to continue.

The aborted transaction is rolled back and an error message is sent to the user of the aborted process. Generally, the transaction that requires the least amount of overhead to roll back is the transaction that is aborted.

So, theoritically, in your case, the table should not be populated at all.

Please refer to the below articles on handling deadlocks:

http://sqlserverpedia.com/wiki/Handling_Deadlock_Conditions_with_TRY_/_CATCH
http://www.simple-talk.com/sql/database-administration/handling-deadlocks-in-sql-server/

Let me know if it solves your query...
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search