[20170904]11Gr2 查询光标为什么不共享脚本.txt

--//参考链接下面的注解脚本:
https://carlos-sierra.net/2017/09/01/poors-man-script-to-summarize-reasons-why-cursors-are-not-shared/

--//做一个记录.

[email protected]> @ &r/ver1
PORT_STRING                    VERSION        BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx            11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

/* Formatted on 2017/9/4 9:54:31 (QP5 v5.252.13127.32867) */
  SELECT    ‘select reason_not_shared, count(*) cursors, count(distinct sql_id) sql_ids
from v$sql_shared_cursor
unpivot(val for reason_not_shared in(

         || LISTAGG
            (
                  ‘  ‘
               || LISTAGG (column_name, ‘,‘) WITHIN GROUP (ORDER BY column_id)
              ,‘,

            )
            WITHIN GROUP (ORDER BY line_no)
         || ‘
))
where val = ‘‘Y‘‘
group by reason_not_shared
order by 2 desc, 3, 1;‘
            sql_text
    FROM (SELECT column_name
                ,column_id
                ,CEIL (ROW_NUMBER () OVER (ORDER BY column_id) / 4) line_no
            FROM dba_tab_columns
           WHERE     owner = ‘SYS‘
                 AND table_name = ‘V_$SQL_SHARED_CURSOR‘
                 AND data_length = 1)
GROUP BY line_no;

--//生成的脚本如下:
select reason_not_shared, count(*) cursors, count(distinct sql_id) sql_ids
from v$sql_shared_cursor
unpivot(val for reason_not_shared in(
  UNBOUND_CURSOR,SQL_TYPE_MISMATCH,OPTIMIZER_MISMATCH,OUTLINE_MISMATCH,
  STATS_ROW_MISMATCH,LITERAL_MISMATCH,FORCE_HARD_PARSE,EXPLAIN_PLAN_CURSOR,
  BUFFERED_DML_MISMATCH,PDML_ENV_MISMATCH,INST_DRTLD_MISMATCH,SLAVE_QC_MISMATCH,
  TYPECHECK_MISMATCH,AUTH_CHECK_MISMATCH,BIND_MISMATCH,DESCRIBE_MISMATCH,
  LANGUAGE_MISMATCH,TRANSLATION_MISMATCH,BIND_EQUIV_FAILURE,INSUFF_PRIVS,
  INSUFF_PRIVS_REM,REMOTE_TRANS_MISMATCH,LOGMINER_SESSION_MISMATCH,INCOMP_LTRL_MISMATCH,
  OVERLAP_TIME_MISMATCH,EDITION_MISMATCH,MV_QUERY_GEN_MISMATCH,USER_BIND_PEEK_MISMATCH,
  TYPCHK_DEP_MISMATCH,NO_TRIGGER_MISMATCH,FLASHBACK_CURSOR,ANYDATA_TRANSFORMATION,
  PDDL_ENV_MISMATCH,TOP_LEVEL_RPI_CURSOR,DIFFERENT_LONG_LENGTH,LOGICAL_STANDBY_APPLY,
  DIFF_CALL_DURN,BIND_UACS_DIFF,PLSQL_CMP_SWITCHS_DIFF,CURSOR_PARTS_MISMATCH,
  STB_OBJECT_MISMATCH,CROSSEDITION_TRIGGER_MISMATCH,PQ_SLAVE_MISMATCH,TOP_LEVEL_DDL_MISMATCH,
  MULTI_PX_MISMATCH,BIND_PEEKED_PQ_MISMATCH,MV_REWRITE_MISMATCH,ROLL_INVALID_MISMATCH,
  OPTIMIZER_MODE_MISMATCH,PX_MISMATCH,MV_STALEOBJ_MISMATCH,FLASHBACK_TABLE_MISMATCH,
  LITREP_COMP_MISMATCH,PLSQL_DEBUG,LOAD_OPTIMIZER_STATS,ACL_MISMATCH,
  FLASHBACK_ARCHIVE_MISMATCH,LOCK_USER_SCHEMA_FAILED,REMOTE_MAPPING_MISMATCH,LOAD_RUNTIME_HEAP_FAILED,
  HASH_MATCH_FAILED,PURGED_CURSOR,BIND_LENGTH_UPGRADEABLE,USE_FEEDBACK_STATS
))
where val = ‘Y‘
group by reason_not_shared
order by 2 desc, 3, 1;

