Oracle优化 -- 关于Database Buffer Cache相关参数DB_CACHE_SIZE的优化设置

select size_for_estimate, buffers_for_estimate ,ESTD_PHYSICAL_READ_factor,ESTD_PHYSICAL_READS from v$db_cache_advice 
  2      where block_size='8192' and advice_status='ON';

中,size_for_estimate表示预计的数据库高速缓冲区的大小(即:db_cache_size的值)。ESTD_PHYSICAL_READS表示预计的物理读。

当增加数据库高速缓冲区的的时候,物理读(ESTD_PHYSICAL_READS)越少,说明命中率越高。

 

 

 

1.优化缓冲区大小、提高服务器的命中率
db_cache_size                        big integer 838860800
2.查看缓冲区命中率是否需要调优.

select 1 - ((physical.value - direct.value - lobs.value) / logical.value)
     "Buffer Cache Hit Ratio"
  from v$sysstat physical,v$sysstat direct,v$sysstat lobs,v$sysstat logical
  where physical.name = 'physical reads'
  and direct.name='physical reads direct'
  and lobs.name='physical reads direct (lob)'
  and logical.name='session logical reads';
当命中率>90%说明命中率很高了

3。获取推荐的值
select name,size_for_estimate,v$db_cache_advice.ESTD_PHYSICAL_READS from v$db_cache_advice 
where block_size='8192' and advice_status='ON';

set linesize 1000
---20100619Oracle9i数据 Solaris 9i操作系统
SQL> set linesize 1000
SQL> select size_for_estimate, buffers_for_estimate ,ESTD_PHYSICAL_READ_factor,ESTD_PHYSICAL_READS from v$db_cache_advice 
    where block_size='8192' and advice_status='ON';

SIZE_FOR_ESTIMATE BUFFERS_FOR_ESTIMATE ESTD_PHYSICAL_READ_FACTOR ESTD_PHYSICAL_READS
----------------- -------------------- ------------------------- -------------------
               80                 9925                   28.9757          1436311200
              160                19850                    2.1053           104360120
              240                29775                    1.5819            78413087
              320                39700                    1.4262            70693980
              400                49625                    1.3543            67131735
              480                59550                     1.278            63349434
              560                69475                    1.1893            58954568
              640                79400                    1.1325            56135206
              720                89325                    1.0762            53347837
              800                99250                         1            49569438
              880               109175                     .7067            35030953

SIZE_FOR_ESTIMATE BUFFERS_FOR_ESTIMATE ESTD_PHYSICAL_READ_FACTOR ESTD_PHYSICAL_READS
----------------- -------------------- ------------------------- -------------------
              960               119100                     .3991            19784701
             1040               129025                     .2305            11423374
             1120               138950                     .1927             9552903
             1200               148875                     .1506             7466278
             1280               158800                     .1501             7438186
             1360               168725                     .1501             7438186
             1440               178650                     .1501             7438186
             1520               188575                     .1501             7438186
             1600               198500                     .1501             7438186
SIZE_FOR_ESTIMATE  M 为单位:
当SIZE_FOR_ESTIMATE=80M 的时候 ESTD_PHYSICAL_READS=1436311200
当SIZE_FOR_ESTIMATE=1120M 的时候 ESTD_PHYSICAL_READS=9552903
当SIZE_FOR_ESTIMATE=1280M 的时候 ESTD_PHYSICAL_READS=7438186
之后ESTD_PHYSICAL_READS固定了
所以应该过大db_cache_size=1120M的值使得
4.修改发现DB_cache_size太大了。过大SGA区域解决
alter system set db_cache_size=1120M
--sga设置太小了导致
SQL>  alter system set db_cache_size=1120M;
alter system set db_cache_size=1120M
*
ERROR 位于第 1 行:
ORA-02097: 无法修改参数,因为指定的值无效
ORA-00384: 没有足够的内存来增加高速缓存的大小
之前的值
sga_max_size                         big integer 1494715120
SQL>alter system set SGA_MAX_SIZE=3500M scope=spfile;
系统已更改。

重新启动与关闭解决
SQL> shutdown immediate
数据库已经关闭。
已经卸载数据库。
ORACLE 例程已经关闭。
SQL> startup
ORACLE 例程已经启动。

