• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to find current SQL statement being executed by particular session in Oracle

by admin

To find the current SQL statement being executed by particular session in Oracle, Query V$SQLAREA and V$SESSION views.

Here is the query to report the current SQL statement being executed by a session:

select substr(v2.sid,1,5)       "SID"
      ,substr(v2.username,1,8)  "Username"
      ,substr(program,1,10)     "Program"
,sql_text
 from
    sys.v_$sqlarea v1,
    sys.v_$session v2
  where
     v1.address= v2.sql_address and
     v1.hash_value = v2.sql_hash_value;

The above query will return the following for example:

SID   Username Program  SQL_TEXT
---   -------- -------  -----------------------------------
12    SCOTT    sqlplus  insert into ken values(1000)

Filed Under: oracle

Some more articles you might also be interested in …

  1. How to load SELinux Module For Oracleasm
  2. Oracle RMAN interview questions
  3. How to rename Oracle-Managed Files (OMFs)
  4. How to Connect without password on Command line when using EZCONNECT
  5. New Oracle Net features in version 12c
  6. Oracle 12C Enhancements for Cascaded Standby Databases
  7. How to Install and configure OSWatcher Black Box (OSWbb)
  8. Running RMAN DUPLICATE / RESTORE on a different version than source database version.
  9. How to Connect to an Oracle Pluggable Database (PDB)
  10. How To Size UNDO Tablespace For Automatic Undo Management

You May Also Like

Primary Sidebar

Recent Posts

  • pw-cat Command Examples in Linux
  • pvs: command not found
  • pulseaudio: command not found
  • pulseaudio Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright