[每日一题] 11gOCP 1z0-052 :2013-09-14 repeated parsing activity.................................A70
转载请注明出处:http://blog.csdn.net/guoyjoe/article/details/11699299
正确答案:D
SQL语句的执行过程:
1、客户端输入sql语句update t_gyj set name='gyj1' where id=1;
2、sql语句通过网络到达实例
3、server process接收sql语句,以下是执行一个sql的大致步骤(获取数据(buffer cache-->PGA)-->返数据给用户这一步只有SELECT语句中有,其它DML中没有)
sql-->sql_hash-->shared pool解析(消耗CPU)-->生成执行计划-->执行sql(buffer计算数据:逻辑读或物理读I/O)-->获取数据(buffer cache-->PGA)-->返数据给用户
当这条sql发出来时,Oracle要做些什么呢?我们先来看一张图(来自DSI405的Library cache)
在整个SGA中最复杂的就是sharedpool,而shared pool中最复杂就是library cache,这里对它的机制不做详细讨论,简单讲讲sql在里面的运作流程。
首先sql(update t_gyjset name='gyj1' where id=1)的每个字符当然包括空格转化成ASCII码后,再拿这一堆ASCII码通过HASH函数生成一个sql_hash值,Oracle拿着这个sql_hash值去描扫HASH Buckets(看上面的图,这个幅画的不太好,只画了0号的HASH BUCKETS),假如刚好sql_hash值=0,那么Oracle就延着0号HASHBuckets去搜索ObjectHandle链,在这个Object Handle上存有sql的文本,如果和我们的update t_gyj set name='gyj1' where id=1一模一样对上,那就说明这条sql已被缓存在共享池了,这个过程就是软解析。当然再往下我就不说了,再说下去很复杂了父子游标,最后执行计划是被存放在堆6中。
好,那么如果通过上面的方式在Object Handle链没搜索到这条sql的文本,那说明sql不在共享池中,这个时侯就要做硬解析(过程大要做语法,语义,权限,查询视图展开、划分小的查询块、sql等价转换、代价估算、最后生成执行计划),这个代价会有点高,如果有大量的硬解析那会消耗CPU和占用共享池。
如果这条SQL直接能在共享池的Library cache中能找到,那就是软解析。
如果想对软解析进一步优化,那就做软软解析(具体这里不深入了)
所有这些PARSE(解析)都与共享池有关。
共享池(SHARED POOL)
A、库缓存
B、数据字典缓存
C、PL/SQL区
D、SQL查询和PL/SQL函数结果缓存
答案A,不正确,与访问路径无关(是不是走索引、全表扫描、物化视图等)
答案B,不正确,SGA不能自动控制下面五个池了(BUFFER CACHE/SHARED POOL/JAVA POOL/LARGEPOOL/STREAMS POOL),因类自动共享内存关闭了。
答案C,不正解,PGA与软软解析相关,但软软解只是缓存一个游标,占用内存非常……
答案E,不正解,解析不发生在BUFFER CAHCE中,BUFFERCACHE中一般是修改和访问数据―――执行sql(buffer计算数据:逻辑读或物理读I/O)-->获取数据(buffer cache-->PGA)。
共享池参考官方文档的CONCEPTS:
Shared Pool
The shared pool caches various types of program data. For example, the shared pool stores parsed SQL, PL/SQL code, system parameters, and data dictionary information. The shared pool is involved in almost every operation that occurs in the database. For example, if a user executes a SQL statement, then Oracle Database accesses the shared pool.
The shared pool is divided into several subcomponents, the most important of which are shown in Figure 14-9.
Figure 14-9 Shared Pool
This section includes the following topics:
Library Cache
The library cache is a shared pool memory structure that stores executable SQL and PL/SQL code. This cache contains the shared SQL and PL/SQL areas and control structures such as locks and library cache handles. In a shared server architecture, the library cache also contains private SQL areas.
When a SQL statement is executed, the database attempts to reuse previously executed code. If a parsed representation of a SQL statement exists in the library cache and can be shared, then the database reuses the code, known as a soft parse or a library cache hit. Otherwise, the database must build a new executable version of the application code, known as a hard parse or a library cache miss.
Shared SQL Areas
The database represents each SQL statement that it runs in the following SQL areas:
Shared SQL area
The database uses the shared SQL area to process the first occurrence of a SQL statement. This area is accessible to all users and contains the statement parse tree andexecution plan. Only one shared SQL area exists for a unique statement.
Private SQL area
Each session issuing a SQL statement has a private SQL area in its PGA (see "Private SQL Area"). Each user that submits the same statement has a private SQL area pointing to the same shared SQL area. Thus, many private SQL areas in separate PGAs can be associated with the same shared SQL area.
The database automatically determines when applications submit similar SQL statements. The database considers both SQL statements issued directly by users and applications and recursive SQL statements issued internally by other statements.
The database performs the following steps:
Checks the shared pool to see if a shared SQL area exists for a syntactically and semantically identical statement:
If an identical statement exists, then the database uses the shared SQL area for the execution of the subsequent new instances of the statement, thereby reducing memory consumption.
If an identical statement does not exist, then the database allocates a new shared SQL area in the shared pool. A statement with the same syntax but different semantics uses a child cursor.
In either case, the private SQL area for the user points to the shared SQL area that contains the statement and execution plan.
Allocates a private SQL area on behalf of the session
The location of the private SQL area depends on the connection established for the session. If a session is connected through a shared server, then part of the private SQL area is kept in the SGA.
Figure 14-10 shows a dedicated server architecture in which two sessions keep a copy of the same SQL statement in their own PGAs. In a shared server, this copy is in the UGA, which in the large pool or in the shared pool when no large pool exists.
Figure 14-10 Private SQL Areas and Shared SQL Area
QQ:252803295
技术交流QQ群:
DSI&Core Search Ⅰ 群:127149411(2000人技术群:未满)
DSI&Core Search Ⅱ 群:177089463(1000人技术群:未满)
DSI&Core Search Ⅲ 群:284596437(500人技术群:未满)
DSI&Core Search Ⅳ 群:192136702(500人技术群:未满)
DSI&Core Search Ⅴ 群:285030382(500人闲聊群:未满)
MAIL:dbathink@hotmail.com
BLOG: http://blog.csdn.net/guoyjoe
WEIBO:http://weibo.com/guoyJoe0218
ITPUB: http://www.itpub.net/space-uid-28460966.html
OCM: http://education.oracle.com/education/otn/YGuo.HTM
[每日一题] 11gOCP 1z0-052 :2013-09-14 repeated parsing activity.................................A70的更多相关文章
- [每日一题] 11gOCP 1z0-052 :2013-09-1 RMAN-- repair failure........................................A20
转载请注明出处:http://blog.csdn.net/guoyjoe/article/details/10859315 正确答案:D 一.模拟上题的错误: 1.删除4号文件 [oracle@myd ...
- [每日一题] 11gOCP 1z0-053 :2013-10-9 backup with the KEEP option....................................33
转载请注明出处:http://blog.csdn.net/guoyjoe/article/details/12517603 正确答案:AB 在Oracle 11g中,可以使用backup ….keep ...
- [每日一题] 11gOCP 1z0-053 :2013-10-12 RESULT_CACHE在哪个池?.............................44
转载请注明出处:http://blog.csdn.net/guoyjoe/article/details/12657479 正确答案:B Oracle 11g 新特性:Result Cache , ...
- [每日一题] 11gOCP 1z0-052 :2013-08-31 数据库的存储结构....................................................A8
转载请注明出处:http://blog.csdn.net/guoyjoe/article/details/10784599 . 正确答案:A 将逻辑存储与物理存储分开是关系数据库范例的必要部分.关系数 ...
- [每日一题] 11gOCP 1z0-052 :2013-09-19 创建用户...................................................B41
转载请注明出处:http://blog.csdn.net/guoyjoe/article/details/11834661 正确答案:BC 这道题比较简单,我就以答案来解析,如下来自官方文档创建用户的 ...
- [每日一题] 11gOCP 1z0-052 :2013-09-17 DRA--Data Recovery Advisor.............................B31
转载请注明出处:http://blog.csdn.net/guoyjoe/article/details/11818529 正确答案:AD 数据库恢复顾问(DRA)是一个诊断和修复数据库问题的工具.共 ...
- [每日一题] 11gOCP 1z0-052 :2013-09-5 runInstaller oracle of no swap
转载请注明出处:http://blog.csdn.net/guoyjoe/article/details/11186995 正确答案:A 我们先来看下面这张截图,这是我在安装Oracle 11.2.0 ...
- [每日一题] 11gOCP 1z0-053 :2013-10-11 Flashback Data Archive属性.........................43
转载请注明出处:http://blog.csdn.net/guoyjoe/article/details/12656897 正确答案:BD 闪回数据归档请参考:http://blog.csdn.net ...
- [每日一题] 11gOCP 1z0-053 :2013-10-7 the backup of MULT_DATA................................32
转载请注明出处:http://blog.csdn.net/guoyjoe/article/details/12500579 正确答案:D RMAN 的新增功能 对超大型文件应用 Intraf ...
随机推荐
- Java项目打包工具安装失败解决方法
在学习Java的时候我们打包项目但遇到例如以下情况:(提示没有找到java的执行环境! ) 网上眼下有两中的解决方式: (1)选择本地jdk环境; (2)下载Download 可是第一种选择本地老是失 ...
- 关于css的默认宽度
<div class="boxa"> <div class="boxb">我是div</div> </div> ...
- :before和:after的内幕以及伪类
pseudo-classes vs pseudo-elements http://m.blog.csdn.net/blog/zhuizhuziwo/7897837
- Delphi XE中使用dbExpress连接MySQL数据库疑难问题解决(对三层的例子配置有帮助)
Delphi IDE中包含一个Data Explorer的组件,如下图所示: 该组件基于dbExpress(包含TSQLConnection.TSQLDataSet.TSQLQuery.TSQLSto ...
- activemq下activemq.bat不能启动
今天下载了一个apache-activemq-5.5.0-bin.rar解压缩后双击/bin目录下的activemq.bat批处理文件发现启动窗口一闪而过无法启动,最后找到原因是因为在环境变量-系统变 ...
- java 面试 复习 II
1 break 多重 循环跳出当前循环到上层循环再执行. 如若想跳出多重循环可以使用标号 2 byte,short,char都可以隐含转换为int.可以用在switch 表达式.long和str ...
- JAVA GUI学习 - JProgressBar进度条组件摘录
public class JProgressBarTest extends JFrame{ public JProgressBarTest() { super(); setTitle("表格 ...
- android经常使用的电话操作
给大家分享一下我的一个Android工具类,能够获取手机里面的各种信息,包含拨打电话. 获取全部联系人姓名及电话,插入联系人姓名及电话,插入联系人姓名及电话.插入通话记录.获取用户全部短信.批量插入短 ...
- python 面试相关
python单例模式: Python真的需要单例模式吗?我指像其他编程语言中的单例模式. 答案是:不需要! 因为,Python有模块(module),最pythonic的单例典范.模块在在一个应用程 ...
- doctype(文档类型)的作用是什么?转载
<!DOCTYPE> 声明位于文档中的最前面的位置,处于 <html> 标签之前.此标签可告知浏览器文档使用哪种 HTML 或 XHTML 规范. Document Type ...