Total System Global Area 3675756336 bytes
Fixed Size                   735024 bytes
Variable Size            2835349504 bytes
Database Buffers          838860800 bytes
Redo Buffers                 811008 bytes
数据库装载完毕。
数据库已经打开。
查看命中率\当前只有80的满足要求
SQL> select size_for_estimate, buffers_for_estimate ,ESTD_PHYSICAL_READ_factor,ESTD_PHYSICAL_READS from v$db_cache_advice
  2      where block_size='8192' and advice_status='ON';

SIZE_FOR_ESTIMATE BUFFERS_FOR_ESTIMATE ESTD_PHYSICAL_READ_FACTOR ESTD_PHYSICAL_READS
----------------- -------------------- ------------------------- -------------------
               80                 9925                         1                1528
              160                19850                         1                1528
              240                29775                         1                1528
              320                39700                         1                1528
              400                49625                         1                1528
              480                59550                         1                1528
              560                69475                         1                1528
              640                79400                         1                1528
              720                89325                         1                1528
              800                99250                         1                1528
              880               109175                         1                1528

SIZE_FOR_ESTIMATE BUFFERS_FOR_ESTIMATE ESTD_PHYSICAL_READ_FACTOR ESTD_PHYSICAL_READS
----------------- -------------------- ------------------------- -------------------
              960               119100                         1                1528
             1040               129025                         1                1528
             1120               138950                         1                1528
             1200               148875                         1                1528
             1280               158800                         1                1528
             1360               168725                         1                1528
             1440               178650                         1                1528
             1520               188575                         1                1528
             1600               198500                         1                1528
命中率降低了?        
    SQL> select 1 - ((physical.value - direct.value - lobs.value) / logical.value)
  2       "Buffer Cache Hit Ratio"
  3    from v$sysstat physical,v$sysstat direct,v$sysstat lobs,v$sysstat logical
  4    where physical.name = 'physical reads'
  5    and direct.name='physical reads direct'
  6    and lobs.name='physical reads direct (lob)'
  7    and logical.name='session logical reads';

Buffer Cache Hit Ratio
----------------------
            .906673167

继续缩小SGA大小
SQL>alter system set SGA_MAX_SIZE=3000M scope=spfile;

SQL> shutdown immediate
数据库已经关闭。
已经卸载数据库。
ORACLE 例程已经关闭。
SQL> startup
ORACLE 例程已经启动。

Total System Global Area 3155661888 bytes
Fixed Size                   734272 bytes
Variable Size            2315255808 bytes
Database Buffers          838860800 bytes
Redo Buffers                 811008 bytes
数据库装载完毕。
数据库已经打开。
select size_for_estimate, buffers_for_estimate ,ESTD_PHYSICAL_READ_factor,ESTD_PHYSICAL_READS from v$db_cache_advice 
    where block_size='8192' and advice_status='ON';


继续测试:等待30分钟之后测试
    SQL> alter system set db_cache_size=1120M;
   
    select 1 - ((physical.value - direct.value - lobs.value) / logical.value)
     "Buffer Cache Hit Ratio"
  from v$sysstat physical,v$sysstat direct,v$sysstat lobs,v$sysstat logical
  where physical.name = 'physical reads'
  and direct.name='physical reads direct'
  and lobs.name='physical reads direct (lob)'
  and logical.name='session logical reads';
  ---命中率逐渐的提高了
  ---半个小时之后查询命中率是98%
  SQL> select 1 - ((physical.value - direct.value - lobs.value) / logical.value)
  2       "Buffer Cache Hit Ratio"
  3    from v$sysstat physical,v$sysstat direct,v$sysstat lobs,v$sysstat logical
  4    where physical.name = 'physical reads'
  5    and direct.name='physical reads direct'
  6    and lobs.name='physical reads direct (lob)'
  7    and logical.name='session logical reads';

Buffer Cache Hit Ratio
----------------------
            .980309028
-----查询推荐的值
show parameter db_block_size
8192

select name,size_for_estimate,v$db_cache_advice.ESTD_PHYSICAL_READS from
v$db_cache_advice  where block_size='8192' and advice_status='ON';

