天天看點

RHEL5.4安裝Oracle10G各項參數

1.1    系統參數 1.1.1共享記憶體參數

共享記憶體通過将通用的結構和資料放在共享記憶體段中,使得程序可以對它們進行通路。這是現有最快的程序間通信( IPC)方式 主要是因為資料在程序之間傳遞時沒有涉及到核心的操作。在程序之間不需要複制資料。 Oracle 将共享記憶體用于它的系統全局區 (SGA),這是一個由所有的 Oracle 備份程序及前台程序所共享的記憶體區域。為 SGA 配置設定足夠的容量對于 Oracle 的性能非常重要,因為它負責儲存資料庫緩沖區高速緩存、共享 SQL、通路路徑以及更多。 要确定所有共享記憶體的限制,可使用以下指令: # ipcs -lm  

設定 SHMMAX

SHMMAX 參數定義共享記憶體段的最大大小(以位元組為機關)。 Oracle SGA 由共享記憶體組成,且錯誤設定 SHMMAX 可能會限制 SGA 的大小。在設定 SHMMAX 時,切記 SGA 的大小應該适合于一個共享記憶體段。SHMMAX 設定不足可能會導緻以下問題: ORA-27123:unable to attach to shared memory segment 您可以通過執行以下指令來确定 SHMMAX 的值: # cat /proc/sys/kernel/shmmax 33554432 SHMMAX 的預設值為 32MB。通常,這個值對于配置 Oracle SGA 而言太小了。我通常使用以下任一方法将 SHMMAX 參數設定為 2GB: ·通過直接更改 /proc 檔案系統,你無需重新啟動計算機便可以改變 SHMMAX 的預設設定。可以使用以下方法動态設定 SHMMAX 的值。通過将此指令置于 /etc/rc.local 啟動檔案中可以使它永久有效: # echo "2147483648" > /proc/sys/kernel/shmmax ·您還可以使用 sysctl 指令來更改 SHMMAX 的值: # sysctl -w kernel.shmmax=2147483648 ·最後,通過将該核心參數插入到 /etc/sysctl.conf 啟動檔案中,您可以使這種更改永久有效: # echo "kernel.shmmax=2147483648" >> /etc/sysctl.conf  

設定 SHMMNI

我們現在看一下 SHMMNI 參數。這個核心參數用于設定系統範圍内共享記憶體段的最大數量。該參數的預設值是 4096。該值足以滿足需要,是以通常無需更改。 可以通過執行以下指令來确定 SHMMNI 的值: # cat /proc/sys/kernel/shmmni 4096  

設定 SHMALL

最後,我們來看 SHMALL 共享記憶體核心參數。該參數控制系統一次可以使用的共享記憶體總量(以頁為機關)。簡言之,該參數的值始終應至少為: ceil(SHMMAX/PAGE_SIZE) SHMALL 的預設大小為 2097152,并可以使用以下指令進行查詢: # cat /proc/sys/kernel/shmall 2097152 SHMALL 的預設設定足以滿足 Oracle RAC 10g 安裝的需要。 (注意: i386 平台上的 Red Hat Linux 中的頁面大小為 4,096 位元組。但您可以使用 bigpages,它支援配置更大的記憶體頁面大小。)  

1.1.2信号量參數

至此,我們已經配置了共享記憶體設定,接下來将介紹如何配置信号。 對信号的最佳描述是,它是用于在共享資源(如共享記憶體)的程序(或程序中的線程)之間提供同步的計數器。 Unix System V 支援信号集,其中的每個信号都是一個信号計數。當應用程式請求信号時,它使用“集合”來完成此工作。 要确定所有信号限制,可使用以下指令: # ipcs -ls   您還可以使用以下指令: # cat /proc/sys/kernel/sem 250      32000   32      128

設定 SEMMSL

SEMMSL 核心參數用于控制每個信号集合的最大信号數。 Oracle 建議将 SEMMSL 設定為 init.ora 檔案(适用于 Linux 系統上所有資料庫)中的最大 PROCESS 執行個體參數設定再加上 10。此外,Oracle 建議将 SEMMSL 設定為不小于 100。

設定 SEMMNI

SEMMNI 核心參數用于控制整個 Linux 系統中信号集的最大數量。 Oracle 建議将 SEMMNI 設定為不小于 100。

