日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

Oracle安装 - shmmax和shmall设置

發(fā)布時(shí)間:2023/12/9 编程问答 35 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Oracle安装 - shmmax和shmall设置 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

Python微信訂餐小程序課程視頻

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

Python實(shí)戰(zhàn)量化交易理財(cái)系統(tǒng)

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

一、概述

在Linux上安裝oracle,需要對(duì)內(nèi)核參數(shù)進(jìn)行調(diào)整,其中有shmmax和shmall這兩個(gè)參數(shù),那這兩個(gè)參數(shù)是什么意思,又該如何設(shè)置呢?

二、官方文檔

在oracle的官方文檔( https://docs.oracle.com/en/database/oracle/oracle-database/19/ladbi/minimum-parameter-settings-for-installation.html#GUID-CDEB89D1-4D48-41D9-9AC2-6AD9B0E944E3 )中對(duì)這兩個(gè)參數(shù),設(shè)置了最小的標(biāo)準(zhǔn)值。

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.

再根據(jù)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 ),去查這兩個(gè)參數(shù)所表達(dá)的含義。

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.

以上兩段英文翻譯過(guò)來(lái):shmmax單個(gè)最大共享內(nèi)存段,shmall同一時(shí)刻能使用的所有共享內(nèi)存頁(yè)。shmmax最小一半的物理內(nèi)存,shmall >= shmmax/4096。

oracle的sga(Shared Global Area)使用的就是共享內(nèi)存,共享內(nèi)存的優(yōu)勢(shì)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_ )中也有提及。直白點(diǎn)說(shuō)就是多進(jìn)程使用共享內(nèi)存交流數(shù)據(jù)最快。例如:服務(wù)器進(jìn)程從磁盤(pán)讀取數(shù)據(jù)到sga的buffer cache,dbwn進(jìn)程從buffer cache將數(shù)據(jù)寫(xiě)回到磁盤(pán),操作的是同一片內(nèi)存區(qū)域。如果沒(méi)有共享內(nèi)存,那么就需要將服務(wù)器進(jìn)程操作的這片內(nèi)存復(fù)制一份到dbwn所操作的內(nèi)存中去,來(lái)完成讀取和寫(xiě)入操作。

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.

從上面的官方文檔我們了解了這兩個(gè)參數(shù)的含義,但是oracle只給了shmmax和shmall的最小值。接下來(lái)我們就通過(guò)實(shí)驗(yàn)來(lái)看看這兩個(gè)參數(shù)對(duì)oracle的影響。

三、實(shí)驗(yàn)

我的實(shí)驗(yàn)機(jī)器物理內(nèi)存是1877M,設(shè)置SGA_TAEGET為1000M。接下來(lái)測(cè)試幾個(gè)場(chǎng)景。

a. shmmax 200M, shmall 200M

將/etc/sysctl.conf參數(shù)設(shè)置為
kernel.shmmax = 209715200
kernel.shmall = 51200

oracle啟動(dòng)直接報(bào)錯(cuò)

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參數(shù)設(shè)置為
kernel.shmmax = 1258291200
kernel.shmall = 51200

oracle啟動(dòng)報(bào)跟上面一樣的錯(cuò)

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的實(shí)驗(yàn)結(jié)果來(lái)看,oracle是否能夠正常啟動(dòng)跟shmmax參數(shù)無(wú)關(guān),只與shmall有關(guān)。shmall不能設(shè)置的比SGA_TAEGET小。

c. shmmax 200M, shmall 1200M

將/etc/sysctl.conf參數(shù)設(shè)置為
kernel.shmmax = 209715200
kernel.shmall = 307200

數(shù)據(jù)庫(kù)能夠正常啟動(dòng)

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

查看共享內(nèi)存的信息

[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

把上面的共享內(nèi)存段bytes全部加起來(lái)(12582912+209715200…+2097152)/1024/1024=1002MB??梢钥吹給racle分配內(nèi)存段的時(shí)候,單個(gè)共享內(nèi)存段的確沒(méi)有超過(guò)shmmax(209715200)??偟墓蚕韮?nèi)存剛好等于SGA_TAEGET。

d. shmmax 1200M, shmall 1200M

將/etc/sysctl.conf參數(shù)設(shè)置為
kernel.shmmax = 1258291200
kernel.shmall = 307200

數(shù)據(jù)庫(kù)同樣能夠正常啟動(dòng)

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

查看共享內(nèi)存的信息

[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

把上面的共享內(nèi)存段bytes全部加起來(lái)(12582912+1035993088+2097152)/1024/1024=1002MB。總的共享內(nèi)存仍然剛好等于SGA_TAEGET。內(nèi)存段的數(shù)量卻只有三個(gè),最大的內(nèi)存段達(dá)到1035993088/1024/1024=988M

f. shmmax 2400M, shmall 2400M

將/etc/sysctl.conf參數(shù)設(shè)置為
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沒(méi)啥區(qū)別,shmmax這個(gè)值你就算設(shè)置超過(guò)了物理內(nèi)存也不受影響。因?yàn)閛racle實(shí)際上分配的共享內(nèi)存不會(huì)超過(guò)SGA_TAEGET。

四、總結(jié)

  • 為了讓共享內(nèi)存不至于切分成多個(gè)段,建議將shmmax設(shè)置比SGA_TAEGET大,shmall=shmmax/4096即可。至于大多少,個(gè)人認(rèn)為隨意。
  • ++本人水平有限,特別是對(duì)于共享內(nèi)存這塊,我仍然有很多疑問(wèn),比如共享內(nèi)存能否被交換出去?多個(gè)共享內(nèi)存段有什么缺點(diǎn)?暫時(shí)就先記錄到這里,后面了解之后,再來(lái)更新此文。如果有專家看到文章錯(cuò)誤,還望指正。++

    總結(jié)

    以上是生活随笔為你收集整理的Oracle安装 - shmmax和shmall设置的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

    如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。