- 最后登录
- 2023-8-16
- 在线时间
- 1686 小时
- 威望
- 2135
- 金钱
- 50532
- 注册时间
- 2011-10-12
- 阅读权限
- 200
- 帖子
- 5207
- 精华
- 39
- 积分
- 2135
- UID
- 2
|
2#
发表于 2012-3-15 20:49:53
ODM Finding:- H$PSEUDO_CURSOR
- Applies to:
- Oracle Server - Enterprise Edition - Version: 10.2.0.1 and later [Release: 10.2 and later ]
- Information in this document applies to any platform.
- 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.
- Software Requirements/Prerequisites
- Run from SQL*Plus.
- Configuring the Script
- The script needs to be run as the SYS user, to create the view.
- Running the Script
- 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 script is provided for educational purposes only and not supported by Oracle Support Services. It has been tested internally, however, and works as documented. We do not guarantee that it will work for you, so be sure to test it in your environment before relying on it.
- Proofread this script before using it! Due to the differences in the way text editors, e-mail packages and operating systems handle text formatting (spaces, tabs and carriage returns), this script may not be in an executable state when you first receive it. Check over the script to ensure that errors of this type are corrected.
- 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.
- Script 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$
复制代码 |
|