首页 > 数据库 >Oracle mos文档关于视图v$open_cursor中说法矛盾

Oracle mos文档关于视图v$open_cursor中说法矛盾

时间:2023-04-18 16:33:29浏览次数:74  
标签:SYS mos CURSOR 视图 cursor select open 171

 

Oracle mos文档关于视图v$open_cursor中矛盾说法

 

How to Monitor and tune Open and Cached Cursors (文档 ID 1430255.1)中指出:

v$open_cursor shows cached cursors, not currently open cursors, by session. If you are wondering how many cursors a session has open, do not look in v$open_cursor. It shows the cursors in the session cursor cache for each session, not cursors that are actually open.

谷歌翻译:v$open_cursor 按会话显示缓存的游标,而不是当前打开的游标。如果您想知道一个会话打开了多少个游标,请不要查看 v$open_cursor。它显示每个会话的会话游标缓存中的游标,而不是实际打开的游标。

 

V$OPEN_CURSOR HAVING SQL_IDs WHICH DO NOT EXIST IN V$SQLAREA (文档 ID 838321.1)中指出:

Basically v$open_cursor view lists cursors that each user session currently has opened and parsed.

谷歌翻译:基本上 v$open_cursor 视图列出了每个用户会话当前已打开和解析的游标。

 

 1430255.1一文中表示v$open_cursor只是显示了缓存的游标,而不是当前打开的游标,实际上在官档对V$OPEN_CURSOR的字段CURSOR_TYPE就有说明:

Type of cursor:

  • OPEN PL/SQL - Open PL/SQL cursors

  • OPEN - Other open cursors

  • SESSION CURSOR CACHED - Cursors cached in the generic session cursor cache

  • OPEN RECURSIVE - Open recursive cursors

  • DICTIONARY LOOKUP CURSOR CACHED - Cursors cached in the dictionary lookup cursor cache

  • BUNDLE DICTIONARY LOOKUP CACHED - Cursors cached in the bundled dictionary lookup cursor cache

  • JAVA NAME TRANSLATION CURSOR CACHED - Cursors cached in the Java name translation cursor cache

  • REPLICATION TRIGGER CURSOR CACHED - Cursors cached in the replication trigger cursor cache

  • CONSTRAINTS CURSOR CACHED - Cursors cached in the constraints cursor cache

  • PL/SQL CURSOR CACHED - Cursors cached in the PL/SQL cursor cache

结合838321.1看,838321.1的说法更加准确,v$open_cursor 视图列出了每个用户会话当前已打开和解析的游标。

做个简单的实验,打开两个会话sid171,sid321:

variable x refcursor;
variable z refcursor;
variable b refcursor;
variable a refcursor;
exec open :x for select * from dual;
exec open :z for select * from dual;
exec open :b for select * from dual;
exec open :a for select * from dual;
模板复制

 

--sid321查看sid171初始化信息:
16:39:52 SYS@zkmdb(321)> col user_name for a10
16:39:52 SYS@zkmdb(321)> col CURSOR_TYPE for a35
16:39:52 SYS@zkmdb(321)> col sql_text for a60
16:39:52 SYS@zkmdb(321)> select  * from v$open_cursor where sid=171;

