Monday, March 23, 2015

Displays the SQL statements for currently running processes

SELECT s.sid,
       s.status "Status",
       p.spid "Process",
       s.schemaname " Name",
       s.osuser "OS User",
       Substr(a.sql_text,1,100) "SQL Text file",
       s.program "Program"
FROM   v$session s,
       v$sqlarea a,
       v$process p
WHERE  s.sql_hash_value = a.hash_value (+)
AND    s.sql_address    = a.address (+)
AND    s.paddr          = p.addr;


       SID Status   Process                  Schema Name                    OS User                        SQL Text                                                                                                                 Program                                                       
---------- -------- ------------------------ ------------------------------ ------------------------------ ------------------------------------------------------------------------------------------------------------------------ ----------------------------------------------------------------
       125 ACTIVE   3132                     SYS                            SYSTEM                                                                                                                                                  ORACLE.EXE (PMON)                                               
       187 ACTIVE   3136                     SYS                            SYSTEM                                                                                                                                                  ORACLE.EXE (VKTM)                                               
         1 ACTIVE   3140                     SYS                            SYSTEM                                                                                                                                                  ORACLE.EXE (GEN0)                                               
        64 ACTIVE   3144                     SYS                            SYSTEM                                                                                                                                                  ORACLE.EXE (DIAG)                                               
       126 ACTIVE   3148                     SYS                            SYSTEM                                                                                                                                                  ORACLE.EXE (DBRM)                                               
       188 ACTIVE   3152                     SYS                            SYSTEM                                                                                                                                                  ORACLE.EXE (PSP0)                                               
         2 ACTIVE   3156                     SYS                            SYSTEM                                                                                                                                                  ORACLE.EXE (DIA0)                                               
        65 ACTIVE   3160                     SYS                            SYSTEM                                                                                                                                                  ORACLE.EXE (MMAN)                                               
       127 ACTIVE   3168                     SYS                            SYSTEM                                                                                                                                                  ORACLE.EXE (DBW0)                                               
       189 ACTIVE   3172                     SYS                            SYSTEM                                                                                                                                                  ORACLE.EXE (LGWR)                                               
         3 ACTIVE   3176                     SYS                            SYSTEM                                                                                                                                                  ORACLE.EXE (CKPT)                                               
        66 ACTIVE   3180                     SYS                            SYSTEM                                                                                                                                                  ORACLE.EXE (SMON)                                               
       128 ACTIVE   3184                     SYS                            SYSTEM                                                                                                                                                  ORACLE.EXE (RECO)                                               
       192 ACTIVE   3188                     SYS                            SYSTEM                                                                                                                                                  ORACLE.EXE (MMON)                                               
         4 ACTIVE   3192                     SYS                            SYSTEM                                                                                                                                                  ORACLE.EXE (MMNL)                                               
       191 ACTIVE   3856                     SYS                            SYSTEM                                                                                                                                                  ORACLE.EXE (Q000)                                               
        14 ACTIVE   3512                     SYS                            SYSTEM                                                                                                                                                  ORACLE.EXE (SMCO)                                               
        72 ACTIVE   3104                     SYS                            SYSTEM                                                                                                                                                  ORACLE.EXE (W000)                                               
       135 ACTIVE   7768                     SYSTEM                         Prabhakar                      SELECT s.sid,        s.status "Status",        p.spid "Process",        s.schemaname "Schema Name",        s.osuser "OS  SQL Developer                                                   
       194 ACTIVE   3264                     SYS                            SYSTEM                                                                                                                                                  ORACLE.EXE (ARC0)                                               
         5 ACTIVE   3284                     SYS                            SYSTEM                                                                                                                                                  ORACLE.EXE (ARC1)                                               
        63 ACTIVE   3288                     SYS                            SYSTEM                                                                                                                                                  ORACLE.EXE (ARC2)                                               
       129 ACTIVE   3292                     SYS                            SYSTEM                                                                                                                                                  ORACLE.EXE (ARC3)                                               
       195 ACTIVE   3328                     SYS                            SYSTEM                                                                                                                                                  ORACLE.EXE (QMNC)                                               
         8 ACTIVE   3852                     SYS                            SYSTEM                                                                                                                                                  ORACLE.EXE (CJQ0)                                               
        74 ACTIVE   3884                     SYS                            SYSTEM                                                                                                                                                  ORACLE.EXE (J000)                                               
       133 ACTIVE   6252                     SYS                            SYSTEM                                                                                                                                                  ORACLE.EXE (J001)                                               
       197 ACTIVE   3860                     SYS                            SYSTEM                                                                                                                                                  ORACLE.EXE (Q001)                                               

 28 rows selected