Shared SQL area && Private SQL area

来源:互联网 发布:假人交友app源码 编辑:程序博客网 时间:2024/06/06 19:03

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.

---附:ocp考题1z0-052 q209的一个题--

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.
Correct Answers: A F

关于 OPEN_CURSORS 参数,查看下面链接,感觉和F选项说的没多大关联

http://blog.163.com/yanenshun@126/blog/static/1283881692013317102832596/

原创粉丝点击