To convert P2 column column values in Dba_hist_active_sess_history to SIDs

Source: Internet
Author: User

In the post "one Cursor:pin S wait on X event tracking" (http://blog.csdn.net/msdnchina/article/details/45372011), there is a knowledge point where the original author did not write the calculation process:

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; query results, we analyze p2=21333102559232, the first two bytes data is 4967 Note: temp_ Hist_active_sess_history's build statement is: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 ';


Let's analyze p2=21333102559232 (P2 is 10 binary), the first two bytes of data is 4967--the calculation process is as follows:

--Convert to 16 binary select To_char (21333102559232, ' xxxxxxxxxxxxxxxxxxxxxxxxxxxx ') from dual; ------return 136700000000, high-fill 4 0:0000136700000000 take high 8bytes:00001367select to_number (' 00001367 ', ' Xxxxxxxxxxxxxxxxxxxxxxxxxxxxx ') from dual; ------returns 4967


Another point of knowledge:
In the Dba_hist_active_sess_history view:
No P1raw column (for 16 binary), only P1 column, p1 column number type, 10 binary,
No P2raw column (for 16 binary), only P2 column, p2 column number type, 10 binary;
No P3raw column (for 16 binary), only P3 column, p3 column number type, 10 binary;


In the V$session and v$session_wait views:
There are p1raw columns (for 16 binary), P1 columns, p1 column number type, 10 binary,
There are p2raw columns (for 16 binary), p2 column, p2 column number type, 10 binary;
P3raw column (16 binary), p3 column, p3 column number type, 10 binary

To convert P2 column column values in Dba_hist_active_sess_history to SIDs

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.