日常SQL使用总结
1、查询SQL
SQL> select machine,address,piece,sql_text from v$session,v$sqltext where address=sql_address and osuser <> 'SYSTEM' order by address,piece;
2、SQL
SQL> r 1* select machine,PROGRAM,sid,SERIAL# ,USERNAME,STATUS,COMMAND from v$session order by USERNAME desc MACHINE PROGRAM SID SERIAL# USERNAME STATUS COMMAND ---------------------------------------------------------------- ------------------------------------------------ ---------- ---------- ------------------------------ -------- ---------- dbserver11g.localdomain oracle@dbserver11g.localdomain (VKTM) 1 1 ACTIVE 0 dbserver11g.localdomain oracle@dbserver11g.localdomain (DIA0) 2 1 ACTIVE 0 dbserver11g.localdomain oracle@dbserver11g.localdomain (SMCO) 1720 25 ACTIVE 0 dbserver11g.localdomain oracle@dbserver11g.localdomain (QMNC) 1713 1 ACTIVE 0 dbserver11g.localdomain oracle@dbserver11g.localdomain (MMON) 1709 1 ACTIVE 0 dbserver11g.localdomain oracle@dbserver11g.localdomain (LGWR) 1708 1 ACTIVE 0 dbserver11g.localdomain oracle@dbserver11g.localdomain (DBRM) 1707 1 ACTIVE 0 dbserver11g.localdomain oracle@dbserver11g.localdomain (PSP0) 1706 1 ACTIVE 0 dbserver11g.localdomain oracle@dbserver11g.localdomain (Q000) 1141 5 ACTIVE 0 dbserver11g.localdomain oracle@dbserver11g.localdomain (RECO) 1140 1 ACTIVE 0 dbserver11g.localdomain oracle@dbserver11g.localdomain (DBW0) 1139 1 ACTIVE 0 MACHINE PROGRAM SID SERIAL# USERNAME STATUS COMMAND ---------------------------------------------------------------- ------------------------------------------------ ---------- ---------- ------------------------------ -------- ---------- dbserver11g.localdomain oracle@dbserver11g.localdomain (DIAG) 1138 1 ACTIVE 0 dbserver11g.localdomain oracle@dbserver11g.localdomain (PMON) 1137 1 ACTIVE 0 dbserver11g.localdomain oracle@dbserver11g.localdomain (SMON) 571 1 ACTIVE 0 dbserver11g.localdomain oracle@dbserver11g.localdomain (MMAN) 570 1 ACTIVE 0 dbserver11g.localdomain oracle@dbserver11g.localdomain (GEN0) 569 1 ACTIVE 0 dbserver11g.localdomain oracle@dbserver11g.localdomain (CKPT) 3 1 ACTIVE 0 dbserver11g.localdomain oracle@dbserver11g.localdomain (MMNL) 4 1 ACTIVE 0 dbserver11g.localdomain oracle@dbserver11g.localdomain (CJQ0) 6 3 ACTIVE 0 dbserver11g.localdomain oracle@dbserver11g.localdomain (Q001) 8 3 ACTIVE 0 dbserver11g.localdomain oracle@dbserver11g.localdomain (W000) 10 24209 ACTIVE 0 dbserver11g.localdomain sqlplus@dbserver11g.localdomain (TNS V1-V3) 579 2859 SYS ACTIVE 3 MACHINE PROGRAM SID SERIAL# USERNAME STATUS COMMAND ---------------------------------------------------------------- ------------------------------------------------ ---------- ---------- ------------------------------ -------- ---------- appserver.localdomain Precise - pw.fp 577 3111 PRECISE_PMDB INACTIVE 0 appserver.localdomain Precise - tpm.focal 576 10875 PRECISE_PMDB INACTIVE 0 appserver.localdomain Precise - pw.fp 1147 8843 PRECISE_PMDB INACTIVE 0 appserver.localdomain Precise - pw.fp 1148 10771 PRECISE_PMDB INACTIVE 0 appserver.localdomain Precise - pw.fp 1718 4139 PRECISE_PMDB INACTIVE 0 appserver.localdomain Precise - pw.fp 573 11455 PRECISE_PMDB INACTIVE 0 appserver.localdomain Precise - insight.agents.collector 1145 3663 PRECISE_PMDB INACTIVE 0 appserver.localdomain Precise - pw.fp 1714 1437 PRECISE_PMDB INACTIVE 0 appserver.localdomain Precise - pw.fp 13 10617 PRECISE_PMDB INACTIVE 0 appserver.localdomain Precise - main 11 351 PRECISE_PMDB INACTIVE 0 WORKGROUP\LIRG-PC sqlplus.exe 1721 3329 HR INACTIVE 0 MACHINE PROGRAM SID SERIAL# USERNAME STATUS COMMAND ---------------------------------------------------------------- ------------------------------------------------ ---------- ---------- ------------------------------ -------- ---------- appserver.localdomain JDBC Thin Client 1143 16859 GSFUNDWEB INACTIVE 0 appserver.localdomain JDBC Thin Client 1716 1771 GSFUND INACTIVE 0 WORKGROUP\WIN-1ULNF5AQ5T2 w3wp.exe 575 1451 ARCER INACTIVE 0 36 rows selected. SQL>