[20170209]理解pre_page_sga参数.txt

[20170209]理解pre_page_sga参数.txt

--昨天测试pre_page_sga=true的情况:
http://blog.itpub.net/267265/viewspace-2133198/

--//再次看看官方的定义:
http://docs.oracle.com/cd/E11882_01/server.112/e40402/initparams201.htm#REFRN10174

PRE_PAGE_SGA determines whether Oracle reads the entire SGA into memory at instance startup. Operating system page table
entries are then prebuilt for each page of the SGA. This setting can increase the amount of time necessary for instance
startup, but it is likely to decrease the amount of time necessary for Oracle to reach its full performance capacity
after startup.

Note:

This setting does not prevent your operating system from paging or swapping the SGA after it is initially read into
memory.

PRE_PAGE_SGA can increase the process startup duration, because every process that starts must access every page in the
SGA. The cost of this strategy is fixed; however, you might simply determine that 20,000 pages must be touched every
time a process starts. This approach can be useful with some applications, but not with all applications. Overhead can
be significant if your system frequently creates and destroys processes by, for example, continually logging on and
logging off.

The advantage that PRE_PAGE_SGA can afford depends on page size. For example, if the SGA is 80 MB in size and the page
size is 4 KB, then 20,000 pages must be touched to refresh the SGA (80,000/4 = 20,000).

If the system permits you to set a 4 MB page size, then only 20 pages must be touched to refresh the SGA (80,000/4,000 =
20). The page size is operating system-specific and generally cannot be changed. Some operating systems, however, have a
special implementation for shared memory whereby you can change the page size.

--//按照上面的定义如果我使用hupapage,这样启动数据库时,应该会加载全部页面.还是测试看看:

1.环境:
--//首先修改参数vm.nr_hugepages=600.
# sysctl -p
# sysctl vm.nr_hugepages
vm.nr_hugepages = 600

2.pre_page_sga=false ,使用hugepage的情况:

SYS@book> startup
ORACLE instance started.
Total System Global Area  634732544 bytes
Fixed Size                  2255792 bytes
Variable Size             197133392 bytes
Database Buffers          427819008 bytes
Redo Buffers                7524352 bytes
Database mounted.
Database opened.

SYS@book> show parameter pre_page_sga
NAME         TYPE     VALUE
------------ -------- -------
pre_page_sga boolean  FALSE

$ cat /proc/meminfo | grep -i page
AnonPages:        173732 kB
PageTables:        11052 kB
AnonHugePages:     38912 kB
HugePages_Total:     600
HugePages_Free:      393
HugePages_Rsvd:       98
HugePages_Surp:        0
Hugepagesize:       2048 kB

--//alert内存如下:
************************ Large Pages Information *******************
Per process system memlock (soft) limit = 51 GB
Total Shared Global Region in Large Pages = 610 MB (100%)
Large Pages used by this instance: 305 (610 MB)
Large Pages unused system wide = 295 (590 MB)
Large Pages configured system wide = 600 (1200 MB)
Large Page size = 2048 KB
********************************************************************

--实际上现在使用600-393=207.
--HugePages_Rsvd:       98
--207+98=305 正好对上. 换一句化将现在还有98页面块没有使用.仅仅使用207块.

--HugePages_Total-HugePages_Free+HugePages_Rsvd 就是 目前实例需要的页面数量.

3.pre_page_sga=true ,使用hugepage的情况:
SYS@book> alter system set pre_page_sga=true scope=spfile ;
System altered.

--//重启数据库.
$ cat /proc/meminfo | grep -i page
AnonPages:        179820 kB
PageTables:        11984 kB
AnonHugePages:     43008 kB
HugePages_Total:     600
HugePages_Free:      295
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB

--//检查alert*.log文件:
************************ Large Pages Information *******************
Per process system memlock (soft) limit = 51 GB
Total Shared Global Region in Large Pages = 610 MB (100%)
Large Pages used by this instance: 305 (610 MB)
Large Pages unused system wide = 295 (590 MB)
Large Pages configured system wide = 600 (1200 MB)
Large Page size = 2048 KB
********************************************************************
--//HugePages_Rsvd是0.
--//600-295=305,使用305.

--//也就是pre_page_sga=true的情况下,启动时使用全部sga内存.而不像pre_page_sga=false那样,逐渐加载使用内存.

