title: How to find locked rows in Oracle
body: <p>We have an Oracle database, and the customer account table has about a million rows. Over the years, we've built four different UIs (two in Oracle Forms, two in .Net), all of which remain in use. We have a number of background tasks (both persistent and scheduled) as well. </p>
  
  <p>Something is occasionally holding a long lock (say, more than 30 seconds) on a row in the account table, which causes one of the persistent background tasks to fail. The background task in question restarts itself once the update times out. We find out about it a few minutes after it happens, but by then the lock has been released.</p>
  
  <p>We have reason to believe that it might be a misbehaving UI, but haven't been able to find a "smoking gun".</p>
  
  <p>I've found some queries that list blocks, but that's for when you've got two jobs contending for a row. I want to know which rows have locks when there's not necessarily a second job trying to get a lock.</p>
  
  <p>We're on 11g, but have been experiencing the problem since 8i.</p>