I have stored procedures in SQL Server T-SQL which are called from .NET in a transfer area.
Within my stored procedure, I am logging some into some auditing tables. I put one row in the auditing table, and then later in the transaction fill it with more information through updates.
What I'm going to know is that if some people try the same thing together, 1 or 2 of them will be in the form of deadlock victims. At the moment, I am convinced that when I am joining the auditing tables, some locking is happening.
I want to execute the inclusion and updating of auditing tables outside the transaction executing, so auditing may happen anyway, even if the transaction rolls back, I was hoping that It can stop any lock, allow more than one person to execute the process once.
Can anyone help me do this in T-SQL?
Thanks, Rich
Updates - I have found that due to the enthusiasm of using the SQL Profiler to track the source of Deadlock, the auditing transaction was not related to the deadlock. .
Why are you updating auditing tables? If you were only inspecting then you can help prevent lock maintenance. Along with this, did you determine the deadlock trace that you were actually deadlocking?
You can do it by enabling it. Or the SQL Profiler is running, it will give you detailed information that will tell you what type of deadlock (locks, threads, parallel etc.).
Check out this article.
Another way to audit is to remove all logging events at the application level in a queue completely by deleting business transactions, this reduces impact logging on your business transactions, but possibly a huge For the current application.
Comments
Post a Comment