locking - How to find locked rows in Oracle -
We have an Oracle database, and there are about one million lines in the client account table. Over the years, we have four separate UI (Two in the oracle form, two in the net), which all remain in use. We also have many background tasks (both continuously and scheduled)
From time to time, on the one line in the account table, lock lock (more than 30 seconds) for a while, None of the tasks fail. After the update times the background function in the question automatically restarts. A few minutes after this happens, we can find out about it, but by then the lock has been issued.
We have reason to believe that this may be a misbehavior UI, but that "smoking gun"
I have received some inquiry which blocks the list, but when you get two jobs for one line, I want to know which rows are locked when another job in trying to get a lock is not necessarily.
We are on 11G, but since 8i we are facing the problem.
The locking concept of Oracle
differs significantly from other systems.
When a line is locked in Oracle
, the record is updated with the new value (if any) and additionally, a lock (which is essentially a lane - An indicator for the lawn lock, which remains in the rollback section) is kept in the record.
This means that locking records in Oracle
is to update the metadata of the record and continue writing the logical page. For example, you can not just read SELECT FOR UPDATE
on the table space to read one.
Besides, it is not updated after recording: Instead, the Rollback Segment has been updated.
This means that each record contains some information about the transaction that it was last updated, even if the transaction died. To find out if the transaction is alive or not (and, if the record is alive or not), then there is a need to go to Rollback Segment.
Oracle does not have a traditional lock manager, and this means it is necessary to scan all the records in all the items to get a list of all the locks. This will take a long time.
You can get locked metadata objects (like using v $ locked_object
), some special locks, lock wait ( v $ session
) Etc., but there is not a list of all the locks on all the objects in the database.
Comments
Post a Comment