NAME                 SIZE_FOR_ESTIMATE ESTD_PHYSICAL_READS
-------------------- ----------------- -------------------
DEFAULT                            112                9581
DEFAULT                            224                9514
DEFAULT                            336                9514
DEFAULT                            448                9514
DEFAULT                            560                9514
DEFAULT                            672                9514
DEFAULT                            784                9514
DEFAULT                            896                9514
DEFAULT                           1008                9514
DEFAULT                           1120                9514
DEFAULT                           1232                9514

NAME                 SIZE_FOR_ESTIMATE ESTD_PHYSICAL_READS
-------------------- ----------------- -------------------
DEFAULT                           1344                9514
DEFAULT                           1456                9514
DEFAULT                           1568                9514
DEFAULT                           1680                9514
DEFAULT                           1792                9514
DEFAULT                           1904                9514
DEFAULT                           2016                9514
DEFAULT                           2128                9514
DEFAULT                           2240                9514
显示只要112M大小的空间就可以稳定降低ESTD_PHYSICAL_READS
alter system set db_cache_size=112M
NAME                 SIZE_FOR_ESTIMATE ESTD_PHYSICAL_READS
-------------------- ----------------- -------------------
DEFAULT                             16                   0
DEFAULT                             32                   0
DEFAULT                             48                   0
DEFAULT                             64                   0
DEFAULT                             80                   0
DEFAULT                             96                   0
DEFAULT                            112                   0
DEFAULT                            128                   0
DEFAULT                            144                   0
DEFAULT                            160                   0
DEFAULT                            176                   0

NAME                 SIZE_FOR_ESTIMATE ESTD_PHYSICAL_READS
-------------------- ----------------- -------------------
DEFAULT                            192                   0
DEFAULT                            208                   0
DEFAULT                            224                   0
DEFAULT                            240                   0
DEFAULT                            256                   0
DEFAULT                            272                   0
DEFAULT                            288                   0
DEFAULT                            304                   0
DEFAULT                            320                   0
---查看命中率
  select 1 - ((physical.value - direct.value - lobs.value) / logical.value)
     "Buffer Cache Hit Ratio"
  from v$sysstat physical,v$sysstat direct,v$sysstat lobs,v$sysstat logical
  where physical.name = 'physical reads'
  and direct.name='physical reads direct'
  and lobs.name='physical reads direct (lob)'
  and logical.name='session logical reads';

Buffer Cache Hit Ratio
----------------------
            .982795739
说明Oracle更换峰值的情况决定db_cache_size的大小。
所以设置最大峰值满足的情况。
alter system set db_cache_size=1120M;满足峰值的时候最大值
select name,size_for_estimate,v$db_cache_advice.ESTD_PHYSICAL_READS from
v$db_cache_advice  where block_size='8192' and advice_status='ON';


oracle10g Solaris 10 sparc系统调整

--查
  select name,size_for_estimate,v$db_cache_advice.ESTD_PHYSICAL_READS from
v$db_cache_advice  where block_size='8192' and advice_status='ON';

-------------------- ----------------- -------------------
DEFAULT                            128             1206647
DEFAULT                            256             1067789
DEFAULT                            384              987752
DEFAULT                            512              965164
DEFAULT                            640              913815
DEFAULT                            768              893485
DEFAULT                            896              867321
DEFAULT                           1024              808884
DEFAULT                           1152              599909
DEFAULT                           1280              344618
--此时开始保持在一个稳定的读取值
alter system set db_cache_size=1196M

DEFAULT                           1296              321763

NAME                 SIZE_FOR_ESTIMATE ESTD_PHYSICAL_READS
-------------------- ----------------- -------------------
DEFAULT                           1408              285030
DEFAULT                           1536              280506
DEFAULT                           1664              280325
DEFAULT                           1792              279816
DEFAULT                           1920              266871
DEFAULT                           2048              235838
DEFAULT                           2176              231298
DEFAULT                           2304              228483
DEFAULT                           2432              224971
DEFAULT                           2560              219467
--修改
alter system set db_cache_size=1196M
--查看命中率
  select 1 - ((physical.value - direct.value - lobs.value) / logical.value)
     "Buffer Cache Hit Ratio"
  from v$sysstat physical,v$sysstat direct,v$sysstat lobs,v$sysstat logical
  where physical.name = 'physical reads'
  and direct.name='physical reads direct'
  and lobs.name='physical reads direct (lob)'
  and logical.name='session logical reads';

