[20160516]SQL共享光标的测试疑问.txt

[20160516]SQL共享光标的测试疑问.txt

--昨天我看了链接http://blog.itpub.net/17203031/viewspace-754994/,感觉他的测试有问题,不可能相同的sql语句,而sql_id会不一样
--的.我自己测试看看.

1.环境:

SYS@book> @ &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

--分别以sys,scott用户建立表T:
create table t as select * from dba_objects;

2.测试

--sys用户:
select /*+ DEMO */count(*) from t where owner='SCOTT';
--sql_id='0cmtuq6zf22px'

--SCOTT用户:
select /*+ DEMO */count(*) from t where owner='SCOTT';
--sql_id='0cmtuq6zf22px'

SYS@book> select sql_id, version_count, executions, USERS_EXECUTING, PARSING_SCHEMA_NAME from v$sqlarea where sql_text like 'select /*+ DEMO */%';
SQL_ID        VERSION_COUNT EXECUTIONS USERS_EXECUTING PARSING_SCHEMA_NAME
------------- ------------- ---------- --------------- --------------------
0cmtuq6zf22px             2          2               0 SCOTT

SYS@book> select sql_id, child_number , executions, USERS_EXECUTING, PARSING_SCHEMA_NAME from v$sql where sql_text like 'select /*+ DEMO */%';
SQL_ID        CHILD_NUMBER EXECUTIONS USERS_EXECUTING PARSING_SCHEMA_NAME
------------- ------------ ---------- --------------- --------------------
0cmtuq6zf22px            0          1               0 SYS
0cmtuq6zf22px            1          1               0 SCOTT

--而作者的测试居然不一样.感觉非常奇怪.这让我突然想起toad的老版本会在sql语句上自动补一个空格,感觉作者应该会使用PLSQL
--Developer,我也测试看看:

SYS@book> select sql_id, child_number , executions, USERS_EXECUTING, PARSING_SCHEMA_NAME from v$sql where sql_text like 'select /*+ DEMO */%';
SQL_ID        CHILD_NUMBER EXECUTIONS USERS_EXECUTING PARSING_SCHEMA_NAME
------------- ------------ ---------- --------------- ------------------------------
gp5x6kaz2whwu            0          1               0 SCOTT
0cmtuq6zf22px            0          1               0 SYS
0cmtuq6zf22px            1          1               0 SCOTT

--很明显PLSQL Developer也会"格式化脚本".

SYS@book> select sql_id, dump(sql_text,16) c100 ,child_number , executions, USERS_EXECUTING, PARSING_SCHEMA_NAME from v$sql where sql_text like 'select /*+ DEMO */%';
SQL_ID        C100                                                                                                 CHILD_NUMBER EXECUTIONS USERS_EXECUTING PARSING_SCHEMA_NAME
------------- ---------------------------------------------------------------------------------------------------- ------------ ---------- --------------- ------------------------------
gp5x6kaz2whwu Typ=1 Len=54: 73,65,6c,65,63,74,20,2f,2a,2b,20,44,45,4d,4f,20,2a,2f,63,6f,75,6e,74,28,2a,29,20,66,72            0          1               0 SCOTT
              ,6f,6d,20,74,20,77,68,65,72,65,20,6f,77,6e,65,72,3d,27,53,43,4f,54,54,27,20

0cmtuq6zf22px Typ=1 Len=53: 73,65,6c,65,63,74,20,2f,2a,2b,20,44,45,4d,4f,20,2a,2f,63,6f,75,6e,74,28,2a,29,20,66,72            0          1               0 SYS
              ,6f,6d,20,74,20,77,68,65,72,65,20,6f,77,6e,65,72,3d,27,53,43,4f,54,54,27

0cmtuq6zf22px Typ=1 Len=53: 73,65,6c,65,63,74,20,2f,2a,2b,20,44,45,4d,4f,20,2a,2f,63,6f,75,6e,74,28,2a,29,20,66,72            1          1               0 SCOTT
              ,6f,6d,20,74,20,77,68,65,72,65,20,6f,77,6e,65,72,3d,27,53,43,4f,54,54,27

--很明显PLSQL Developer也会在后面加一个空格.但是我无法得到作者测试5x21uhnky7bnb.
--BTW 我的PLSQL Developer版本是6.0.0.840.

