search
HomeDatabaseMysql TutorialLinux配置HugePage

对于内存较大的Oracle数据库服务器,配置HugePage是很有必要的,下面是配置Huge的步骤:

对于内存较大的Oracle数据库服务器,配置HugePage是很有必要的,下面是配置Huge的步骤:

我的环境:

OS:CentOS release 6.4 (Final)

Oracle:11.2.0.4 RAC

Oracle 大内存需要配置HugePage

在Oracle 11.2.0.3.0上开启大页(HugePages)的详细解析

Linux HugePages及MySQL 大页配置

Linux HugePage 特性

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的共享内存全部使用大页。

更多详情见请继续阅读下一页的精彩内容:

linux

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
MySQL String Types: Storage, Performance, and Best PracticesMySQL String Types: Storage, Performance, and Best PracticesMay 10, 2025 am 12:02 AM

MySQLstringtypesimpactstorageandperformanceasfollows:1)CHARisfixed-length,alwaysusingthesamestoragespace,whichcanbefasterbutlessspace-efficient.2)VARCHARisvariable-length,morespace-efficientbutpotentiallyslower.3)TEXTisforlargetext,storedoutsiderows,

Understanding MySQL String Types: VARCHAR, TEXT, CHAR, and MoreUnderstanding MySQL String Types: VARCHAR, TEXT, CHAR, and MoreMay 10, 2025 am 12:02 AM

MySQLstringtypesincludeVARCHAR,TEXT,CHAR,ENUM,andSET.1)VARCHARisversatileforvariable-lengthstringsuptoaspecifiedlimit.2)TEXTisidealforlargetextstoragewithoutadefinedlength.3)CHARisfixed-length,suitableforconsistentdatalikecodes.4)ENUMenforcesdatainte

What are the String Data Types in MySQL?What are the String Data Types in MySQL?May 10, 2025 am 12:01 AM

MySQLoffersvariousstringdatatypes:1)CHARforfixed-lengthstrings,2)VARCHARforvariable-lengthtext,3)BINARYandVARBINARYforbinarydata,4)BLOBandTEXTforlargedata,and5)ENUMandSETforcontrolledinput.Eachtypehasspecificusesandperformancecharacteristics,sochoose

How to Grant Permissions to New MySQL UsersHow to Grant Permissions to New MySQL UsersMay 09, 2025 am 12:16 AM

TograntpermissionstonewMySQLusers,followthesesteps:1)AccessMySQLasauserwithsufficientprivileges,2)CreateanewuserwiththeCREATEUSERcommand,3)UsetheGRANTcommandtospecifypermissionslikeSELECT,INSERT,UPDATE,orALLPRIVILEGESonspecificdatabasesortables,and4)

How to Add Users in MySQL: A Step-by-Step GuideHow to Add Users in MySQL: A Step-by-Step GuideMay 09, 2025 am 12:14 AM

ToaddusersinMySQLeffectivelyandsecurely,followthesesteps:1)UsetheCREATEUSERstatementtoaddanewuser,specifyingthehostandastrongpassword.2)GrantnecessaryprivilegesusingtheGRANTstatement,adheringtotheprincipleofleastprivilege.3)Implementsecuritymeasuresl

MySQL: Adding a new user with complex permissionsMySQL: Adding a new user with complex permissionsMay 09, 2025 am 12:09 AM

ToaddanewuserwithcomplexpermissionsinMySQL,followthesesteps:1)CreatetheuserwithCREATEUSER'newuser'@'localhost'IDENTIFIEDBY'password';.2)Grantreadaccesstoalltablesin'mydatabase'withGRANTSELECTONmydatabase.TO'newuser'@'localhost';.3)Grantwriteaccessto'

MySQL: String Data Types and CollationsMySQL: String Data Types and CollationsMay 09, 2025 am 12:08 AM

The string data types in MySQL include CHAR, VARCHAR, BINARY, VARBINARY, BLOB, and TEXT. The collations determine the comparison and sorting of strings. 1.CHAR is suitable for fixed-length strings, VARCHAR is suitable for variable-length strings. 2.BINARY and VARBINARY are used for binary data, and BLOB and TEXT are used for large object data. 3. Sorting rules such as utf8mb4_unicode_ci ignores upper and lower case and is suitable for user names; utf8mb4_bin is case sensitive and is suitable for fields that require precise comparison.

MySQL: What length should I use for VARCHARs?MySQL: What length should I use for VARCHARs?May 09, 2025 am 12:06 AM

The best MySQLVARCHAR column length selection should be based on data analysis, consider future growth, evaluate performance impacts, and character set requirements. 1) Analyze the data to determine typical lengths; 2) Reserve future expansion space; 3) Pay attention to the impact of large lengths on performance; 4) Consider the impact of character sets on storage. Through these steps, the efficiency and scalability of the database can be optimized.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Atom editor mac version download

Atom editor mac version download

The most popular open source editor