SQL> select * from v$mystat where rownum<2; SID STATISTIC# VALUE ---------- ---------- ---------- 1 0 0 SQL> exec test_prc ; SQL> select * from v$mystat where rownum<2; SID STATISTIC# VALUE ---------- ---------- ---------- 41 0 0 SQL> alter procedure test_prc compile; SQL> col event format a20 SQL> SELECT sid, event, p1, p1raw, TO_CHAR(p1, 'xxxxxxxx') p1_16, --P1RAW P1_16, p2, p2raw, p3, p3raw FROM v$session_wait WHERE event LIKE 'library cache pin%'; 2 3 4 5 6 7 8 9 10 11 12 SID EVENT P1 P1RAW P1_16 P2 P2RAW P3 P3RAW ---------- -------------------- ---------- ---------------- --------- ---------- ---------------- ---------- ---------------- 41 library cache pin 737184124 000000002BF0897C 2bf0897c 956793292 00000000390781CC 3.3599E+14 0001319500010003 SQL> SELECT s.sid, kglpnmod "Mode", kglpnreq "Req",p.kglpnhdl FROM x$kglpn p, v$session s WHERE p.kglpnuse=s.saddr and p.kglpnhdl = '2BF0897C' 2 3 4 ; SID Mode Req KGLPNHDL ---------- ---------- ---------- -------- 41 0 3 2BF0897C 1 2 0 2BF0897C 查看SESSION 1操作: SQL> select sql_text from v$sqlarea where (address, hash_value) in (select /*+unnest*/ DECODE(sql_hash_value, 0, prev_sql_addr, sql_address), DECODE(sql_hash_value, 0, prev_hash_value, sql_hash_value) from v$session where sid = 1) 2 3 4 5 6 7 8 ; SQL_TEXT ------------------------------------------------------------------------------------------------------------------------------------------------------------ -------------------------------------------- INSERT INTO TEST1 SELECT * FROM TEST1 SESSION 41: SQL> select sql_text from v$sqlarea where (address, hash_value) in (select /*+unnest*/ DECODE(sql_hash_value, 0, prev_sql_addr, sql_address), DECODE(sql_hash_value, 0, prev_hash_value, sql_hash_value) from v$session where sid = 41) 2 3 4 5 6 7 8 ; SQL_TEXT ------------------------------------------------------------------------------------------------------------------------------------------------------------ -------------------------------------------- alter procedure test_prc compile --P1RAW P1_16 SELECT s.sid, kglpnmod "Mode", kglpnreq "Req",p.kglpnhdl FROM x$kglpn p, v$session s WHERE p.kglpnuse=s.saddr AND kglpnhdl='&P1RAW' 这里的P1RAW就是P1_16 在这个输出中,P1 列是Library Cache Handle Address,Pn字段是10进制表示,PnRaw字段是16进制表示