[20120221]CTAS与shared pool.txt

1.在10g下测试:
SQL> select * from v$version ;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bi
PL/SQL Release 10.2.0.3.0 - Production
CORE    10.2.0.3.0      Production
TNS for Linux: Version 10.2.0.3.0 - Production
NLSRTL Version 10.2.0.3.0 - Production

SQL> create table t1 as select * from emp ;
Table created.
SQL> @dpc
PLAN_TABLE_OUTPUT
---------------------------------------
SQL_ID  g9djabjtgrnft, child number 0
An uncaught error happened in prepare_sql_statement : ORA-01403: no data found
NOTE: cannot fetch plan for SQL_ID: g9djabjtgrnft, CHILD_NUMBER: 0
      Please verify value of SQL_ID and CHILD_NUMBER;
      It could also be that the plan is no longer in cursor cache (check v$sql_plan)
8 rows selected.
SQL> select * from v$sql where sql_id='g9djabjtgrnft';
no rows selected
--可以发现V$sql视图并没有记录这个执行语句。
--另外如果你drop表,在重复执行上面的ctas语句,可以发现child number一直是等于0.
查询基表:
SQL> column kglnaobj format a60
SQL> SELECT addr, indx, inst_id, kglhdpar, kglnaobj  from  x$kglcursor_child WHERE kglobt03 = 'g9djabjtgrnft';
no rows selected
SQL> SELECT addr, indx, inst_id, kglhdpar, kglnaobj FROM SYS.x$kglob WHERE kglobt03 = 'g9djabjtgrnft';
ADDR                   INDX    INST_ID KGLHDPAR         KGLNAOBJ
---------------- ---------- ---------- ---------------- ------------------------------------------------------------
0000002A972F47D0          0          1 00000000D3BFEBD0 create table t1 as select * from emp
0000002A972F5B00          1          1 00000000D3BFEBD0 create table t1 as select * from emp
2.在11g下测试:
SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
PL/SQL Release 11.2.0.1.0 - Production
CORE    11.2.0.1.0      Production
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
SQL> create table t1 as select * from emp ;
Table created.
SQL> @dpc
PLAN_TABLE_OUTPUT
-------------------------------------
SQL_ID  g9djabjtgrnft, child number 2
-------------------------------------
create table t1 as select * from emp
Plan hash value: 2748781111
----------------------------------------------------------------------------------------
| Id  | Operation              | Name | E-Rows | Cost (%CPU)|  OMem |  1Mem | Used-Mem |
----------------------------------------------------------------------------------------
|   0 | CREATE TABLE STATEMENT |      |        |     4 (100)|       |       |          |
|   1 |  LOAD AS SELECT        |      |        |            |   269K|   269K|  269K (0)|
|   2 |   TABLE ACCESS FULL    | EMP  |     14 |     3   (0)|       |       |          |
----------------------------------------------------------------------------------------
Note
-----
   - Warning: basic plan statistics not available. These are only collected when:
       * hint 'gather_plan_statistics' is used for the statement or
       * parameter 'statistics_level' is set to 'ALL', at session or system level
20 rows selected.
--注意我已经执行了两次!这次是第3次!child number=2.
SQL> column sql_text format a60
SQL> select  SQL_TEXT , SQL_ID ,child_number from v$sql where sql_id='g9djabjtgrnft';
SQL_TEXT                                                     SQL_ID        CHILD_NUMBER
------------------------------------------------------------ ------------- ------------
create table t1 as select * from emp                         g9djabjtgrnft            0
create table t1 as select * from emp                         g9djabjtgrnft            1
create table t1 as select * from emp                         g9djabjtgrnft            2
SQL> column kglnaobj format a60
SQL> SELECT addr, indx, inst_id, kglhdpar, kglnaobj  from  x$kglcursor_child WHERE kglobt03 = 'g9djabjtgrnft';
ADDR                   INDX    INST_ID KGLHDPAR         KGLNAOBJ
---------------- ---------- ---------- ---------------- ------------------------------------------------------------
0000002A971C4FD0          0          1 0000000095CBB208 create table t1 as select * from emp
0000002A971C6078          1          1 0000000095CBB208 create table t1 as select * from emp
0000002A971C7138          2          1 0000000095CBB208 create table t1 as select * from emp
SQL> SELECT addr, indx, inst_id, kglhdpar, kglnaobj FROM SYS.x$kglob WHERE kglobt03 = 'g9djabjtgrnft';
ADDR                   INDX    INST_ID KGLHDPAR         KGLNAOBJ
---------------- ---------- ---------- ---------------- ------------------------------------------------------------
0000002A97277D58          0          1 0000000095CBB208 create table t1 as select * from emp
0000002A97278E00          1          1 0000000095CBB208 create table t1 as select * from emp
0000002A97279EA8          2          1 0000000095CBB208 create table t1 as select * from emp
0000002A9727AF68          3          1 0000000095CBB208 create table t1 as select * from emp
--可以发现11g下ctas的操作也记录在v$sql中,而在10g执行完成后,就退出了shared pool。
				