SYS@book> @ &r/share 0cmtuq6zf22px
SQL_TEXT                       = select /*+ DEMO */count(*) from t where owner='SCOTT'
SQL_ID                         = 0cmtuq6zf22px
ADDRESS                        = 000000007D487178
CHILD_ADDRESS                  = 000000007D9B7150
CHILD_NUMBER                   = 0
REASON                         = <ChildNode><ChildNumber>0</ChildNumber><ID>37</ID><reason>Authorization Check
failed(4)</reason><size>5x4</size><translation_table_position>0</translation_table_position><original_handle>2120444968</original_handle><temp_handle>2101839128</temp_handle><schema>83</schema><synonym_object_number>0</synonym_object_number></ChildNode>
--------------------------------------------------
SQL_TEXT                       = select /*+ DEMO */count(*) from t where owner='SCOTT'
SQL_ID                         = 0cmtuq6zf22px
ADDRESS                        = 000000007D487178
CHILD_ADDRESS                  = 000000007D456048
CHILD_NUMBER                   = 1
AUTH_CHECK_MISMATCH            = Y
TRANSLATION_MISMATCH           = Y
REASON                         =
--------------------------------------------------

PL/SQL procedure successfully completed.

时间: 2024-09-30 05:10:45

[20160516]SQL共享光标的测试疑问.txt的相关文章

[20171028]测试大量子光标对性能影响.txt

[20171028]测试大量子光标对性能影响.txt --//做一个测试例子说明存在大量子光标对性能影响. 1.环境: SCOTT@test01p> @ ver1 PORT_STRING                    VERSION        BANNER                                                                               CON_ID ------------------------------

[20170515]数据库启动的一个疑问.txt

[20170515]数据库启动的一个疑问.txt --//别人问的问题我自己以前也没有注意,做一个记录. 1.环境: SYS@book> startup   mount ORACLE instance started. Total System Global Area  634732544 bytes Fixed Size                  2255792 bytes Variable Size             197133392 bytes Database Buffe

[20160830]使用共享服务模式的弊端.txt

[20160830]使用共享服务模式的弊端.txt --使用专用服务器与共享服务模式的区别,有许多文章介绍,专用服务器是1:1,而共享服务模式可以1对多,这样可以减少服务器对内存资源 --的占用.但是共享服务模式存在一些弊端的,一旦某个session执行很慢,这样就会影响其他用户的回话. --通过例子来说明: 1.环境: SCOTT@book> @ &r/ver1 PORT_STRING                    VERSION        BANNER -----------

[20160606]windows下使用bbed的疑问.txt

[20160606]windows下使用bbed的疑问.txt --链接:http://blog.itpub.net/267265/viewspace-2109019/        http://blog.itpub.net/267265/viewspace-2109558/ --我曾经提到要访问的块要+1,比如: SCOTT@book> @ &r/ver1 PORT_STRING                    VERSION        BANNER -------------

SQL Server页类型汇总+疑问

原文:SQL Server页类型汇总+疑问 该文章整理自:http://www.sqlnotes.info/2011/10/31/page-type/             SQL Server中包含多种不同类型的页,来满足数据存储的需求.不管是什么类型的页,它们的存储结构都是相同的.每个数据文件都包含相当数量的由8KB组成的页,即每页有8192bytes可用,每页都有96byte用于页头的存储,剩下的空间 才用来存储实际的数据,在页的最后是数据行偏移数组,也可以叫"页槽"数组,我们

[20171130]关于rman备份疑问.txt

[20171130]关于rman备份疑问.txt --//前面测试太乱,重新做一些rman as copy相关测试. 1.环境: SCOTT@book> @ &r/ver1 PORT_STRING                    VERSION        BANNER ------------------------------ -------------- --------------------------------------------------------------

[20171115]关于逻辑读的疑问.txt

[20171115]关于逻辑读的疑问.txt --//有网友指出[20150209]为什么少1个逻辑读.txt,链接:http://blog.itpub.net/267265/viewspace-1430902/ --//如何验证是这样操作的. 1.环境: SCOTT@test> @ver1 PORT_STRING                    VERSION        BANNER ------------------------------ -------------- ----

[20171206]设置db_2k_cache_size的疑问.txt

[20171206]设置db_2k_cache_size的疑问.txt --//上午测试最小的数据文件,我想看看2k数据块能建议多小的数据文件,我的测试最小10K,但是遇到1个无法理解的问题. 1.环境: SYS@book> @ &r/ver1 PORT_STRING                    VERSION        BANNER ------------------------------ -------------- --------------------------

[20170407]关于增量检查点的一个疑问.txt

[20170407]关于增量检查点的一个疑问.txt --//oracle现在写脏块基本采用增量检查点,除非执行alter system checkpoint,或者shutdown immediate(normal)正常关闭数据库. --//别人的疑问,如果如果写增量检查点时,current log tail at RBA=Incremental checkpoint up to RBA时,如下情况 1.环境: SYS@book> @ &r/ver1 PORT_STRING