--//如果设置vm.nr_hugepages = 305,正好使用完,更加好理解,不再测试,留给大家测试.

时间: 2024-09-20 17:21:53

[20170209]理解pre_page_sga参数.txt的相关文章

[20170215]再次理解flush redo.txt

[20170215]再次理解flush redo.txt --链接: http://blog.itpub.net/267265/viewspace-1992583/ http://blog.itpub.net/267265/viewspace-1992840/ 在Oracle 11g里,Data Guard 切换多了一个新的功能:flush redo. flush redo就是出现问题时,Flush可以把没有发送的redo从主库传送到standby数据库.而只要主库能启动到mount状态,那么F

Lock_sga 和 pre_page_sga 参数详解

Lock_sga 和 pre_page_sga 参数详解        Lock_sga 和pre_page_sga,是两个平时用的不算太多的参数,但是这两个参数平时在优化的时候可能给你带来比较乐观的性能提升,通过修改lock_sga和pre_pga_sga参数可以保证SGA不被换出到swap,进而而已提高SGA的使用效率.      当lock_sga参数的值修改设置为true的时候,可以保证整个sga被锁定在物理内存中,这样可以防止sga被换出到swap中:当然理当需要把pre_page_s

[20171206]SQLTUNE_CATEGORY参数.txt

[20171206]SQLTUNE_CATEGORY参数.txt --//今天提示别人使用sql profile优化语句,使用DBMS_SQLTUNE.import_sql_profile的引入替换功能.一般我的测试 --//category参数是'',也就是NULL.如果指定如何优化确定优化有效呢? --//链接:http://www.itpub.net/thread-2094823-1-1.html --//实际上就是修改参数SQLTUNE_CATEGORY. --//https://doc

[20170313]11G use_large_pages参数.txt

[20170313]11G use_large_pages参数.txt --11G 增加参数use_large_pages,可以灵活使用hugepages. 1.环境: SYS@book> @ &r/ver1 PORT_STRING                    VERSION        BANNER ------------------------------ -------------- --------------------------------------------

[20150126]datadump的非文档参数.txt

[20150126]datadump的非文档参数.txt --总结一下expdp/impdp的非文档参数: 1. METRICS METRICS=Y ,记录执行详细的执行时间.例子: $ expdp scott/btbtms DIRECTORY=DATA_PUMP_DIR  DUMPFILE=emp012601.dmp LOGFILE=emp012601.log tables=emp metrics=y Export: Release 11.2.0.3.0 - Production on Mon

[20161123]failover与会话参数.txt

[20161123]failover与会话参数.txt --前几天itpub上有人问的问题,链接http://www.itpub.net/thread-2071933-1-1.html,开始我以为是会话没有退出. --实际上对方已经重启过数据库,不过后来我估计对方打开登录审计,从结果上猜测是正确的,不过我的问题是我想了解 --会话在支持failover时,重新连接上时会话参数是否还是原来的,还有审计是否还有效(在已经关闭相关审计的情况下). --测试是最好的证明,还是通过例子来说明问题. 1.环

[20151126]IMPDP TRANSFORM参数.TXT

[20151126]IMPDP TRANSFORM参数.TXT --最近要建立一个测试库,原来生产系统的一些表在定义时 STORAGE    (             INITIAL          8G             ....            ) NOPARALLEL; --实际我不需要建立这个大的INITIAL表,而且可能许多还是空的.有些我可能仅仅导入少量数据,这样要浪费大量磁盘空间,并且测试 --机器磁盘空间也不足.不能这样导入. --另外一个问题有一些表我设置PCT

[20171211]检查dg配置参数.txt

[20171211]检查dg配置参数.txt --//写一个脚本,用来检查dg配置参数. col name    for a30 col value   for a120 col ses_mod for a10 col sys_mod for a10 col ins_mod for a10 col type format 99999 SELECT p.name,        p.type,        p.value,        p.isses_modifiable      as SE

[20130105]expdp的include和exclude参数.txt

[20130105]expdp的include和exclude参数.txt http://www.itpub.net/thread-1754104-1-1.html 如果include,exclude参数很长,可以通过建立一张表来实现.自己做一些测试(注直接在命令行输入语法加入斜线,很烦!): 1.使用include参数:$ cat par.txtDIRECTORY=DATA_PUMP_DIRDUMPFILE=scott.dmpINCLUDE=TABLE:"IN (Select table_na