HiveBrain v1.2.0
Get Started
← Back to all entries
snippetCritical

How to determine if an Oracle table is locked or not?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
lockeddeterminehoworaclenottable

Problem

We've been using BI software and a repository database that are installed on Oracle Enterprise 11gR2.

Some of these batch reports will try to access a database table which may still be locked. How can I find out if an Oracle table is locked or not? Is there any SQL statement that displays like history details to analysis?

Solution

Following query gives details of all locks.

SELECT B.Owner, B.Object_Name, A.Oracle_Username, A.OS_User_Name  
FROM V$Locked_Object A, All_Objects B
WHERE A.Object_ID = B.Object_ID

Code Snippets

SELECT B.Owner, B.Object_Name, A.Oracle_Username, A.OS_User_Name  
FROM V$Locked_Object A, All_Objects B
WHERE A.Object_ID = B.Object_ID

Context

StackExchange Database Administrators Q#56615, answer score: 60

Revisions (0)

No revisions yet.