在帖子“一次cursor: pin S wait on X事件的跟蹤 ”(http://blog.csdn.net/msdnchina/article/details/45372011)中,有一個知識點,原作者沒有寫出計算過程:
SQL> select distinct session_id,session_serial#,p1,p2 2 from temp_hist_active_sess_history 3 where event ='cursor: pin S wait on X' 4 and rownum<=50; 的查詢結果中,我們來分析p2=21333102559232,前兩個字節數據為 4967 注:temp_hist_active_sess_history的建表語句為: SQL> create table temp_hist_active_sess_history nologging as 2 select * from dba_hist_active_sess_history 3 where to_char(sample_time, 'yyyymmddhh24') between '2011030717' and '2011030722';
我們來分析p2=21333102559232(p2為10進制),前兩個字節數據為 4967 --的計算過程如下:
--轉換為16進制 select to_char(21333102559232,'xxxxxxxxxxxxxxxxxxxxxxxxxxxx') from dual; ------返回136700000000,高位補全4個0: 也就是0000136700000000 取高位8bytes:00001367 select to_number('00001367','xxxxxxxxxxxxxxxxxxxxxxxxxxxxx') from dual; ------返回4967
另外的一個知識點:
dba_hist_active_sess_history 視圖中:
沒有p1raw列(為16進制),只有p1列,p1列 number型,為10進制,
沒有p2raw列(為16進制),只有p2列,p2列 number型,為10進制;
沒有p3raw列(為16進制),只有p3列,p3列 number型,為10進制;
v$session 和 v$session_wait 視圖中:
有p1raw列(為16進制),有p1列,p1列 number型,為10進制,
有p2raw列(為16進制),有p2列,p2列 number型,為10進制;
有p3raw列(為16進制),有p3列,p3列 number型,為10進制