設定 SEMMNS

SEMMNS 核心參數用于控制整個 Linux 系統中的信号(而非信号集)的最大數量。 Oracle 建議将 SEMMNS 設定為系統上每個資料庫的 PROCESSES 執行個體參數設定之和,加上最大的 PROCESSES 的兩倍,最後為系統上的每個 Oracle 資料庫加上 10。 使用以下計算式确定可以在 Linux 系統上配置設定的信号的最大數量。它将是以下兩者中較小的一個值: SEMMNS — 或 (SEMMSL * SEMMNI) 。

設定 SEMOPM

SEMOPM 核心參數用于控制每個 semop 系統調用可以執行的信号操作數。 semop 系統調用(函數)能夠使用一個 semop 系統調用完成多個信号的操作。一個信号集可以擁有每個信号集中最大數量的 SEMMSL,是以建議将 SEMOPM 設定為等于 SEMMSL。 Oracle 建議将 SEMOPM 設定為不小于 100。

設定信号核心參數

最後,我們來看如何使用一些方法來設定所有信号參數。在下文中,我想更改(增加)的唯一參數是 SEMOPM。所有其他的預設設定可以完全滿足我們的示例安裝。 · 您可以通過直接更改 /proc 檔案系統,不必重新啟動機器而更改所有信号設定的預設設定。該方法将以下内容置于 /etc/rc.local 啟動檔案中:          # echo "250 32000 100 128" > /proc/sys/kernel/sem · 您還可以使用 sysctl 指令來更改所有信号設定的值:          # sysctl -w kernel.sem="250 32000 100 128" · 最後,可以通過将核心參數插入到 /etc/sysctl.conf 啟動檔案中以使此更改永久有效:          # echo "kernel.sem=250 32000 100 128" >> /etc/sysctl.conf  

1.1.3最大檔案句柄數

配置 Red Hat Linux 伺服器時,必須確定最大檔案句柄數足夠大。檔案句柄的設定表示您在 Linux 系統上可以打開的檔案數。 使用以下指令來确定整個系統中檔案句柄的最大數量: # cat /proc/sys/fs/file-max 32768 Oracle 建議将整個系統的檔案句柄值至少設定為 65536。 · 通過直接更改 /proc 檔案系統,您可以不必重新啟動機器而改變檔案句柄最大數量的預設設定。該方法将以下内容置于 /etc/rc.local 啟動檔案中:          # echo "65536" > /proc/sys/fs/file-max · 您還可以使用 sysctl 指令來更改 SHMMAX 的值:          # sysctl -w fs.file-max=65536 · 最後,可以通過将核心參數插入到 /etc/sysctl.conf 啟動檔案中以使此更改永久有效:    # echo "fs.file-max=65536" >> /etc/sysctl.conf 可以通過使用以下指令查詢檔案句柄的目前使用情況: # cat /proc/sys/fs/file-nr 613     95      32768 file-nr 檔案顯示了三個參數:配置設定的檔案句柄總數、目前使用的檔案句柄數以及可以配置設定的最大檔案句柄數。 (注意:如果需要增大 /proc/sys/fs/file-max 中的值,請確定正确設定 ulimit。對于 2.4.20,通常将其設定為 unlimited。使用 ulimit 指令來驗證 ulimit 設定: # ulimit unlimited

1.1.4網絡參數

在 Oracle 9.2.0.1 以及更高版本中,Oracle 在 Linux 上使用 UDP 作為預設協定進行過程間通信 (IPC) 的預設協定,如在 RAC 叢集中的執行個體間的高速緩存合并和叢集管理器緩沖區傳輸。 Oracle 強烈建議将預設的和最大的發送緩沖區大小(SO_SNDBUF 套接字選項)調整為 256KB,并将預設的和最大的接收緩沖區大小(SO_RCVBUF 套接字選項)調整為 256KB。 接收緩沖區由 TCP 和 UDP 用于保留所接收的資料,直到應用程式讀出這些資料為止。由于不允許對等端發送超過緩沖區大小視窗的資料,是以接收緩沖區無法溢出。這意味着,如果資料報不适合套接字接收緩沖區,則将它們舍棄,進而可能導緻發送端壓垮接收端。 無需重新開機即可在 /proc 檔案系統中更改預設的和最大的視窗大小: # su - root   # sysctl -w net.core.rmem_default=262144 net.core.rmem_default = 262144   # sysctl -w net.core.wmem_default=262144 net.core.wmem_default = 262144   # sysctl -w net.core.rmem_max=262144 net.core.rmem_max = 262144   # sysctl -w net.core.wmem_max=262144 net.core.wmem_max = 262144 以上指令對已經運作的作業系統作出更改。現在您應将以下各行添加到 RAC 叢集中每個節點的 /etc/sysctl.conf 檔案中,進而使以上更改成為永久性更改(針對每次重新開機而言): # Default setting in bytes of the socket receive buffer net.core.rmem_default=262144   # Default setting in bytes of the socket send buffer net.core.wmem_default=262144   # Maximum socket receive buffer size which may be set by using # the SO_RCVBUF socket option net.core.rmem_max=262144   # Maximum socket send buffer size which may be set by using # the SO_SNDBUF socket option net.core.wmem_max=262144