转载于:https://www.cnblogs.com/login2012/p/5752687.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/573286.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

php 注入是什么意思,如何理解ThinkPHP框架里的依赖注入?

依赖注入,你可以分开理解。拆成,依赖和注入依赖:就是你现在要用 request 对象的get 方法,所有你必须要先能得到request对象,然后才能使用这个方法。这个就是依赖。注入:怎么得到request 对象呢?…

iOS - UITextField

前言 NS_CLASS_AVAILABLE_IOS(2_0) interface UITextField : UIControl <UITextInput, NSCoding>available(iOS 2.0, *) public class UITextField : UIControl, UITextInput, NSCoding 1、UITextField 的创建 Objective-C // 实例化 UITextField 对象UITextFi…

oracle一般人能不能学,Oracle人门学习笔记

1.如何显示当前用户是谁?show user;2.进入sql*plus管理工具&#xff0c;运行里面输入sqlplusw就可以了。3.disc断开当前数据库的连接4.passw修改密码命令示例&#xff1a;passw 回车更改snapall的口令旧口令&#xff1a;*******新口令&#xff1a;******重新键入新口令&#x…

欧拉图

欧拉路径&#xff1a;每条边经过且只经过一次的路径 欧拉回路&#xff1a;如果从某个点出发&#xff0c;经过且只经过每条边一次&#xff0c;最后又回到这个点的路径 欧拉图&#xff1a;存在欧拉回路的图 图&#xff1a; 平凡图&#xff1a;只含有一个点 重边&#xff1a;两点之…

oracle rac standby,oracle RAC数据库建立STANDBY(二)

这篇文章描述为RAC环境创建STANDBY数据库。由于篇幅限制&#xff0c;加上碰到了很多的bug&#xff0c;只能将文章拆分成多篇。这章介绍STANDBY数据库创建的后续操作&#xff0c;并检查STANDBY运行机制&#xff1a;首先登陆实例&#xff0c;检查数据库状态&#xff1a;bash-3.00…

[MySQL] MySQL x64 下载地址

MySQLhttp://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.14-winx64.ziphttp://dev.mysql.com/get/Downloads/MySQLInstaller/mysql-installer-community-5.7.14.0.msiPHP ServerWampServer2.1d-x64.exe转载于:https://www.cnblogs.com/Areas/p/5759195.html

微信php翻译和天气预报整合,微信公众平台天气预报功能开发

本来是想自己直接从中国天气网获取信息并处理&#xff0c;后来发现处理起来太麻烦&#xff0c;而且要获取所有城市的城市编码&#xff0c;再有就是&#xff01;不支持国外天气&#xff01;&#xff01;(我们学校有很多毕业生在国外上学&#xff0c;所以我考虑还是做出支持国外天…

关于Jenkins找不到依赖Jar包问题

昨晚在Jenkins发布时遇到一个Jar包找不到的问题&#xff0c;控制台的报错信息如下&#xff1a; 说白了就是找不到依赖的Jar包&#xff0c;但是当我们回退到灰度的时候发现灰度的环境是构建是没有问题的&#xff0c;为什么同一套代码在两个环境却有天壤之别呢&#xff0c;本着试…

查看Linux服务器运行级别命令,linux命令1、如何查看当前的Linux服务器的运行级别?...

1、如何查看当前的Linux服务器的运行级别&#xff1f;答: ‘who -r’ 和 ‘runlevel’ 命令可以用来查看当前的Linux服务器的运行级别。2、如何查看Linux的默认网关&#xff1f;答: 用 “route -n” 和 “netstat -nr” 命令&#xff0c;我们可以查看默认网关。除了默认的网关信…

BIEE入门(一)架构

BIEE作为Oracle的新的商业智能平台企业版&#xff0c;起源于Oracle所收购的Siebel公司&#xff0c;BIEE原来叫做Siebel Analytic&#xff0c;但是Siebel也不是它的发明者&#xff0c;它是Siebel在2001年收购的另一个公司叫nQuire software的产品&#xff0c;这个从它的配置文件…

