好贷网好贷款

使用lock_sga和pre_page_sga参数保证SGA常驻物理内存 .

发布时间:2016-12-3 3:53:59 编辑:www.fx114.net 分享查询网我要评论
本篇文章主要介绍了"使用lock_sga和pre_page_sga参数保证SGA常驻物理内存 .",主要涉及到使用lock_sga和pre_page_sga参数保证SGA常驻物理内存 .方面的内容,对于使用lock_sga和pre_page_sga参数保证SGA常驻物理内存 .感兴趣的同学可以参考一下。

Lock_sgaLOCK_SGA locks the entire SGA into physical memory. It is usually advisable to lockthe SGA into real (physical) memory, especially if the use of virtual memory wouldinclude storing some of the SGA using disk space. This parameter is ignored onplatforms that do not support it.PropertyDescriptionParameter typeBooleanDefault valuefalseModifiableNoRange of valuestrue | falseBasic NoPRE_PAGE_SGAPRE_PAGE_SGA determines whether Oracle reads the entire SGA into memory atinstance 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 fullperformance capacity after startup. PRE_PAGE_SGA can increase the process startup duration, because every process thatstarts 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 processstarts. This approach can be useful with some applications, but not with allapplications. Overhead can be significant if your system frequently creates anddestroys processes by, for example, continually logging on and logging off.The advantage that PRE_PAGE_SGA can afford depends on page size. For example, ifthe SGA is 80 MB in size and the page size is 4 KB, then 20,000 pages must be touchedto 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 touchedto refresh the SGA (80,000/4,000 = 20). The page size is operating system-specific andgenerally cannot be changed. Some operating systems, however, have a specialimplementation for shared memory whereby you can change the page size. 通过修改lock_sga和pre_page_sga参数可以保证SGA不被换出到虚拟内存,进而可以提高SGA的使用效率。当lock_sga参数设置为TRUE时(默认值是FALSE),可以保证整个SGA被锁定在物理内存中,这样可以防止SGA被换出到虚拟内存。只要设置lock_sga为“TRUE”便可保证SGA被锁定在物理内存中,这里之所以顺便将pre_page_sga参数也设置为“TRUE”,是因为这样可以保证在启动数据库时把整个SGA读入到物理内存中,以便提高系统的效率(虽然会增加系统的启动时间)。AIX 5L(AIX 4.3.3以上)1. aix参数v_pinshm=1,默认是0,表示aix将支持pin住内存,设置方法为#vmo -p -o v_pinshm=12. aix参数maxpin%=内存百分比,默认80%,表示支持的最大的可pin住内存的比例,设置方法为#vmo -p -o maxpin%=903. oracle参数LOCK_SGA=true,表示oracle将使用这部分被pin住的内存,其实就是告诉oracle使用另外一种内存调用方法。HP UNIX1. root用户,创建权限配置文件/etc/privgroup# touch /etc/privgroup# vi /etc/privgroup添加"dba MLOCK"到该文件2. root用户,执行命令# /etc/setprivgrp -f /etc/privgroup3. oracle用户,修改Oracle参数lock_sga=trueSOLARIS (solaris2.6以上)8i版本以上数据库默认使用隐藏参数 use_ism = true,自动锁定SGA于内存中,不用设置lock_sga。如果设置 lock_sga =true 使用非 root 用户启动数据库将返回错误。WINDOWS不能设置lock_sga=true,可以通过设置pre_page_sga=true,使得数据库启动的时候就把所有内存页装载,这样可能起到一定的作用。Red Hat5 Linux 2.64bit1.查看lock_sga和pre_page_sga参数的默认值代码:tacsoft> show parameter sgaNAME                     TYPE                 VALUE---------------            -------------------- -----------------lock_sga              boolean              FALSEpre_page_sga    boolean              FALSEsga_max_size    big integer          5Gsga_target           big integer          5G2 重新启动Oracle使spfile的修改生效代码:SQL> alter system set lock_sga=true scope=spfile;System altered.SQL> alter system set pre_page_sga=true scope=spfile;System altered.sql > shutdown immediate;Database closed.Database dismounted.ORACLE instance shut down.tacsoft> startup;ORA-27102: out of memoryLinux-x86_64 Error: 12: Cannot allocate memory失败原因,Linux操作系统对每一个任务在物理内存中能够锁住的最大值做了限制!需要手工进行调整。5.“ORA-27102”及“Cannot allocate memory”问题处理1)使用“ulimit -a”命令获得“max locked [email protected]:[/u01/app/oracle/product/11.2.0/db_1/sqlplus/admin]  ulimit -acore file size                          (blocks, -c)             0data seg size                         (kbytes, -d)            unlimitedscheduling priority                (-e)                          0file size                                    (blocks, -f)             unlimitedpending signals                    (-i)                          139264max locked memory             (kbytes, -l)             32max memory size                  (kbytes, -m)          unlimitedopen files                                (-n)                        1024pipe size                                  (512 bytes, -p)     8POSIX message queues     (bytes, -q)             819200real-time priority                     (-r)                           0stack size                                (kbytes, -s)           10240cpu time                                   (seconds, -t)       unlimitedmax user processes             (-u)                        2047virtual memory                        (kbytes, -v)           unlimitedfile locks                                  (-x)                         unlimited可见,一个任务可以锁住的物理内存最大值是32kbytes,这么小的值根本无法满足我们SGA的大小需求。2)在root用户下尝试修改,成功。代码:[[email protected] ~]# ulimit -l unlimited[[email protected] ~]# ulimit -acore file size                          (blocks, -c)             0data seg size                         (kbytes, -d)            unlimitedscheduling priority                (-e)                          0file size                                    (blocks, -f)             unlimitedpending signals                    (-i)                          139264max locked memory             (kbytes, -l)             unlimitedmax memory size                  (kbytes, -m)          unlimitedopen files                                (-n)                        1024pipe size                                  (512 bytes, -p)     8POSIX message queues     (bytes, -q)             819200real-time priority                     (-r)                           0stack size                                (kbytes, -s)           10240cpu time                                   (seconds, -t)       unlimitedmax user processes             (-u)                        2047virtual memory                        (kbytes, -v)           unlimitedfile locks                                  (-x)                         unlimited调整完操作系统的限制后,我们再次尝试启动数据库。成功!代码:[[email protected] ~]# su - [email protected] /home/oracle$ sqlplus / as sysdbaSQL*Plus: Release 10.2.0.3.0 - Production on Sun Dec 20 22:21:40 2009Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.Connected to an idle instance.NotConnected@> startup;ORACLE instance started.Total System Global Area 5368709120 bytesFixed Size                  2080320 bytesVariable Size             905970112 bytesDatabase Buffers         4445962240 bytesRedo Buffers               14696448 bytesDatabase mounted.Database opened.   

上一篇:<<内部类>>--黑马程序员
下一篇:Android的三种网络通信方式

相关文章

相关评论