dba_hist_active_sess_history中p2列列值換算為sid的步驟
來源:程序員人生 發布時間:2015-05-06 08:36:24 閱讀次數:5399次
在帖子“1次cursor: pin S wait on X事件的跟蹤 ”(http://blog.csdn.net/msdnchina/article/details/45372011)中,有1個知識點,原作者沒有寫出計算進程:
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
另外的1個知識點:
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進制
生活不易,碼農辛苦
如果您覺得本網站對您的學習有所幫助,可以手機掃描二維碼進行捐贈