redhat linux 9.0 拷贝u盘的文件,肿么用U盘安装Linux,安装的是red hat 9.0…用Ubuntu很方便,redhat可以吗?...

下面有两种安装方法.从dos安装.这方法可以不用软盘,比较方便.得到dosutils目录这个目录里有从dos安装和软盘安装的工具.一般都在第一个iso文件里.在linux下可以这样装载iso文件.mount -o loop valhalla-i386-disc1.iso /mnt/cdromcd /mnt/cdromcd -r images /mnt/c 把dosutils目…

获得当前字符串的宽度

<!DOCTYPE html><html lang"en"><head> <meta charset"UTF-8"> <title>获得当前字符串的宽度</title> <script type"text/javascript" src"jquery-min.js"></script></…

linux需要的GLIBCXX版本,linux-如果我已经安装了GLIBCXX_4.1.2,则需要GLIBCXX_3.4.9吗?

我正在Fedora 8/9 64位(http://mediainfo.sourceforge.net/es/Download/Fedora)上安装MediainfoDLL的最新版本.我下载了libmediainfo-0.7.20和libzen0-0.4.3文件.当我尝试安装libzen0时,得到以下输出&#xff1a;# rpm -i libzen0-0.4.3-1.x86_64.Fedora_9.rpmwarning: libzen0…

小小动画

<script src"JS/jquery-1.7.2.min.js"></script><style type"text/css">* {margin: 0px;padding: 0px;}#dw {position: absolute;width: 200px;height: 70px;font-family: 迷你简书魂;font-size: 50px;}#zhezhao {position: absolute;wi…

linux so文件统一目录,linux加载指定目录的so文件

例如&#xff0c;有个so在/tmp/libs/libzmq.so.3&#xff1a;[winlindev6 libs]$ ls /tmp/libs/ -lhtotal 2.5Mlrwxrwxrwx 1 winlin winlin 15 Dec 12 12:58 libzmq.so -> libzmq.so.3.0.0lrwxrwxrwx 1 winlin winlin 15 Dec 12 12:58 libzmq.so.3 -> libzmq.so.3.0.0-rw…

VBS基础篇 - Dictionary对象

VBS基础篇 - Dictionary对象 Dictionary是存储数据键和项目对的对象&#xff0c;其主要属性有Count、Item、Key&#xff0c;主要方法有Add、Exists、Items、Keys、Remove、RemoveAll。 建立字典 Dim Dict : Set Dict CreateObject("Scripting.Dictionary")添加键值对…

linux编译mesa,如何在Ubuntu 16.04,17.10中安装Mesa 17.3.3

最新的MESA 3D图形库17.3.3现在在Ubuntu-X team PPA存储库中为Ubuntu 16.04和Ubuntu 17.10提供。Mesa 17.3.3实现了OpenGL 4.5 API&#xff0c;但由glGetString(GL_VERSION)或glGetIntegerv(GL_MAJOR_VERSION)/glGetIntegerv(GL_MINOR_VERSION)报告的版本取决于所使用的特定驱动…

iOS开发Swift篇—(三)字符串和数据类型

一、字符串 字符串是String类型的数据&#xff0c;用双引号""包住文字内容 let website "http://www.github.com" 1.字符串的常见操作 &#xff08;1&#xff09;用加号 做字符串拼接 let scheme "http://" let path “www.github.com” le…

linux查看xml文件的配置,3、kvm虚拟机日常管理与配置

KVM虚拟机的管理主要是通过virsh命令对虚拟机进行管理。1. 查看KVM虚拟机配置文件及运行状态(1) KVM虚拟机默认配置文件位置: /etc/libvirt/qemu/autostart目录是配置kvm虚拟机开机自启动目录。(2) virsh命令帮助# virsh -help或直接virsh命令和&#xff0c;再执行子命令。如下…

hdu5726-GCD-ST表+二分

先用st表处理出所有l-r的GCD值&#xff0c;然后二分求得这些值一共出现了多少次。 1 #include<bits/stdc.h>2 3 #define inf 0x3f3f3f3f4 5 const int maxn100000;6 7 using namespace std;8 9 typedef pair<int,int> P;10 11 int l,r;12 13 int icase;14 15 int t…