Chinaunix首页 | 论坛 | 博客
  • 博客访问: 927855
  • 博文数量: 358
  • 博客积分: 8185
  • 博客等级: 中将
  • 技术积分: 3751
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-15 16:27
个人简介

The views and opinions expressed all for my own,only for study and test, not reflect the views of Any Company and its affiliates.

文章分类

全部博文(358)

文章存档

2012年(8)

2011年(18)

2010年(50)

2009年(218)

2008年(64)

我的朋友

分类:

2008-11-05 09:35:41

 
  --清除缓冲区
    alte system flush shared_pool
   
  --使sql不去考虑分区问题
   select /*+PQ_DISTRIBUTE(a NONE PQ_DISTRIBUTE) */min(a.kij_ym_from) from g302t a where a.skj_flg='0';
 
 
###################################

alter system flush shared_pool

SHARED_POOL Clause
The FLUSH SHARED POOL clause lets you clear all data from the

shared pool in the system global area (SGA). The shared pool stores

Cached data dictionary information and Shared SQL and PL/SQL areas

for SQL statements, stored procedures, function, packages, and

triggers.
This statement does not clear shared SQL and PL/SQL areas for items

that are currently being executed. You can use this clause

regardless of whether your instance has the database dismounted or

mounted, open or closed.


实验步骤如下:
------------------------------------------------------------------

----------------------
1.查看shared_pool中碎片
SQL> select count(*) from x$ksmsp;
COUNT(*)
----------
      7260
2.使用一个以前未曾使用过的查询,来让share pool分配内存,增加share

pool中的chunk碎片
SQL> select count(*) from user_tables;
COUNT(*)
----------
       667
3.再次查询shared_pool中的碎片
SQL> select count(*) from x$ksmsp;
COUNT(*)
----------
      7515
每个buckets的碎片数量>2000就认为是不太好的一个情况,可能会引起share

pool latch争用!
4.使用alter system flush shared_pool命令,并再次查询shared_pool中的

碎片
SQL> alter system flush shared_pool;
系统已更改。
SQL> select count(*) from x$ksmsp;
COUNT(*)
----------
      7194
------------------------------------------------------------------

-----------------------------------------------------
总结:执行这个语句的结果是将缓存在library cache和data dictionary

cache 中的sql,pl/sql和数据字典定义都从共享池中清除了
在负载很重的生产库里执行flush shared_pool无异于自杀...慎用!

阅读(858) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~