时间: 2024-09-29 00:22:32

[20120221]CTAS与shared pool.txt的相关文章

[20170103]关于latch shared pool.txt

[20170103]关于latch shared pool.txt --网友问的问题:http://www.itpub.net/thread-2074374-1-1.html SCOTT@book> select * from V$EVENT_NAME where name='latch: shared pool';     EVENT#   EVENT_ID NAME                 PARAMETER1           PARAMETER2           PARAM

关于shared pool的深入探讨(六)

关于shared pool的深入探讨(六) 原文链接: http://www.eygle.com/internal/shared_pool-6.htm 研究了几天shared pool,没想到忽然就撞到问题上来了.作为一个案例写出来给大家参考一下吧. 问题起因是公司做短信群发,就是那个18万买的4000字的短信小说.群发的时候每隔一段时间就会发生一次消息队列拥堵的情况在数据库内部实际上是向一个数据表中记录发送日志. 我们介入来检查数据库的问题,在一个拥堵时段我开始诊断: SQL> select

关于shared pool的深入探讨(五)

关于shared pool的深入探讨(五) 原文链接: http://www.eygle.com/internal/shared_pool-5.htm Oracle使用两种数据结构来进行shared pool的并发控制:lock 和 pin.Lock比pin具有更高的级别. Lock在handle上获得,在pin一个对象之前,必须首先获得该handle的锁定.锁定主要有三种模式: Null,share,Exclusive.在读取访问对象时,通常需要获取Null(空)模式以及share(共享)模式

关于shared pool的深入探讨(二)

关于shared pool的深入探讨(二) Sunday, 2004-08-22 21:23 Eygle       link: http://www.eygle.com/internal/shared_pool-2.htm我们继续把前面的问题展开一下. 其实我们可以从数据库内部监控shared pool的空间碎片情况.这涉及到一个内部视图x$ksmsp X$KSMSP的名称含义为: [K]ernal [S]torage [M]emory Management [S]GA Hea[P]其中每一行

关于shared pool的深入探讨(四)

关于shared pool的深入探讨(四) link: http://www.eygle.com/internal/shared_pool-4.htm      我们进一步来讨论一下shared pool的处理: 先进行相应查询,获得测试数据:   [oracle@jumper udump]$ sqlplus "/ as sysdba"SQL*Plus: Release 9.2.0.3.0 - Production on Thu Aug 26 10:21:54 2004Copyrigh

关于shared pool的深入探讨(一)

关于shared pool的深入探讨(一) link: http://www.eygle.com/internal/shared_pool-1.htm 关于shared pool的设置一直是一个争议较多的内容.很多文章上说,shared pool设置过大会带来额外的管理上的负担,从而在某些条件下会导致性能的下降. 那么这个管理上的负担指的是什么内容呢?本文对这个内容作一定的深入探讨.本文只涉及一个方面,后续的文章将从其他方面继续讨论. 基础知识: 我们可以通过如下命令转储shared pool共

如何自动获取Oracle数据库启动时在Shared pool里面的对象(翻译)

oracle|对象|数据|数据库 主题:本文说明在数据库启动的时候,如何自动获取Shared Pool里最常用的过程和包等对象. 正文:  下面用实例来演示Startup之后和Shutdown之前,如何用Triger来完成自动管理的任务. 1.创建一个供Triger调用的Procedure a.创建一个用来保存Procedure和Package的名称的Table(list_tab)     SQL>create table sys.list_tab (owner varchar2(64),NAM

shared pool latch/ library cache latch /lock pin介绍

latch:library cache --desc v$librarycache; latch:library cache用于保护hash bucket. library cache lock保护HANDLE. library cache pin保护library cache object--LCO. 从10G开始,library cache lock和library cache pin被MUTEX部分取代.暂时不讨论MUTEX. latch:library cache的数量: SYS@ by

Shared Pool子池及结果集缓存技术简介

SubPool技术及优势: 从Oracle 9i开始,Shared Pool可以被分割为多个子缓冲池(SubPool)进行管理,以提高并发性,减少竞争. Shared Pool的每个SubPool可以被看作是一个Mini Shared Pool,拥有自己独立的Free List.内存结构以及LRU List.shared pool latch.同时Oracle提供多个Latch对各个子缓冲池进行管理,从而避免单个Latch的竞争(Shared Pool Reserved Area同样进行分割管理