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

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

linux带page参数报错,Linux配置hugepage

發布時間:2023/12/20 linux 35 豆豆
生活随笔 收集整理的這篇文章主要介紹了 linux带page参数报错,Linux配置hugepage 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

對于內存較大的Oracle數據庫服務器,配置HugePage是很有必要的,下面是配置Huge的步驟:

我的環境:

OS:CentOS release 6.4 (Final)

Oracle:11.2.0.4 RAC

1.設置memlock

編輯/etc/security/limits.conf

增加:

* Soft memlock稍小于RAM值

* hard memlock稍小于RAM值

Memlock值大于sga沒關系的,所以我們可以設置這個值在我們想要的SGA size和物理內存size之間,這個值得單位是kb。

[root@node1 ~]# grep -i memtot /proc/meminfo

MemTotal:?????? 132250576 kB

我們物理內存大小126G,因此我可以設置memlock為100G。

在2個節點設置:

[root@node1 ~]# tail -2 /etc/security/limits.conf

* soft memlock 104857600

* hard memlock 104857600

設置完畢后,以Oracle用戶登錄驗證:

node2-> ulimit -l

104857600

2. 禁用AMM特性:

禁用AMM特性需要將memory_max_target, memory_max_target2個參數重置,而不僅僅是設置為0,最好的辦法是創建一個pfile,在pfile中將這2個參數刪除,再根據這個pfile創建spfile.

主要內存參數設置為:

node1->

node1-> grep target /tmp/init.ora

*.pga_aggregate_target=1572864000

*.sga_target=64424509440

SQL> create spfile from pfile='/tmp/init.ora';

File created.

SQL> startup force

ORA-27102: out of memory

Linux-x86_64 Error: 28: No space left on device

Additional information: -134217728

Additional information: 1

SQL>

出現這個報錯是因為shmall設置的太小。

Shmall表示共享內存的總大小,單位為pagesize的大小。

根據我的配置,最大能支持8G的SGA:

node1-> getconf PAGE_SIZE

4096

node1->? cat /proc/sys/kernel/shmall

2097152

修改shmall并重新啟動數據庫,修改的方法很簡單,編輯/etc/sysctl.conf:

kernel.shmall= 16252928

即可。

修改完畢kernel.shmall,此時可以重啟數據庫。

SQL> startup nomount pfile='/tmp/init.ora';

ORACLE instance started.

Total System Global Area 6.4137E+10 bytes

Fixed Size????????????????? 2269072 bytes

Variable Size??????????? 6979321968 bytes

Database Buffers ????????5.7043E+10 bytes

Redo Buffers????????????? 112762880 bytes

SQL>

SQL>

DB啟動后重新創建spfile:

SQL>? create spfile='+OCR/sszgdb/spfilesszgdb.ora' from pfile='/tmp/init.ora';

File created.

SQL>

3.???????? 根據Oracle的腳本計算hugepage大小(計算時要確保Oracle已經啟動),也可自己計算:

Press Enter to proceed...

Recommended setting: vm.nr_hugepages = 30739

node1->

4.???????? 根據腳本的計算值在2個節點編輯/etc/sysctl.conf

加入vm.nr_hugepages = 30739

[root@node2 ~]# grep -i huge /proc/meminfo

AnonHugePages:??? 602112 kB

HugePages_Total:?? 30739

HugePages_Free:??? 30739

HugePages_Rsvd:??????? 0

HugePages_Surp:??????? 0

Hugepagesize:?????? 2048 kB停止數據庫實例

5.???????? 重啟服務器,一般重啟服務器之后DB也自動啟動了。服務器和DB重啟后可以通過以下命令驗證大頁的使用情況:

grep -i Hugepages /proc/meminfo

此時查看Oracle的alert日志,也可以發現:

Starting ORACLE instance (normal)

************************ Large Pages Information *******************

Per process system memlock (soft) limit = UNLIMITED

Total Shared Global Region in Large Pages = 58 GB (96%)

Large Pages used by this instance: 29761 (58 GB)

Large Pages unused system wide = 24 (48 MB)

Large Pages configured system wide = 30739 (60 GB)

Large Page size = 2048 KB

RECOMMENDATION:

Total System Global Area size is 60 GB. For optimal performance,

prior to the next instance restart:

1. Increase the number of unused large pages by

at least 936 (page size 2048 KB, total size 1872 MB) system wide to

get 100% of the System Global Area allocated with large pages

