中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

如何使用lock_sga和pre_page_sga參數保證SGA常駐物理內存

發布時間:2021-11-09 10:36:32 來源:億速云 閱讀:141 作者:柒染 欄目:建站服務器

本篇文章給大家分享的是有關如何使用lock_sga和pre_page_sga參數保證SGA常駐物理內存,小編覺得挺實用的,因此分享給大家學習,希望大家閱讀完這篇文章后可以有所收獲,話不多說,跟著小編一起來看看吧。

通過修改lock_sga和pre_page_sga參數可以保證SGA不被換出到虛擬內存,進而可以提高SGA的使用效率。通過這個小文兒給大家展示一下這兩個參數的修改過程,不要太樂觀,修改過程是存在“小坎坷”的。

當lock_sga參數設置為TRUE時(默認值是FALSE),可以保證整個SGA被鎖定在物理內存中,這樣可以防止SGA被換出到虛擬內存。只要設置lock_sga為“TRUE”便可保證SGA被鎖定在物理內存中,這里之所以順便將pre_page_sga參數也設置為“TRUE”,是因為這樣可以保證在啟動數據庫時把整個SGA讀入到物理內存中,以便提高系統的效率(雖然會增加系統的啟動時間)。

修改過程如下:

1.查看lock_sga和pre_page_sga參數的默認值
sys@ora10g> show parameter sga

NAME            TYPE                 VALUE
--------------- -------------------- -----------------
lock_sga        boolean              FALSE
pre_page_sga    boolean              FALSE
sga_max_size    big integer          5G
sga_target      big integer          5G

2.注意:兩個參數都是靜態參數。確認之。
sys@ora10g> alter system set lock_sga=true;
alter system set lock_sga=true
                 *
ERROR at line 1:
ORA-02095: specified initialization parameter cannot be modified


sys@ora10g> alter system set pre_page_sga=true;
alter system set pre_page_sga=true
                 *
ERROR at line 1:
ORA-02095: specified initialization parameter cannot be modified

3.使用“scope=spfile”選項修改之,成功。
sys@ora10g> alter system set lock_sga=true scope=spfile;

System altered.

sys@ora10g> alter system set pre_page_sga=true scope=spfile;

System altered.

4.重新啟動Oracle使spfile的修改生效
sys@ora10g> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
sys@ora10g> startup;
ORA-27102: out of memory
Linux-x86_64 Error: 12: Cannot allocate memory

“小坎坷”出現了,想一想,這里為什么會啟動失敗呢?
原因很簡單,Linux操作系統對每一個任務在物理內存中能夠鎖住的最大值做了限制!需要手工進行調整。

5.“ORA-27102”及“Cannot allocate memory”問題處理
1)使用“ulimit -a”命令獲得“max locked memory”的默認大小
ora10g@secDB /home/oracle$ ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 266239
max locked memory       (kbytes, -l) 32
max memory size         (kbytes, -m) unlimited
open files                      (-n) 65536
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 10240
cpu time               (seconds, -t) unlimited
max user processes              (-u) 16384
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

可見,一個任務可以鎖住的物理內存最大值是32kbytes,這么小的值根本無法滿足我們SGA的5G大小需求。

2)將其修改為無限大
(1)oracle用戶是無法完成這個修改任務的
ora10g@secDB /home/oracle$ ulimit -l unlimited
-bash: ulimit: max locked memory: cannot modify limit: Operation not permitted

(2)切換到root用戶
ora10g@secDB /home/oracle$ su - root
Password:

(3)在root用戶下嘗試修改,成功。
[root@secDB ~]# ulimit -l unlimited
[root@secDB ~]# ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 266239
max locked memory       (kbytes, -l) unlimited
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 10240
cpu time               (seconds, -t) unlimited
max user processes              (-u) 2047
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

6.調整完操作系統的限制后,我們再次嘗試啟動數據庫。成功!
[root@secDB ~]# su - oracle
ora10g@secDB /home/oracle$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.3.0 - Production on Sun Dec 20 22:21:40 2009

Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.

Connected to an idle instance.

NotConnected@> startup;
ORACLE instance started.

Total System Global Area 5368709120 bytes
Fixed Size                  2080320 bytes
Variable Size             905970112 bytes
Database Buffers         4445962240 bytes
Redo Buffers               14696448 bytes
Database mounted.
Database opened.

7.lock_sga和pre_page_sga參數在Oracle 10gR2官方文檔中的描述。

LOCK_SGA

PropertyDescription
Parameter typeBoolean
Default valuefalse
ModifiableNo
Range of valuestrue | false
BasicNo

LOCK_SGA locks the entire SGA into physical memory. It is usually advisable to lock the SGA into real (physical) memory, especially if the use of virtual memory would include storing some of the SGA using disk space. This parameter is ignored on platforms that do not support it.


http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/initparams168.htm#REFRN10174

PRE_PAGE_SGA

PropertyDescription
Parameter typeBoolean
Default valuefalse
ModifiableNo
Range of valuestrue | false

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.


通過修改lock_sga和pre_page_sga參數值為“TRUE”可以有效的將整個SGA鎖定在物理內存中,這樣可以有效的提高系統的性能,推薦酌情進行調整。
注意:不同的操作系統對這lock_sga參數的支持情況是不同的,如果操作系統不支持這種鎖定,lock_sga參數將被忽略。

以上就是如何使用lock_sga和pre_page_sga參數保證SGA常駐物理內存,小編相信有部分知識點可能是我們日常工作會見到或用到的。希望你能通過這篇文章學到更多知識。更多詳情敬請關注億速云行業資訊頻道。

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

sga
AI

明星| 友谊县| 东海县| 山西省| 通山县| 波密县| 特克斯县| 土默特左旗| 微山县| 宜兴市| 平谷区| 荔波县| 修水县| 湾仔区| 民县| 怀化市| 琼中| 鞍山市| 虞城县| 乐至县| 阿克陶县| 华安县| 沂水县| 镇远县| 延安市| 广灵县| 凉城县| 磐石市| 大城县| 榆树市| 洛南县| 安顺市| 贵港市| 高安市| 抚远县| 贵南县| 鹤山市| 南皮县| 彭山县| 东辽县| 平武县|