--Query the SQL statement that Oracle is executing and the user who executes the statement
[SQL]View Plain copy
- select b.sid oracleid,
- b.username Login Oracle user name,
Li class= "alt" >       B.SERIAL#,  
- spid operating system id,
- paddr,
- sql_text executing sql,
- b.machine computer name
- FROM V$PROCESS A, V$SESSION B, V$SQLAREA C  
- where a.addr = b.paddr
- and b.sql_hash_value = c.hash_value
--View the issuer's release procedure for executing SQL
[SQL]View Plain copy
- SELECT osuser Computer Login status,
- program that initiated the request,
- USERNAME user name of the login system,
- SCHEMANAME,
- B.cpu_time spends Cpu time,
- STATUS,
- SQL executed by B.sql_text
- From V$session A
- Left JOIN v$sql B on a.sql_address = b.address
- and A.sql_hash_value = B.hash_value
- ORDER by b.cpu_time DESC
--Identify Oracle's current locked object
[SQL]View Plain copy
- SELECT l.session_id SID,
- s.serial#,
- L.locked_mode lock mode,
- L.oracle_username logged in user,
- L.os_user_name Login Machine User name,
- S.machine machine Name,
- S.terminal End user Name,
- O.object_name is locked object name,
- S.logon_time Logon Database time
- From V$locked_object L, all_objects O, v$session s
- WHERE l.object_id = o.object_id
- and l.session_id = S.sid
- ORDER by Sid, S.serial#;
--kill drop the current lock object can be
Alter system kill session ' Sid, S.serial# ';
Querying SQL statements that Oracle is executing