The forum will experience an outage sometime between February 10 at 7:00pm EST and February 12 at 11:59 EST for installation of security updates. The actual time and duration of the outage are unknown but attempts will be made to minimize the downtime. We apologize for any inconvenience.

Hello

I have setup a event to log deadlocks. I recognize that sa_report_deadlocks() returns a object_id and record_id. With the object id I can identify the base table.

But how can I find the row in question ?

Kind regards

asked 08 Jan '16, 05:23

Thomas%20Duemesnil's gravatar image

Thomas Dueme...
2.4k203357
accept rate: 16%


As the record_id column within sa_report_deadlock() is declared as "The row ID of the associated row.", I would think the ROWID() system function will help. Here's a similar sample for the sa_locks() output:

SELECT * 
  FROM sa_locks() S JOIN GROUPO.Employees WITH( NOLOCK ) 
     ON ROWID( Employees ) = S.row_identifier 
  WHERE S.table_name = 'Employees';
permanent link

answered 08 Jan '16, 07:51

Volker%20Barth's gravatar image

Volker Barth
29.3k287438644
accept rate: 32%

I have checked my last deadlog entry and the record_id is not actually in the table. The table in question is a log table where I write only. So the record of the winner of the deadlock situation should be there. I will check when the next event happens if that can match.

(08 Jan '16, 08:16) Thomas Dueme...

Here's a WAG: try ROWID() as in...

   SELECT * FROM DBA.t WHERE ROWID ( t ) = [record_id value];

Caveat Emptor: I have not tried that particular logic with sa_report_deadlocks(), but Foxhound displays a similar query for you to use with the sa_locks() row_identifier column; see the Locked Row Query: field here...

permanent link

answered 08 Jan '16, 07:58

Breck%20Carter's gravatar image

Breck Carter
26.6k418575824
accept rate: 21%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×186
×4

question asked: 08 Jan '16, 05:23

question was seen: 252 times

last updated: 08 Jan '16, 08:16