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


Simple Trigger causing deadlock problem


Simple Trigger causing deadlock problem

Author
Message
marc 11239
marc 11239
Valued Member
Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)

Group: General Forum Members
Points: 66 Visits: 2
hi,
i have 3 databases in the same sql 2005 server
db1 and db2 hold both a table A in which only rows get inserted, never deleted nor updated

i needed to combine both so i created db3 with the same table A' and with an extra column identifying the origin
since i wanted the events to be inserted in real time i created a trigger on both db1.A and db2.A

create trigger on db1.A
after insert
set nocount on
insert into db3.A' (origigin, fields...) select 1,INSERTED.fields... from inserted


same trigger on db2.A

now this works rather well but sometimes throws a deadlock
and i have no clue why it should...

any ideas/suggestions?
tia,
marc
Orlando Colamatteo
Orlando Colamatteo
SSC-Dedicated
SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)

Group: General Forum Members
Points: 38954 Visits: 14411
Can you post the deadlock graph?

If you do not already have one captured enable trace flag 1222 and then one occurs again you can retrieve it from the SQL Error Log.

__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
marc 11239
marc 11239
Valued Member
Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)

Group: General Forum Members
Points: 66 Visits: 2
no i can't...
i got the error during havy load but also when there were only 10 recs inserted...
so no trace is running at this moment
and i can't turn the trigger on at this point when the system is under heavy load cause they don't want instability
so this limits my options....
i could turn it on now but i can't simulate the problem...
thx
marc 11239
marc 11239
Valued Member
Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)

Group: General Forum Members
Points: 66 Visits: 2
the only other thing worth mentioning is that it is a clustered server...
Orlando Colamatteo
Orlando Colamatteo
SSC-Dedicated
SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)

Group: General Forum Members
Points: 38954 Visits: 14411
Enabling a Trace Flag is not the same as running a Trace. If you do not have a deadlock graph and you cannot enable the Trace Flag and the trigger to attain one the next time this happens then it is going to be hard, if not impossible, to help you.

Clustering does not have any effect on deadlock issues. Deadlocks occur for many reasons and the root cause of some scenarios can be quite difficult to determine, especially without a deadlock graph.

__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
marc 11239
marc 11239
Valued Member
Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)

Group: General Forum Members
Points: 66 Visits: 2
ok i see the point
i'll try to convince the customer...
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