使用lock_sga和pre_page_sga参数保证SGA常驻物理内存 .
Lock_sga
LOCK_SGA locks the entire SGA into physical memory. It is usually advisable to lock
the SGA into real (physical) memory, especially if the use of virtual memory would
include storing some of the SGA using disk space. This parameter is ignored on
platforms that do not support it.
Property |
Description |
Parameter type |
Boolean |
Default value |
false |
Modifiable |
No |
Range of values |
true | false |
Basic |
No |
PRE_PAGE_SGA
PRE_PAGE_SGA determines whether Oracle reads the entire SGA into memory at
instance startup. Operating system page table entries are then prebuilt for each page of the SGA. This setting can increase the amount of time necessary for instance startup,
but it is likely to decrease the amount of time necessary for Oracle to reach its full
performance capacity after startup.
PRE_PAGE_SGA can increase the process startup duration, because every process that
starts must access every page in the SGA. The cost of this strategy is fixed; however,
you might simply determine that 20,000 pages must be touched every time a process
starts. This approach can be useful with some applications, but not with all
applications. Overhead can be significant if your system frequently creates and
destroys processes by, for example, continually logging on and logging off.
The advantage that PRE_PAGE_SGA can afford depends on page size. For example, if
the SGA is 80 MB in size and the page size is 4 KB, then 20,000 pages must be touched
to refresh the SGA (80,000/4 = 20,000).
If the system permits you to set a 4 MB page size, then only 20 pages must be touched
to refresh the SGA (80,000/4,000 = 20). The page size is operating system-specific and
generally cannot be changed. Some operating systems, however, have a special
implementation for shared memory whereby you can change the page size.
通过修改lock_sga和pre_page_sga参数可以保证SGA不被换出到虚拟内存,进而可以提高SGA的使用效率。
当lock_sga参数设置为TRUE时(默认值是FALSE),可以保证整个SGA被锁定在物理内存中,这样可以防止SGA被换出到虚拟内存。只要设置lock_sga为“TRUE”便可保证SGA被锁定在物理内存中,这里之所以顺便将pre_page_sga参数也设置为“TRUE”,是因为这样可以保证在启动数据库时把整个SGA读入到物理内存中,以便提高系统的效率(虽然会增加系统的启动时间)。
AIX 5L(AIX 4.3.3以上)
1. aix参数v_pinshm=1,默认是0,表示aix将支持pin住内存,设置方法为
#vmo -p -o v_pinshm=1
2. aix参数maxpin%=内存百分比,默认80%,表示支持的最大的可pin住内存的比例,设置方法为
#vmo -p -o maxpin%=90
3. oracle参数LOCK_SGA=true,表示oracle将使用这部分被pin住的内存,其实就是告诉oracle使用另外一种内存调用方法。
HP UNIX
1. root用户,创建权限配置文件/etc/privgroup
# touch /etc/privgroup
# vi /etc/privgroup
添加"dba MLOCK"到该文件
2. root用户,执行命令
# /etc/setprivgrp -f /etc/privgroup
3. oracle用户,修改Oracle参数lock_sga=true
SOLARIS (solaris2.6以上)
8i版本以上数据库默认使用隐藏参数 use_ism = true,自动锁定SGA于内存中,不用设置lock_sga。
如果设置 lock_sga =true 使用非 root 用户启动数据库将返回错误。
WINDOWS
不能设置lock_sga=true,可以通过设置pre_page_sga=true,使得数据库启动的时候就把所有内存页装载,这样可能起到一定的作用。
Red Hat5 Linux 2.64bit
1.查看lock_sga和pre_page_sga参数的默认值
NAME TYPE VALUE
--------------- -------------------- -----------------
lock_sga boolean FALSE
pre_page_sga boolean FALSE
sga_max_size big integer 5G
sga_target big integer 5G
2 重新启动Oracle使spfile的修改生效
SQL> alter system set lock_sga=true scope=spfile;
System altered.
SQL> alter system set pre_page_sga=true scope=spfile;
System altered.
Database closed.
Database dismounted.
ORACLE instance shut down.
tacsoft> startup;
ORA-27102: out of memory
Linux-x86_64 Error: 12: Cannot allocate memory
失败原因,Linux操作系统对每一个任务在物理内存中能够锁住的最大值做了限制!需要手工进行调整。
5.“ORA-27102”及“Cannot allocate memory”问题处理
1)使用“ulimit -a”命令获得“max locked memory”的默认大小
oracle@sharkdg:[/u01/app/oracle/product/11.2.0/db_1/sqlplus/admin] ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 139264
max locked memory (kbytes, -l) 32
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 10240
cpu time (seconds, -t) unlimited
max user processes (-u) 2047
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
可见,一个任务可以锁住的物理内存最大值是32kbytes,这么小的值根本无法满足我们SGA的大小需求。
2)在root用户下尝试修改,成功。
[root@tacsoft ~]# ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 139264
max locked memory (kbytes, -l) unlimited
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 10240
cpu time (seconds, -t) unlimited
max user processes (-u) 2047
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
调整完操作系统的限制后,我们再次尝试启动数据库。成功!
ora10g@tacsoft /home/oracle$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.3.0 - Production on Sun Dec 20 22:21:40 2009
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
Connected to an idle instance.
NotConnected@> startup;
ORACLE instance started.
Total System Global Area 5368709120 bytes
Fixed Size 2080320 bytes
Variable Size 905970112 bytes
Database Buffers 4445962240 bytes
Redo Buffers 14696448 bytes
Database mounted.
Database opened.
使用lock_sga和pre_page_sga参数保证SGA常驻物理内存 .的更多相关文章
- Lock_sga 和 pre_page_sga 参数详解
Lock_sga 和 pre_page_sga 参数详解 Lock_sga 和pre_page_sga,是两个平时用的不算太多的参数,但是这两个参数平时在优化的时候可能给你带来比较乐观的 ...
- [20181109]12cR2 的pre_page_sga参数
[20181109]12cR2 的pre_page_sga参数.txt --//12CR2改变了参数pre_page_sga设置为True.设置为true有好处也有缺点.--//先看看官方的定义:ht ...
- python locust 性能测试:locust参数-保证并发测试数据唯一性,循环取数据
from locust import TaskSet, task, HttpLocustimport queue class UserBehavior(TaskSet): @task def test ...
- OCP读书笔记(13) - 管理内存
SGA 1. 什么是LRULRU表示Least Recently Used,也就是指最近最少使用的buffer header链表LRU链表串联起来的buffer header都指向可用数据块 2. 什 ...
- 如何不让oracle使用linux的swap分区
经常看到swap分区被使用,被缓存的内容本来是为了增加命中率,结果去不断换入换出,导致本地磁盘IO增加,影响访问速度.所以在内存充足的情况下,如果我们觉得不需要使用swap分区的时候,那就要想办法尽量 ...
- SGA内存的优化
查看SGA有关的系统参数即介绍 SQL> show parameter sga NAME TYPE VALUE ------------------------------------ ---- ...
- Android 进程常驻----native保活5.0以下方案推演过程以及代码
正文: 今天继续昨天,一鼓作气,争取这个礼拜全部写完. 上一篇文章留了一个别人的github链接,他里面的native保活实现方案也是大多数公司采用的方案. 我们先来讲一下他的方案. 他是首先开启一个 ...
- oracle12c之 控制pdb中sga 与 pga 内存使用
Memory Management using Resource Manager Oracle数据库资源管理器(资源管理器)现在可以在多租户容器数据库(CDB)中管理可插入数据库(PDBs)之间的内存 ...
- oracle12c之二 控制PDB中SGA 与 PGA 内存使用
oracle12c之 控制pdb中sga 与 pga 内存使用 Memory Management using Resource Manager Oracle数据库资源管理器(资源管理器)现在可以在多 ...
随机推荐
- .net 导出
public void CreateExcel(DataTable dt, string fileName) { HttpResponse resp = System.Web.HttpContext. ...
- html简单样式
1.外部样式表 link rel="stylesheet" type="text/css" href="bbb.css"> 2.内部样 ...
- $(document).ready(function(){})和window.onload=function(){}的比较
这两个函数想必每个前端开发者都不会很陌生,但是很了解用法的人估计就比较少了,博主也是最近才开始注意到这两个函数的区别. 首先$(document).ready(function(){})等同于$(). ...
- C++服务器设计(零):总体设计
这个系列把毕业论文的部分贴了出来,以作保存留念.整个系列分为三大部分,其中第一章到第三章是介绍服务器的系统层设计,设计思路参考了libevent和muduo等开源代码的实现:第四章到第六章是介绍服务器 ...
- 数值的N次方
问题描述: 实现函数double Power(double base,int exponent),求base的exponent次方.不得使用库函数, 同时不需考虑大数问题. 思路分析: 要是你秒秒钟想 ...
- (原)caffe中fine tuning及使用snapshot时的sh命令
转载请注明出处: http://www.cnblogs.com/darkknightzh/p/5946041.html 参考网址: http://caffe.berkeleyvision.org/tu ...
- JQuery easyui (2)Droppable(放置)组件
所谓放置,就是将一个物体放入一个物体内,当然对于easyui来说触发各种效果是必不可少的,同时这个组件也不会依赖于其他组件. Droppable的加载方式 1,class 加载 一直不太喜欢cl ...
- 12个非常有用的JavaScript小技巧
在这篇文章中将给大家分享12个有关于JavaScript的小技巧.这些小技巧可能在你的实际工作中或许能帮助你解决一些问题. 使用!!操作符转换布尔值 有时候我们需要对一个变量查检其是否存在或者检查值是 ...
- Ubunu下安装mongoDB
mongoDB有两种安装模式: 1. 源码安装 wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.2.0.tgz tar zxvf ...
- 【转】Memcached管理与监控工具----MemAdmin
原文连接:http://blog.csdn.net/ajun_studio/article/details/6746877 原文作者:halfMe 转载注明以上信息! 使用MemCached以后,肯定 ...