H$PSEUDO_CURSOR (文档 ID 1298471.1)

APPLIES TO:

Oracle Database - Enterprise Edition - Version 10.2.0.1 and later
Information in this document applies to any platform.
***Checked for relevance on 5-Nov-2012***

PURPOSE

Pseudo cursors are structures to provide direct access to schema objects; avoiding the overhead of writing an explicit SELECT statement.

These pseudo cursors show in Enterprise Manager and AWR reports with the legend
"SQL Text Not Available"
 
They are used by internal mechanisms in the RDBMS and cannot be harnessed by the user.
Their most common use is to access data dictionary tables, LOBs , NCHAR, and NVARCHAR2 directly.
WARNING: Querying H$PSEUDO_CURSOR or the X$ views it references can cause severe library cache latch and mutex contention, so it is imperative that it is only used sparingly while diagnosing an issue where pseudo cursors are suspected.

REQUIREMENTS

Run from SQL*Plus.

CONFIGURING

The script needs to be run as the SYS user, to create the view.

INSTRUCTIONS

column HEX_OBJ_ID  format a10
column PSEUDO_CURSOR format a30
column OWNER format a20
select * from h$pseudo_cursor where sql_id='b54441z8q9kk9';

CAUTION

This sample code is provided for educational purposes only, and is not supported by Oracle Support. It has been tested internally, however, we do not guarantee that it will work for you. Ensure that you run it in your test environment before using.

SCRIPT


create or replace view h$pseudo_cursor as
select Pseudo_cursor, sql_id,obj_id hex_obj_id
     ,obj# object_id, u.name owner, o.name object_name
from (select distinct 
             KGLNAOBJ Pseudo_cursor,kglobt03 sql_id
        ,substr(KGLNAOBJ
               ,instr(KGLNAOBJ,'_',1,3)+1
               ,instr(KGLNAOBJ,'_',1,4)-instr(KGLNAOBJ,'_',1,3)-1) obj_id 
       ,(case when 
         replace(translate(substr(upper(KGLNAOBJ)
                                 ,instr(KGLNAOBJ,'_',1,3)+1
                                 ,instr(KGLNAOBJ,'_',1,4)
                                  -instr(KGLNAOBJ,'_',1,3)-1)
                          ,'0123456789ABCDEF','................')
                ,'.') is null then 'Y' else 'N' end) is_safe_to_compare
            from x$kglob) k
   , obj$ o, user$ u
where obj#=decode(is_safe_to_compare,'Y',to_number(obj_id,'xxxxxxxxxx'),0)
   and o.owner#=u.user#;

WARNING: Querying H$PSEUDO_CURSOR or the X$ views it references can cause severe library cache latch and mutex contention, so it is imperative that it is only used sparingly while diagnosing an issue where pseudo cursors are suspected.

SAMPLE OUTPUT

SQL> column HEX_OBJ_ID  format a10
SQL> column PSEUDO_CURSOR format a30
SQL> column OWNER format a20
SQL> select * from h$pseudo_cursor where sql_id='b54441z8q9kk9';

PSEUDO_CURSOR                  SQL_ID        HEX_OBJ_ID  OBJECT_ID OWNER                OBJECT_NAME
------------------------------ ------------- ---------- ---------- -------------------- ------------------------------
table_1_ff_22d_0_0_0           b54441z8q9kk9 22d               557 SYS                  KOTTBX$
 
 

相关内容

   
 
 

产品

   
 
  • Oracle Database Products > Oracle Database > Oracle Database > Oracle Database - Enterprise Edition > RDBMS > Data Definition Language

你可能感兴趣的:(H$PSEUDO_CURSOR (文档 ID 1298471.1))