--//输出例子:
REASON_NOT_SHARED             CURSORS   SQL_IDS                               
--------------------------------------------------
LANGUAGE_MISMATCH             5928      3733                                  
USE_FEEDBACK_STATS            3923      3305                                  
BIND_LENGTH_UPGRADEABLE       1161      855                                   
BIND_MISMATCH                 376       352                                   
PURGED_CURSOR                 248       177                                   
BIND_EQUIV_FAILURE            207       150                                   
BIND_UACS_DIFF                120       120                                   
LOAD_OPTIMIZER_STATS          88        78                                    
USER_BIND_PEEK_MISMATCH       30        18                                    
OPTIMIZER_MISMATCH            26        13                                    
HASH_MATCH_FAILED             25        25                                    
AUTH_CHECK_MISMATCH           23        15                                    
OPTIMIZER_MODE_MISMATCH       18        14                                    
TRANSLATION_MISMATCH          16        11                                    
TOP_LEVEL_RPI_CURSOR          11        9                                     
INSUFF_PRIVS_REM              7         4                                     
INCOMP_LTRL_MISMATCH          4         4                                     
PLSQL_CMP_SWITCHS_DIFF        4         4                                     
INST_DRTLD_MISMATCH           3         3                                     
INSUFF_PRIVS                  2         2                                     
TOP_LEVEL_DDL_MISMATCH        2         2                                     
MULTI_PX_MISMATCH             1         1                                     
PQ_SLAVE_MISMATCH             1         1                                     
ROLL_INVALID_MISMATCH         1         1

时间: 2024-10-03 23:20:00

[20170904]11Gr2 查询光标为什么不共享脚本.txt的相关文章

DOS命令将黑框中查询到的信息保存到TXT等文件中

DOS命令将黑框中查询到的信息保存到TXT等文件中,布布扣,bubuko.com

查询指定网段可用IP脚本

1.脚本内容: #vi hhh 添加以下内容: #!/bin/bash read -p "Please keyin the network segment: (e.g. 10.88.1) " farm for i in `seq 2 255` do ip="$farm.$i" ping -c 3 $ip &> /dev/null if [ $? -eq 0 ];then echo -e "$ip is \e[32mUp\e[0m"

自动部署Samba共享脚本

基本的都有,需要使用的拿出来组合 匿名的 Samba共享的服务端软件为samba.客户端软件为samba-client yum -y install samba samba-client sed -i '/workgroup/s/MYGROUP/WORKGROUP/' /etc/samba/smb.conf #融入Windows网络的默认工作组WORKGROUP sed -i '/server string = Samba Server Version %v/s/Samba Server Ver

ldd查询命令或软件共享的函数库(动态)

<1> ldd - print shared library dependencies SYNOPSIS ldd [OPTION]... FILE... DESCRIPTION ldd prints the shared libraries required by each program or shared library speci- fied on the command line. eg: 测试ldd命令sshd和httpd两个程序是否支持TCP Wrappers的功能? [[emai

sql server 查询阻塞的query的脚本

原文链接:http://blog.sqlauthority.com/2010/10/06/sql-server-quickest-way-to-identify-blocking-query-and-resolution-dirty-solution/ SELECTdb.name DBName,tl.request_session_id,wt.blocking_session_id,OBJECT_NAME(p.OBJECT_ID) BlockedObjectName,tl.resource_ty

[20180814]慎用查看表压缩率脚本.txt

--//最近看exadata方面书籍,书中提供1个脚本,查看某些表采用那些压缩模式压缩比能达到多少.--//通过调用DBMS_COMPRESSION.get_compression_ratio确定压缩比.例子如下: --//测试版本11.2.0.4.declare        blockct_comp    number;        blockct_uncomp  number;        rows_comp       number;        rows_uncomp     n

DOS命令将黑框中查询到的信息保存到TXT等文件里

通过异类查询(OpenDataSource)把外部数据(Excel,TXT)导入到SqlServer

无论用sqlcmd或者通过C#逻辑处理,或者还是直接在SqlServer里执行操作,个人总结大概不过可归总为这两种方式: 1,SSIS: 2,OLEDB驱动引擎. SSIS实在也好用,现在这里先不去讨论.其中大多数人用的都是第二种方法,下面,本人也以第二种方法在SqlServer里导入excel和txt格式文件的具体实例来说明怎样在项目里灵活通过OLEDB导入数据! 一,必要的环境说明 本实例用sql语句在SqlServer里面完成对数据的导入操作. 在本实例开始之前,可能需要先安装Access

crm查询记录共享给了哪些人

有时候,我们须要查询一个记录.共享给了哪些人?怎么做? 第一种做法:是sql的方式 select * from PrincipalObjectAccess where objectid = '522626B1-D10C-E411-80FF-00155D002F02' select u.FullName,sup.SystemUserId,POA.ObjectId,AccessRightsMask from PrincipalObjectAccess POA inner join SystemUse