- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- find the sql cause lock,I use the sql (uncommit or...
Operating System - HP-UX
1753767
Members
5737
Online
108799
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-07-2002 12:17 AM
тАО07-07-2002 12:17 AM
find the sql cause lock,I use the sql (uncommit or rollback sql statement)
Hi: I want to find the sql cause lock,I use the sql
SELECT object_name,SESSION_ID,SERIAL#,machine,
osuser,S.PROCESS,e.sql_text
FROM V$LOCKED_OBJECT p, V$SESSION S , dba_objects B, v$sql e, v$lock l
WHERE p.SESSION_ID=S.SID and b.OBJECT_ID=p.OBJECT_ID and
l.addr=e.ADDRESS
and l.sid=s.sid;
but $lock 's addr and v$sql 's address is not equal?
or
How can I find the sql cause lock ?
Tks??????
SELECT object_name,SESSION_ID,SERIAL#,machine,
osuser,S.PROCESS,e.sql_text
FROM V$LOCKED_OBJECT p, V$SESSION S , dba_objects B, v$sql e, v$lock l
WHERE p.SESSION_ID=S.SID and b.OBJECT_ID=p.OBJECT_ID and
l.addr=e.ADDRESS
and l.sid=s.sid;
but $lock 's addr and v$sql 's address is not equal?
or
How can I find the sql cause lock ?
Tks??????
xysco
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-07-2002 12:50 PM
тАО07-07-2002 12:50 PM
Re: find the sql cause lock,I use the sql (uncommit or rollback sql statement)
You can join v$session to v$sql as shown below.
This may eliminate the need to join v$lock with v$sql.
select s.username, s.sid, t.sql_text "Last SQL"
from v$session s, v$sql t
where s.sql_address =t.address and s.sql_hash_value =t.hash_value
Hope this helps, Jeanine
This may eliminate the need to join v$lock with v$sql.
select s.username, s.sid, t.sql_text "Last SQL"
from v$session s, v$sql t
where s.sql_address =t.address and s.sql_hash_value =t.hash_value
Hope this helps, Jeanine
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-08-2002 02:05 PM
тАО07-08-2002 02:05 PM
Re: find the sql cause lock,I use the sql (uncommit or rollback sql statement)
Change l.addr to s.sql_address
SELECT object_name, SESSION_ID, SERIAL#, machine, osuser, S.PROCESS, e.sql_text
FROM V$LOCKED_OBJECT p, V$SESSION S , DBA_OBJECTS B, v$sql e, v$lock l
WHERE p.SESSION_ID=S.SID AND b.OBJECT_ID=p.OBJECT_ID AND
s.sql_address=e.ADDRESS
AND l.sid=s.sid;
I also have a sql script I modified to givel sql output. The formatting is questionable (but it serves my needs). It uses dbms_output so keep in mind the upper bound of the buffer. It gives all the session info, spid, login time, status, ... It faster than trying to join all the tables together.
Scott
SELECT object_name, SESSION_ID, SERIAL#, machine, osuser, S.PROCESS, e.sql_text
FROM V$LOCKED_OBJECT p, V$SESSION S , DBA_OBJECTS B, v$sql e, v$lock l
WHERE p.SESSION_ID=S.SID AND b.OBJECT_ID=p.OBJECT_ID AND
s.sql_address=e.ADDRESS
AND l.sid=s.sid;
I also have a sql script I modified to givel sql output. The formatting is questionable (but it serves my needs). It uses dbms_output so keep in mind the upper bound of the buffer. It gives all the session info, spid, login time, status, ... It faster than trying to join all the tables together.
Scott
Die Laughing
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP