[20260426]验证11g下pre_page_sga=true的一些细节.txt
--//验证几个问题。
1.在11g下pre_page_sga=true的情况下,sga内存是否全部分配。
2.在11g下pre_page_sga=true的情况下,是否会启动或者存在sa后台进程。
1.环境:
SYS@book> @ ver1
PORT_STRING VERSION BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx 11.2.0.4.0 Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
2.测试1:
--//在11g下pre_page_sga=true的情况下,sga内存是否全部分配。
SYS@book> alter system set pre_page_sga=true scope=spfile;
System altered.
SYS@book> shutdown immediate ;
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS@book> startup
ORACLE instance started.
Total System Global Area 801701888 bytes
Fixed Size 2257520 bytes
Variable Size 285216144 bytes
Database Buffers 507510784 bytes
Redo Buffers 6717440 bytes
Database mounted.
Database opened.
$ grep -i hugepages /proc/meminfo
AnonHugePages: 16384 kB
HugePages_Total: 385
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
--//可以发现全部分配,与21c的情况完全不同,21c总存在小量内存没有分配。
3.测试2:
--//在11g下pre_page_sga=true的情况下,是否会启动或者存在sa后台进程。
$ watch -n 0.1 "pgrep -l ora_sa00_book|ts.awk | tee -a p9.txt" [1/1]
Every 0.1s: pgrep -l ora_sa00_book|ts.awk | tee -a p9.txt
--//启动数据库:
$ cat p9.txt
--//说明11g不存在后台进程sa。
SYS@book> alter system set use_large_pages=false scope=spfile ;
System altered.
--//不使用hugepages看看。
$ watch -n 0.1 "pgrep -l ora_sa00_book|ts.awk | tee -a pa.txt"
--//启动数据库:
$ cat p9.txt
--//说明11g不存在后台进程sa。
4.收尾还原:
SYS@book> alter system set use_large_pages=only scope=spfile ;
System altered.
SYS@book> alter system reset pre_page_sga;
System altered.
--//还发现11g还记录了分配Large Pages的使用时间。查看alert日志:
Tue Apr 21 09:15:19 2026
Adjusting the default value of parameter parallel_max_servers
from 160 to 150 due to the value of parameter processes (180)
Starting ORACLE instance (normal)
DISM started, OS id=3422
************************ Large Pages Information *******************
Parameter use_large_pages = AUTO
Per process system memlock (soft) limit = 128 GB
Total Shared Global Region in Large Pages = 770 MB (100%)
Large Pages used by this instance: 385 (770 MB)
Large Pages unused system wide = 0 (0 KB)
Large Pages configured system wide = 385 (770 MB)
Large Page size = 2048 KB
Time taken to allocate Large Pages = 0.002841 sec
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
********************************************************************
--//大部分情况记录的是0.
$ grep -i "Time taken" alert_book.log
Time taken to allocate Large Pages = 0.002841 sec
Time taken to allocate Large Pages = 0.000000 sec
Time taken to allocate Large Pages = 0.000000 sec
Time taken to allocate Large Pages = 0.000000 sec
Time taken to allocate Large Pages = 0.000000 sec
Time taken to allocate Large Pages = 0.000000 sec
Time taken to allocate Large Pages = 0.000000 sec
$ egrep -i "^Time taken|^Parameter use_large_pages =" alert_book.log | grep -A1 "Parameter use_large_pages = AUTO"
Parameter use_large_pages = AUTO
Time taken to allocate Large Pages = 0.002841 sec
Parameter use_large_pages = AUTO
Time taken to allocate Large Pages = 0.000000 sec
--
Parameter use_large_pages = AUTO
Time taken to allocate Large Pages = 0.000000 sec
Parameter use_large_pages = AUTO
Time taken to allocate Large Pages = 0.000000 sec
Parameter use_large_pages = AUTO
Time taken to allocate Large Pages = 0.000000 sec
Parameter use_large_pages = AUTO
Time taken to allocate Large Pages = 0.000000 sec
Parameter use_large_pages = AUTO
Time taken to allocate Large Pages = 0.000000 sec
--//而且仅仅设置use_large_pages = AUTO的情况下,有记录。
--//21c下没有这个记录:
$ grep -i "Time taken" alert_book.log
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/267265/viewspace-3116915/ ,如需转载,请注明出处,否则将追究法律责任。