在帖子“一次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进制
dba_hist_active_sess_history中p2列列值换算为sid的步骤
原文地址:http://blog.csdn.net/msdnchina/article/details/45372355