可以發現sga并沒有全部放在大頁里,這樣可能對性能帶來負面影響,Oracle建議我們再加入936個大頁,可見Oracle的大頁腳本計算并不準確,我們需要增加大頁數量,并設置參數Use_large_pages=only,該參數確保Oracle的共享內存全部使用大頁。

再重啟DB,此時alert日志:

************************ Large Pages Information *******************

Parameter use_large_pages = ONLY

Per process system memlock (soft) limit = 100 GB

Total Shared Global Region in Large Pages = 60 GB (100%)

Large Pages used by this instance: 30721 (60 GB)

Large Pages unused system wide = 0 (0 KB)

Large Pages configured system wide = 31675 (62 GB)

Large Page size = 2048 KB

可以發現sga全部使用了大頁了。

另需確保環境變量DISABLE_HUGETLBFS unset,該變量會禁用Oracle使用Hugepage

附:計算HugePage大小的腳本:

#!/bin/bash

#

# hugepages_settings.sh

#

# Linux bash script to compute values for the

# recommended HugePages/HugeTLB configuration

#

# Note: This script does calculation for all shared memory

# segments available when the script is run, no matter it

# is an Oracle RDBMS shared memory segment or not.

#

# This script is provided by Doc ID 401749.1 from My Oracle Support

# http://support.oracle.com

# Welcome text

echo "

This script is provided by Doc ID 401749.1 from My Oracle Support

(http://support.oracle.com) where it is intended to compute values for

the recommended HugePages/HugeTLB configuration for the current shared

memory segments. Before proceeding with the execution please note following:

* For ASM instance, it needs to configure ASMM instead of AMM.

* The 'pga_aggregate_target' is outside the SGA and

you should accommodate this while calculating SGA size.

* In case you changes the DB SGA size,

as the new SGA will not fit in the previous HugePages configuration,

it had better disable the whole HugePages,

start the DB with new SGA size and run the script again.

And make sure that:

* Oracle Database instance(s) are up and running

* Oracle Database 11g Automatic Memory Management (AMM) is not setup

(See Doc ID 749851.1)

* The shared memory segments can be listed by command:

# ipcs -m

Press Enter to proceed..."

read

# Check for the kernel version

KERN=`uname -r | awk -F. '{ printf("%d.%d\n",$1,$2); }'`

# Find out the HugePage size

HPG_SZ=`grep Hugepagesize /proc/meminfo | awk '{print $2}'`

if [ -z "$HPG_SZ" ];then

echo "The hugepages may not be supported in the system where the script is being executed."

exit 1

fi

# Initialize the counter

NUM_PG=0

# Cumulative number of pages required to handle the running shared memory segments

for SEG_BYTES in `ipcs -m | cut -c44-300 | awk '{print $1}' | grep "[0-9][0-9]*"`

do

MIN_PG=`echo "$SEG_BYTES/($HPG_SZ*1024)" | bc -q`

if [ $MIN_PG -gt 0 ]; then

NUM_PG=`echo "$NUM_PG+$MIN_PG+1" | bc -q`

fi

done

RES_BYTES=`echo "$NUM_PG * $HPG_SZ * 1024" | bc -q`

# An SGA less than 100MB does not make sense

# Bail out if that is the case

if [ $RES_BYTES -lt 100000000 ]; then

echo "***********"

echo "** ERROR **"

echo "***********"

echo "Sorry! There are not enough total of shared memory segments allocated for

HugePages configuration. HugePages can only be used for shared memory segments

that you can list by command:

# ipcs -m

of a size that can match an Oracle Database SGA. Please make sure that:

* Oracle Database instance is up and running

* Oracle Database 11g Automatic Memory Management (AMM) is not configured"

exit 1

fi

# Finish with results

case $KERN in

'2.2') echo "Kernel version $KERN is not supported. Exiting." ;;

'2.4') HUGETLB_POOL=`echo "$NUM_PG*$HPG_SZ/1024" | bc -q`;

echo "Recommended setting: vm.hugetlb_pool = $HUGETLB_POOL" ;;

'2.6') echo "Recommended setting: vm.nr_hugepages = $NUM_PG" ;;

'3.8') echo "Recommended setting: vm.nr_hugepages = $NUM_PG" ;;

esac

# End

總結

以上是生活随笔為你收集整理的linux带page参数报错,Linux配置hugepage的全部內容,希望文章能夠幫你解決所遇到的問題。

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