Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Simple Trigger causing deadlock problem Expand / Collapse
Author
Message
Posted Wednesday, February 13, 2013 6:55 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, February 13, 2013 8:23 AM
Points: 4, 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
Post #1419485
Posted Wednesday, February 13, 2013 8:21 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 5:56 AM
Points: 7,140, Visits: 12,764
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
Post #1419555
Posted Wednesday, February 13, 2013 8:26 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, February 13, 2013 8:23 AM
Points: 4, 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
Post #1419560
Posted Wednesday, February 13, 2013 8:28 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, February 13, 2013 8:23 AM
Points: 4, Visits: 2
the only other thing worth mentioning is that it is a clustered server...
Post #1419561
Posted Wednesday, February 13, 2013 8:35 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 5:56 AM
Points: 7,140, Visits: 12,764
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
Post #1419571
Posted Wednesday, February 13, 2013 8:39 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, February 13, 2013 8:23 AM
Points: 4, Visits: 2
ok i see the point
i'll try to convince the customer...
Post #1419575
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse