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

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Oracle安装 - shmmax和shmall设置

發布時間:2023/12/9 编程问答 42 豆豆
生活随笔 收集整理的這篇文章主要介紹了 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 )中對這兩個參數,設置了最小的標準值。

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 ),去查這兩個參數所表達的含義。

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所操作的內存中去,來完成讀取和寫入操作。

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。

四、總結

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

    總結

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

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。