1.1.5Oracle使用者能夠打開的檔案句柄的最大數 Setting Limits for the Maximum Number of Open File Descriptors for the Oracle User

After you changed and increased /proc/sys/fs/file-max at Setting File Handles, there is still a per user limit of open file descriptors which is set to 1024 by default:

$ su - oracle      
$ ulimit -n      
1024      

To change this, you have to edit the file /etc/security/limits.conf as root and make the following changes or add the following lines, respectively:

oracle           soft    nofile          4096      
oracle           hard    nofile          63536      

The "soft limit" in the first line defines the number of file handles or open files that the Oracle user will have after login. If the Oracle user gets error messages about running out of file handles, then the Oracle user can increase the number of file handles like in this example up to 63536 ("hard limit") by running the following command:

ulimit -n 63536      

You can set the "soft" and "hard" limits higher if necessary. Note that I do not recommend to set the "hard" limit for nofile for the oracle user equal to /proc/sys/fs/file-max . If you do that and the user uses up all the file handles, then the system would run out of file handles. This could mean that you won't be able to initiate new remote logins any more since the system won't be able to open any PAM modules which are required for performing a login. That's why I set the hard limit to 63536 and not to 65536.   You also need to ensure that pam_limits is configured in the file /etc/pam.d/system-auth, or in /etc/pam.d/sshd (for SSH), /etc/pam.d/su (for su), or /etc/pam.d/login (local logins and telnet) if you don't want to enable it for all logins, or if /etc/pam.d/system-auth does not exist like on SUSE. This is the PAM module that will read the /etc/security/limits.conf file. The entry should read like:

session     required      /lib/security/pam_limits.so      

Here are the two "session" entries I have in my /etc/pam.d/system-auth file:

session     required      /lib/security/pam_limits.so      
session     required      /lib/security/pam_unix.so      

  To make this change permanent, add " ulimit -n 63536" (for Bash) to the ~oracle/.bash_profile file which is the user startup file for the Bash shell on Red Hat Linux (to verify your shell run: echo $SHELL). To do this you could simply copy/paste the following commands for the oracle's Bash shell:

su - oracle      
cat >> ~oracle/.bash_profile << EOF      
ulimit -n 63536      
EOF      
1.1.6Oracle使用者能夠執行的程序的最大數 Setting Limits for the Maximum Number of Processes for the Oracle User

  After reading the procedure at Setting Limits for the Maximum Number of Open File Descriptors for the Oracle User, you should now understand what "soft" and "hard" limits are, how to configure pam_limits.so, and how to change the limits.

To see the current limit of the maximum number of processes for the oracle user, run:

su - oracle      
ulimit -u      

Note that the ulimit options are different for other shells.

To change the "soft" and "hard" limits for the maximum number of processes for the oracle user, add the following lines to the /etc/security/limits.conf file:

oracle           soft    nproc          2047      
oracle           hard    nproc          16384      

To make this change permanent, add " ulimit -u 16384" (for Bash) to the ~oracle/.bash_profile file which is the user startup file for the Bash shell on Red Hat Linux (to verify your shell run: echo $SHELL). To do this you could simply copy/paste the following commands for the oracle's Bash shell:

su - oracle      
cat >> ~oracle/.bash_profile << EOF      
ulimit -u 16384      
EOF      

轉載于:https://blog.51cto.com/routerstp/591457