Oracle安装 - shmmax和shmall设置

Python微信订餐小程序课程视频

https://edu.csdn.net/course/detail/36074

Python实战量化交易理财系统

https://edu.csdn.net/course/detail/35475

一、概述

在Linux上安装oracle,需要对内核参数进行调整,其中有shmmax和shmall这两个参数,那这两个参数是什么意思,又该如何设置呢?

二、官方文档

在oracle的官方文档( https://docs.oracle.com/en/database/oracle/oracle-database/19/ladbi/minimum-parameter-settings-for-installation.html#GUID-CDEB89D1-4D48-41D9-9AC2-6AD9B0E944E3 )中对这两个参数,设置了最小的标准值。
微信截图_20220406104623.png
shmall - Greater than or equal to the value of shmmax, in pages.
shmmax - Half the size of physical memory in bytes. See My Oracle Support Note 567506.1 for additional information about configuring shmmax.

再根据redhat的官方文档( https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/performance_tuning_guide/sect-red_hat_enterprise_linux-performance_tuning_guide-configuration_tools-configuring_system_memory_capacity ),去查这两个参数所表达的含义。
微信截图_20220406113052.png
shmall - Defines the total amount of shared memory pages that can be used on the system at one time. A page is 4096 bytes on the AMD64 and Intel 64 architecture, for example.
shmmax - Defines the maximum size (in bytes) of a single shared memory segment allowed by the kernel.

以上两段英文翻译过来:shmmax单个最大共享内存段,shmall同一时刻能使用的所有共享内存页。shmmax最小一半的物理内存,shmall >= shmmax/4096。

oracle的sga(Shared Global Area)使用的就是共享内存,共享内存的优势redhat官方文档( https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/5/html/tuning_and_optimizing_red_hat_enterprise_linux_for_oracle_9i_and_10g_databases/chap-oracle_9i_and_10g_tuning_guide-setting_shared_memory#sect-Oracle_9i_and_10g_Tuning_Guide-Setting_Shared_Memory-Setting_SHMMAX_Parameter_ )中也有提及。直白点说就是多进程使用共享内存交流数据最快。例如:服务器进程从磁盘读取数据到sga的buffer cache,dbwn进程从buffer cache将数据写回到磁盘,操作的是同一片内存区域。如果没有共享内存,那么就需要将服务器进程操作的这片内存复制一份到dbwn所操作的内存中去,来完成读取和写入操作。
微信截图_20220406113004.png
Shared memory allows processes to access common structures and data by placing them in shared memory segments. It is the fastest form of inter-process communication available since no kernel involvement occurs when data is passed between the processes. In fact, data does not need to be copied between the processes.
Oracle uses shared memory segments for the Shared Global Area (SGA) which is an area of memory that is shared by Oracle processes. The size of the SGA has a significant impact to Oracle’s performance since it holds database buffer cache and much more.

从上面的官方文档我们了解了这两个参数的含义,但是oracle只给了shmmax和shmall的最小值。接下来我们就通过实验来看看这两个参数对oracle的影响。

三、实验

我的实验机器物理内存是1877M,设置SGA_TAEGET为1000M。接下来测试几个场景。

a. shmmax 200M, shmall 200M

将/etc/sysctl.conf参数设置为
kernel.shmmax = 209715200
kernel.shmall = 51200

oracle启动直接报错

SQL> startup nomount pfile='/home/oracle/test.ora'
ORA-27102: out of memory
Linux-x86\_64 Error: 28: No space left on device
Additional information: 209715200
Additional information: 1

b. shmmax 1200M, shmall 200M

将/etc/sysctl.conf参数设置为
kernel.shmmax = 1258291200
kernel.shmall = 51200

oracle启动报跟上面一样的错

SQL> startup nomount pfile='/home/oracle/test.ora' 
ORA-27102: out of memory
Linux-x86\_64 Error: 28: No space left on device
Additional information: 1035993088
Additional information: 1

从a和b的实验结果来看,oracle是否能够正常启动跟shmmax参数无关,只与shmall有关。shmall不能设置的比SGA_TAEGET小。

c. shmmax 200M, shmall 1200M

将/etc/sysctl.conf参数设置为
kernel.shmmax = 209715200
kernel.shmall = 307200

数据库能够正常启动

SQL> startup nomount pfile='/home/oracle/test.ora'
ORACLE instance started.Total System Global Area 1043886080 bytes
Fixed Size                  2259840 bytes
Variable Size             327156864 bytes
Database Buffers          708837376 bytes
Redo Buffers                5632000 bytes

查看共享内存的信息

[root@oracletest ~]# ipcs -m------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch     status      
0x00000000 229376     oracle     640        12582912   18                      
0x00000000 262145     oracle     640        209715200  18                      
0x00000000 294914     oracle     640        209715200  18                      
0x00000000 327683     oracle     640        209715200  18                      
0x00000000 360452     oracle     640        209715200  18                      
0x00000000 393221     oracle     640        197132288  18                      
0x276f5044 425990     oracle     640        2097152    18  

把上面的共享内存段bytes全部加起来(12582912+209715200…+2097152)/1024/1024=1002MB。可以看到oracle分配内存段的时候,单个共享内存段的确没有超过shmmax(209715200)。总的共享内存刚好等于SGA_TAEGET。

d. shmmax 1200M, shmall 1200M

将/etc/sysctl.conf参数设置为
kernel.shmmax = 1258291200
kernel.shmall = 307200

数据库同样能够正常启动

SQL> startup nomount pfile='/home/oracle/test.ora'
ORACLE instance started.Total System Global Area 1043886080 bytes
Fixed Size                  2259840 bytes
Variable Size             327156864 bytes
Database Buffers          708837376 bytes
Redo Buffers                5632000 bytes

查看共享内存的信息

[root@oracletest ~]# ipcs -m------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch     status      
0x00000000 557056     oracle     640        12582912   18                      
0x00000000 589825     oracle     640        1035993088 18                      
0x276f5044 622594     oracle     640        2097152    18 

把上面的共享内存段bytes全部加起来(12582912+1035993088+2097152)/1024/1024=1002MB。总的共享内存仍然刚好等于SGA_TAEGET。内存段的数量却只有三个,最大的内存段达到1035993088/1024/1024=988M

f. shmmax 2400M, shmall 2400M

将/etc/sysctl.conf参数设置为
kernel.shmmax = 2516582400
kernel.shmall = 614400

SQL> startup nomount pfile='/home/oracle/test.ora'
ORACLE instance started.Total System Global Area 1043886080 bytes
Fixed Size                  2259840 bytes
Variable Size             327156864 bytes
Database Buffers          708837376 bytes
Redo Buffers                5632000 bytes  
[root@oracletest ~]# ipcs -m------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch     status      
0x00000000 688128     oracle     640        12582912   18                      
0x00000000 720897     oracle     640        1035993088 18                      
0x276f5044 753666     oracle     640        2097152    18 

可以看到f跟e没啥区别,shmmax这个值你就算设置超过了物理内存也不受影响。因为oracle实际上分配的共享内存不会超过SGA_TAEGET。

四、总结

  1. 为了让共享内存不至于切分成多个段,建议将shmmax设置比SGA_TAEGET大,shmall=shmmax/4096即可。至于大多少,个人认为随意。

++本人水平有限,特别是对于共享内存这块,我仍然有很多疑问,比如共享内存能否被交换出去?多个共享内存段有什么缺点?暂时就先记录到这里,后面了解之后,再来更新此文。如果有专家看到文章错误,还望指正。++

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

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

相关文章

彻底理解js中this的指向

首先必须要说的是,this的指向在函数定义的时候是确定不了的,只有函数执行的时候才能确定this到底指向谁,实际上this的最终指向的是那个调用它的对象(这句话有些问题,后面会解释为什么会有问题,虽然网上大部…

linux下web压力测试工具ab使用及详解

APACHE自带的测试工具AB(apache benchmark).在APACHE的bin目录下。格式: ./ab [options] [http://]hostname[:port]/path参数: -n requests Number of requests to perform //在测试会话中所执行的请求个数。默认时,仅执行一个请求…

将博客文章转变为电子书

中国站长站(mb5u.com)11月24日消息:自己的博客如何保存,如何更好地展示出来?近期,javaeye网站推出了一项新的功能,把博客制作成电子书籍。 以下,是javaeye负责人对该功能的介绍&…

带码农《手写Mybatis》进度3:实现映射器的注册和使用

Python微信订餐小程序课程视频 https://edu.csdn.net/course/detail/36074 Python实战量化交易理财系统 https://edu.csdn.net/course/detail/35475 作者:小傅哥 博客:https://bugstack.cn 沉淀、分享、成长,让自己和他人都能有所收获&…

ubuntu16.04安装metasploit+postgresql

ubuntu16.04安装metasploitpostgresql 1、安装msf 1.1、打开终端,进入安装目录(你想放在哪就进哪 cd /opt curl https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfupdate.erb &g…

01背包问题,动态规划求解

01背包问题: 1.递归思想 0- 1 背包问题如果采用递归算法来描述则非常清楚明白, 它的算法根本思想是假设用布尔函数knap( s, n) 表示n 件物品放入可容质量为s 的背包中是否有解( 当knap 函数的值为真时 说明问题有解,其值为假时无解) . 我们可以通过输入s 和n 的值, …

《C++程序设计原理与实践》读书笔记(二)

C语言提供了一些内置的类型,如char、int和double。对于一个类型,如果编译器无须借助程序员在源码中提供的任何声明,就知道如何表示这种类型的对象以及可以对它进行什么样的运算,我们就称这种类型是内置的。非内置的类型称为用户自…

SonarQube代码质量管理平台安装与使用

SonarQube代码质量管理平台安装与使用 注原文地址:http://blog.csdn.net/hunterno4/article/details/11687269Sonar简介 Sonar是一个用于代码质量管理的开源平台,用于管理源代码的质量,可以从七个维度检测代码质量 通过插件形式,可…

docker容器编排原来这么丝滑~

Python微信订餐小程序课程视频 https://edu.csdn.net/course/detail/36074 Python实战量化交易理财系统 https://edu.csdn.net/course/detail/35475 前言: 请各大网友尊重本人原创知识分享,谨记本人博客:南国以南i 概念介绍&#xff1a…

Ant in Action读书笔记(三):在Ant中导入环境变量

<property environment"env"/><echo message"${env.ANT_HOME}"/>能把所有的环境变量都导入成Ant的property转载于:https://www.cnblogs.com/buhaiqing/archive/2012/11/03/2752142.html

互联网思维的“独孤九剑”

课前秀&#xff1a;三个段子 第一个段子&#xff1a;有一个毫无餐饮行业经验的人&#xff0c;他开了一家餐馆&#xff0c;菜品只有12道&#xff0c;在北京只有两家分店&#xff1b;仅两个月时间&#xff0c;就实现了所在商场餐厅坪效第一名&#xff1b;绿茶单位坪效大约是100元…

linux系统分析工具续-SystemTap和火焰图(Flame Graph)

本文为网上各位大神文章的综合简单实践篇&#xff0c;参考文章较多&#xff0c;有些总结性东西&#xff0c;自认暂无法详细写出&#xff0c;建议读文中列出的参考文档&#xff0c;相信会受益颇多。下面开始吧&#xff08;本文出自 “cclo的博客” 博客&#xff0c;请务必保留此…

MySQL8.0.x 版本安装步骤傻瓜式教程【官方版】

Python微信订餐小程序课程视频 https://edu.csdn.net/course/detail/36074 Python实战量化交易理财系统 https://edu.csdn.net/course/detail/35475 MySQL8.0.x 安装 一、下载 MySQL官网下载链接&#xff1a;https://downloads.mysql.com/archives/community/ 选择版本后…

jar包直接拷贝到WEB-INF/lib下和以userLibrary引入的区别

jar包直接拷贝到WEB-INF/lib下和以userLibrary形式引入的区别&#xff1f; jar包放置在WEB-INF/lib下和通过build path导入的区别是什么&#xff1f; 上一篇文章&#xff1a;【原创】java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener…

Just do it

不管做什么 坚持下去 最后慢慢有自己的优势点一点一滴 用心去做用心去工作 思考并实现自己的想法主动不是说在嘴上 去做 do it做东西会遇到挫折 想办法克服或绕过 寻求帮助 积极沟通do it&#xff0c; enjoy work转载于:https://blog.51cto.com/bluemood/1588962

sqoop1.4.6导出oracle实例

1、导入odbj6.jar到$SQOOP_HOME/lib目录下。 2、sqoop import --append --connect jdbc:oracle:thin:219.216.110.120:1521:orcl --username TEST1 --password test1 --table TEST1 --columns age --hbase-table test1 --hbase-row-key id --column-family personinfo 说明: S…

不用电的计算机(二)

Python微信订餐小程序课程视频 https://edu.csdn.net/course/detail/36074 Python实战量化交易理财系统 https://edu.csdn.net/course/detail/35475 转载请注明出处&#xff1a;https://blog.csdn.net/morningli/p/16058594.html 上一篇讲到最早的计算机是什么样的&#xf…

JS 数组 各项操作

构建数组(Array) var a new Array(); //创建Array对象 var a new Array; //创建Array对象 var a new Array(10); //创建Array对象&#xff0c;并指定数组中项的个数 var a new Array("a","b","c"); //数组a,b,c var a ["a","…

CocoaPods did not set the base configuration of your project 问题解决方案

今天在使用pod install的时候&#xff0c;出现了 [!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configuration…

OpenSSH 密钥管理:RSA/DSA 认证(转载)

我们中有许多人把优秀的 OpenSSH用作古老的 telnet 和 rsh 命令的替代品&#xff0c;OpenSSH 不仅是安全的而且是加密的。 OpenSSH 更加吸引人的特性之一是它能够使用基于一对互补的数字式密钥的 RSA 和 DSA 认证协议来认证用户。RSA 和 DSA 认证承诺 不必提供密码就能够同远程…