oracle sharead sql area private area

原创 2017年02月09日 16:47:36

这里写图片描述

oracle 的SQL解析过程,先会在共享区内查找是否执行过此条SQL,找到了则直接从共享区域内直接返回,如果没有查找到,那么才会去重新执行查找匹配。

内存开辟的大小需要通过SQL的复杂度来定,如果内存不够用则用LRU(least recently used)最近使用的算法来替换旧的SQL。

每个共享的SQL都会在私有区域有一份拷贝。

通过oracle的架构图里的查询,可以知道,shared sql area是在shared pool里,private私有sql area 要看oracle 的服务器模式,如果是专用模式就在PGA里,如果是共享模式则在SGA里。

Shared SQL area : Shared SQL Area 包含了SQL的parse tree 和 execution plan

官方文档描述:

A shared SQL area contains the parse tree and execution plan for a given SQL statement.

 Oracle saves memory by using one shared SQL area for SQL statements run multiple times, which often happens when many users run the same application.

Oracle allocates memory from the shared pool when a new SQL statement is parsed, to store in the shared SQL area. The size of this memory depends on the complexity of the statement. 

If the entire shared pool has already been allocated, Oracle can deallocate items from the pool using a modified LRU (least recently used) algorithm until there is enough free space for the new statement’s shared SQL area. 

If Oracle deallocates a shared SQL area, the associated SQL statement must be reparsed and reassigned to another shared SQL area at its next execution.


Private SQL area: Private SQL area包含SQL中的绑定变量的信息还有一些运行时的内存结构;一个Shared SQL area 能与多个Private SQL area做关联; Private SQL area 存在的地方取决于数据库的链接方式如果是使用独立服务器(Dedicated Server)则把Private SQL area存放在PGA中, 如果使用共享服务器(Shared Server)则保持在SGA中。

官方文档描述:

A private SQL area contains data such as bind information and runtime memory structures. Each session that issues a SQL statement has a private SQL area.

 Each user that submits the same SQL statement has his or her own private SQL area that uses a single shared SQL area.
 Thus, many private SQL areas can be associated with the same shared SQL area.


Shared SQL area 和 Private SQL area的区别

Oracle represents each SQL statement it runs with a shared SQL area and a private SQL area.

 Oracle recognizes when two users are executing the same SQL statement and reuses the shared SQL area for those users.

 However, each user must have a separate copy of the statement’s private SQL area

EG:

27:Which two statements are true about Shared SQLArea and Private SQLArea? (Choose two.)
选项
A.Shared SQLArea will be allocated in the shared pool.
B.Shared SQLArea will be allocated when a session starts.
C.Shared SQLArea will be allocated in the large pool always.
D.The whole of Private SQLArea will be allocated in the Program Global Area (PGA) always.
E.Shared SQLArea and Private SQLArea will be allocated in the PGA or large pool.
F.The number of Private SQLArea allocations is dependent on the OPEN_CURSORS parameter.

解析:
B选项, shared sql area里的sql 如果空间充裕的话,一直是会在shared pool里的,所以说它和session是没有关系的。
C选项,必定是在shared pool里。
!!!D和E选项,这个是选项是最难的,私有的区域应该只出现在PGA和share pool中,

Private SQL area: Private SQL area包含SQL中的绑定变量的信息还有一些运行时的内存结构;一个Shared SQL area 能与多个Private SQL area做关联; Private SQL area 存在的地方取决于数据库的链接方式如果是使用独立服务器(Dedicated Server)则把Private SQL area放在了

所以还是要看服务器的模式。

版权声明:本文为博主原创文章,未经博主允许不得转载。

相关文章推荐

OCP-1Z0-052-V8.02-15题

15. Which two statements are true about Shared SQL Area and Private SQL Area? (Choose two.) A.Share...
  • rlhua
  • rlhua
  • 2013-10-26 22:56
  • 10802

15.Which two statements are true about Shared SQL Area and Private SQL Area? (Choose two.)

15.Which two statements are true about Shared SQL Area and Private SQL Area? (Choose two.)

Shared SQL area && Private SQL area

Shared SQL area : Shared SQL Area 包含了SQL的parse tree 和 execution plan 官方文档描述: A shared SQL area conta...

认识Oracle数据库System Global Area (SGA)(1)

1 概述  Oracle SGA区的监控和管理,是数据库日常维护的重要内容。本文详细介绍SGA的基本概念,SGA运行情况检查,以及SGA的参数设置原则,希望对大家的有所帮助。  2 SGA的基本概念 ...

oracle系统根据optimizer statistics(指的就是work area profile)估算出optimal尺寸和onepass尺寸

V$SQL_WORKAREA_ACTIVE ESTIMATED_OPTIMAL_SIZE     NUMBER     Estimated size (in bytes) required b...

【ORACLE】flash recovery area(闪回恢复区)管理

11.1 查看fra位置 SQL> show parameters db_recovery_file_dest NAME              ...

oracle之Flash Recovery Area全面介绍

1. 设置闪回恢复区 闪回恢复区主要通过3个初始化参数来设置和管理 db_recovery_file_dest:指定闪回恢复区的位置 db_recovery_file_dest_size:指...

oracle10g新特性:闪回恢复区(Flash recovery area)

1.设置闪回恢复区 闪回恢复区主要通过3个初始化参数来设置和管理: · db_recovery_file_dest:指定闪回恢复区的位置。 · db_recovery_file_dest_siz...

Oracle10g如何释放flash_recovery_area,解决ORA-19815错误

今早备份Oracle10g数据库的时候,出现以下错误: ORA-19815: WARNING: db_recovery_file_dest_size of 2147483648 bytes is 1...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:深度学习:神经网络中的前向传播和反向传播算法推导
举报原因:
原因补充:

(最多只允许输入30个字)