alter system flush shared_pool;
来源:互联网 发布:保持数据库数据一致性 编辑:程序博客网 时间:2024/05/16 14:00
原文地址:http://blog.csdn.net/a3z2008/article/details/7689653
alter system flush shared_pool是将SGA里面的内容进行刷新,并不会将procedure与function删除。你可以将它理解为执行此语句后,ORACLE将SGA里面的内容都当作最近最少使用内存换出机制换出。
应该说alter system flush shared_pool;可以暂时解决shared_pool中的碎片问题,大量的不能共享的SQL很快又会使碎片出现。解决办法是优化SQL,Keep 经常使用的包,cursor_sharing参数,在程序中注意共享cursor等等。这个命令不会影响DB的可用性吧,顶多造成短时间的性能下降,因为parse过的SQL都给清出去了。
实验步骤如下:
----------------------------------------------------------------------------------------
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无异于自杀。。。慎用!
----------------------------------------------------------------------------------------
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无异于自杀。。。慎用!
0 0
- alter system flush shared_pool;
- alter system flush shared_pool
- alter system flush shared_pool;
- alter system flush shared_pool的作用
- alter system flush shared_pool的作用 .
- [日记]alter system flush shared_pool的作用
- alter system flush buffer_cache;
- alter system flush buffer_cache
- alter system flush "oracle的缓存"
- alter system flush“oracle的缓存”
- alter system flush "oracle的缓存"
- "flush shared_pool" "version_count过高引起的bug"
- shared_pool
- alter system ,alter database,alter session
- alter system set events
- alter system checkpoint
- alter system set events
- alter system的常用命令
- 设计模式C++实现——观察者模式
- 未能找到元数据文件
- UNIX-高级I/O---记录锁
- 【详解】如何编写Linux下Nand Flash驱动
- Android屏幕解锁图案破解
- alter system flush shared_pool;
- 数据结构 线性表之顺序存储
- linux date日期输出格式
- [linux内存]系统启动过程中的内存管理
- TFS安装配置
- Struts2自定义类型转换器
- MINI6410-SD卡启动QT系统-串口消息
- 【BZOJ】【Usaco刷水合集】
- Android AlarmManager实现自动开关机