SADDR            SID USER_NAME  ADDRESS          HASH_VALUE SQL_ID          SQL_TEXT                                                     LAST_SQL_ACTIVE_TIM SQL_EXEC_ID CURSOR_TYPE
---------------- --- ---------- ---------------- ---------- --------------- ------------------------------------------------------------ ------------------- ----------- -----------------------------------
0000000A5D197FC8 171 SYS        0000000A5903FDC0 1950821498 459f3z9u4fb3u   select value$ from props$ where name = 'GLOBAL_DB_NAME'                                      DICTIONARY LOOKUP CURSOR CACHED
0000000A5D197FC8 171 SYS        0000000A58F72A80 2194907850 0ws7ahf1d78qa   select SYS_CONTEXT('USERENV', 'SERVER_HOST'), SYS_CONTEXT(                                   DICTIONARY LOOKUP CURSOR CACHED
0000000A5D197FC8 171 SYS        0000000A58EA14E8 3686391781 22ghqa7dvmrz5   SELECT trim(USERENV('SID')) global_name FROM DUAL                                            OPEN

Elapsed: 00:00:00.04

--sid171打开4个游标不关闭:
16:39:48 SYS@zkmdb(171)> variable x refcursor;
16:41:05 SYS@zkmdb(171)> variable z refcursor;
16:41:05 SYS@zkmdb(171)> variable b refcursor;
16:41:05 SYS@zkmdb(171)> variable a refcursor;
16:41:05 SYS@zkmdb(171)> exec open :x for select * from dual;

PL/SQL procedure successfully completed.

Elapsed: 00:00:00.00
16:41:05 SYS@zkmdb(171)> exec open :z for select * from dual;

PL/SQL procedure successfully completed.

Elapsed: 00:00:00.00
16:41:05 SYS@zkmdb(171)> exec open :b for select * from dual;

PL/SQL procedure successfully completed.

Elapsed: 00:00:00.00
16:41:05 SYS@zkmdb(171)> exec open :a for select * from dual;

PL/SQL procedure successfully completed.

Elapsed: 00:00:00.00

--sid321再次查看sid171信息:
16:41:40 SYS@zkmdb(321)> select  * from v$open_cursor where sid=171;

SADDR            SID USER_NAME  ADDRESS          HASH_VALUE SQL_ID          SQL_TEXT                                                     LAST_SQL_ACTIVE_TIM SQL_EXEC_ID CURSOR_TYPE
---------------- --- ---------- ---------------- ---------- --------------- ------------------------------------------------------------ ------------------- ----------- -----------------------------------
0000000A5D197FC8 171 SYS        00000009C2371FF8 3991932091 9g6pyx7qz035v   SELECT * FROM DUAL                                                                  16777235 OPEN
0000000A5D197FC8 171 SYS        00000009C2371FF8 3991932091 9g6pyx7qz035v   SELECT * FROM DUAL                                                                  16777234 OPEN
0000000A5D197FC8 171 SYS        00000009C2371FF8 3991932091 9g6pyx7qz035v   SELECT * FROM DUAL                                                                  16777233 OPEN
0000000A5D197FC8 171 SYS        00000009C2371FF8 3991932091 9g6pyx7qz035v   SELECT * FROM DUAL                                                                  16777232 OPEN
0000000A5D197FC8 171 SYS        00000009C24530A0 2731315891 0zb36tajct4pm   BEGIN open :z for select * from dual; END;                                                   DICTIONARY LOOKUP CURSOR CACHED
0000000A5D197FC8 171 SYS        00000009C22FEC88 4171414172 dgw83r3wa5fnw   BEGIN open :a for select * from dual; END;                                                   OPEN
0000000A5D197FC8 171 SYS        00000009C15C9F60 1491910523 19z2ty5cftgvv   BEGIN open :b for select * from dual; END;                                                   DICTIONARY LOOKUP CURSOR CACHED
0000000A5D197FC8 171 SYS        00000009C18CA5F8 1931145668 8vn7mxdtjpwf4   BEGIN open :x for select * from dual; END;                                                   DICTIONARY LOOKUP CURSOR CACHED
0000000A5D197FC8 171 SYS        0000000A5903FDC0 1950821498 459f3z9u4fb3u   select value$ from props$ where name = 'GLOBAL_DB_NAME'                                      DICTIONARY LOOKUP CURSOR CACHED
0000000A5D197FC8 171 SYS        0000000A58F72A80 2194907850 0ws7ahf1d78qa   select SYS_CONTEXT('USERENV', 'SERVER_HOST'), SYS_CONTEXT(                                   DICTIONARY LOOKUP CURSOR CACHED
0000000A5D197FC8 171 SYS        0000000A58EA14E8 3686391781 22ghqa7dvmrz5   SELECT trim(USERENV('SID')) global_name FROM DUAL                                            DICTIONARY LOOKUP CURSOR CACHED

11 rows selected.

Elapsed: 00:00:00.04
16:41:41 SYS@zkmdb(321)> select * from v$sesstat where sid=171 and statistic#=5;

       SID STATISTIC# VALUE
---------- ---------- -----
       171          5     5

Elapsed: 00:00:00.01

 

由此可见,v$open_cursor确实包含当前打开或者已缓存的游标信息。

 

ORA-01000 : Troubleshooting Open Cursors Issues (文档 ID 1477783.1)则更是重量级:

  • Now one can see which all queries are causing maxing out of open cursors using below Sql:(谷歌翻译:现在可以使用以下 Sql 查看哪些所有查询导致打开的游标最大化:
select  sid ,sql_text, user_name, count(*) as "OPEN CURSORS" from v$open_cursor where sid in ($SID) group by sid ,sql_text, user_name;

count(*) as "OPEN CURSORS"..........

这缓存的游标也不能算是OPEN的游标啊..........

防爬虫:https://www.cnblogs.com/PiscesCanon/p/17330147.html

标签:SYS,mos,CURSOR,视图,cursor,select,open,171
From: https://www.cnblogs.com/PiscesCanon/p/17330147.html

相关文章

  • Django视图类中标准导出Excel文件模版(自用)
    一、导出基类、Excel文件处理和保存importhashlibimportosimporttimeimportxlsxwriterfromapplicationimportsettingsfromapps.web.op_drf.filtersimportDataLevelPermissionsFilterfromapps.web.op_drf.responseimportSuccessResponsefromapps.web.wsys......
  • pg 物化视图相关
    一、物化视图简介类似oracle,pg的物化视图也是物理是实际存在的表。在执行某些查询时效率较低,而且使用传统方法(例如索引)无法显著提高效率,这时常用的方法是将需要查询的数据事先查好并储存起来,这样就不需要每次查询都从头执行一次。这种“缓存”机制其实就是物化视图。CREATEMA......
  • [AGC061D] Almost Multiplication Table
    人类智慧。答案显然具有可二分性,考虑如何check。我们使用调整法,不妨设\(x_n<y_m\)(反着做同理),一开始我们令\(x_i=1,y_i=+\infty\)。每次我们期望让\(x\)不断变大,\(y\)不断变小,不断将它们调整到当前的上下界。具体的,每次令\(x_i=\max\{x_i,\max\lceil{a_{i,j}-k\overy......
  • 锂电池3.7V升5V/5A内置MOS大电流升压IC型号推荐FS2116B
    电源电路是电子产品中必不可少的部分。然而不同的器件或者模块工作电压不一样,所以DC-DC电压转换电路应用中十分常见。例如便携式电子产品,一般都内置电池,如果是单节锂电3.7V供电,通过DC-DC升压电路,从3.7V升压到5V、8V、9V、12V等再给其他电路供电。升压电路属于开关型电路,最关心的就......
  • ArcPy 批处理之 [ hdf转tif ]; [ Con函数 ]; 镶嵌至新栅格 [ Mosaic to New Raster ];
    一、 ArcPy批量将文件夹内的*.hdf文件转为*.tif 文件:#encoding:utf-8 ##hdf2tifimportarcpyimportosinPath=r'E:\Data\S00_DataHdf\\'outPath=r'E:\Data\S01_DataTif\\'fordirpath,dirnames,filenamesinos.walk(inPath):......
  • oracle open_cursor监控
    SELECTmax(a.value)ashighest_open_cur,p.valueasmax_open_curFROMv$sesstata,v$statnameb,v$parameterpWHEREa.statistic#=b.statistic#andb.name='openedcursorscurrent'andp.name='open_cursors'groupbyp.value;mos......
  • Oracle 物化视图
    oracle中常常会用物化视图来同步数据或者迁移数据。在dbms_mview中刷新过程,可以使用并行刷新的特性,这样有效的减少了完全刷新的时间。dbms_mview('表名','F')快速刷新,也是增量刷新,即只对异动数据进行刷新dbms_mview('表名','C')完全刷新步骤:creatematerializedviewl......
  • vscode number of cursors limited to 10000 bug All In One
    vscodenumberofcursorslimitedto10000bugAllInOnevscode全局替换光标限制最多10000个❌demos$manopenssl>man-openssl.md#全选"替换,报错提示信息❌#❌$openssl--version#✅$opensslversionLibreSSL3.3.6(......
  • CMOS与TTL(下):TTL、CMOS
    如果只看一个芯片的外观,是无法区分TTL和CMOS的。因为它们是按照芯片的制作工艺来分类的。CMOS内部集成的是MOS管,而TTL内部集成的是三极管。TTL晶体管-晶体管逻辑(英语:Transistor-TransistorLogic,缩写为TTL)最开始的是RTLResistor–transistorlogic:电阻三极管逻辑。RTL速度慢且不稳......
  • MOS管常用效应
    沟道长度调制效应(channellengthmodulation)短沟道情况,沟道长度调制效应越明显,λ越小,Id越大MOS晶体管中,栅下沟道预夹断后,若继续增大Vds,夹断点会略向源极方向移动,导致夹断点到源极之间的沟道长度略有减小,有效沟道电阻也就略有减小,从而使更多电子自源极漂移到夹断点,导致在耗尽区......