请教一下SGA扩展的问题

[复制链接]
查看11 | 回复2 | 2005-10-30 17:05:33 | 显示全部楼层 |阅读模式
大家好,我想请教一下SGA扩展的问题:
OS:Red Hat Enterprise Linux AS release 3 (Taroon Update 3)
ORACLE

racle: setuid setgid ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.5, dynamically linked (uses shared libs), not stripped
MEM:4G

现在我想把SGA扩展到2.7G.
查阅了相关文档(http://www1.ap.dell.com/content/ ... 妓狄?葱幸韵旅?睿?/a>
降低mapped_base
在更改shmmax内核参数之后,管理员应当在操作系统级上更改用来启动Oracle实例的父shell。这个过程让父shell的子进程可以访问更多内存。要更改父shell,管理员应当完成以下步骤:
找到oracle用来启动数据库的shell的进程标识 (PID):
[root@oratest root]# echo $$
在另一个会话中以root身份,降低Oracle会话的mapped_base:
[root@oratest root]# echo 268435456 > /proc/$pid/mapped_base

在前面的语句中,$pid 指的是启动Oracle的shell的PID, 268435456 是0x10000000的十进制形式。
问题:
在执行 #echo $$后,pid为4915,
然后我执行]# echo 268435456 > /proc/4915/mapped_base
结果却说:
# -bash: /proc/177/mapped_base: No such file or directory
这是什么原因呢?
回复

使用道具 举报

千问 | 2005-10-30 17:05:33 | 显示全部楼层
Applies to:
Linux Kernel - Version: 10.1.0.3.0
Linux x86
Goal
The goal of this NOTE is to detail the proper configuration of RHEL 3 to obtain a 2.7Gb System Global Area (SGA).This applies to 32-bit Linux platforms with more that 4Gb of RAM, and is outdated by 64-bit Linux hardware platforms.
Solution
WARNING:This implementation severely restricts the remaining 32-bit address space.Processes that rely upon this 32-bit address space, such as the Oracle executable,will be very cramped for memory.Oracle instead recommends that Customer use:
choice A:VLM for the db_block_buffers via shared memory filesystem (ramfs) and hugepages to
- reduce CPU usage by using 2MB hugepages rather than 4k pages
- not have so much pressure on the 32-bit address space.See Note 260152.1 for additional information.
choice B:the hugemem kernel, which would allow the processes it's own, separate 32-bit address space.See Note 260152.1 for additional information
choice C:a combination of the A) and B) above, as explained in Note 260152.1 .

The following procedure will get you to a SGA of 2.7Gb without using either the VLM strategy or the hugemem kernel that are referenced in Note 260152.1
1.) Modify shmmax to be 1/2 of your total RAM.The maximum value for SHMMAX for a 32-bit system (no matter what the physical RAM size beyond 4Gb) is:
echo "4294967295" > /proc/sys/kernel/shmmax

2.) Relocate the SGA:

cd $ORACLE_HOME/rdbms/lib
cp ksms.s ksms.s_orig
genksms -s 0Xe000000 > ksms.s
make -f ins_rdbms.mk ksms.o
make -f ins_rdbms.mk ioracle
A ksms.s value of 0x15000000 will result in a maximum SGA of approximately 2592Mb.The ksms.s value of 0Xe000000 that is prescribed above will result in a maximum SGA of approximately 2800Mb
3. drop the oracle process stacklimit from 10MB to 4MB before startup as follows:

ulimit -s 4096
4. set init.ora parameters:

*.db_cache_size=2400m
*.shared_pool_size=200m
*.java_pool_size=83886080
*.large_pool_size=8388608
This will report a Total System Global Area of 2937135428 bytes, or 2.735Gb
References
Note 260152.1 - Summary About the Large SGA & Address Space on RH Linux
Note 262004.1 - Configuring RHEL 3 and Oracle 9iR2 with Hugetlb and Remap_file_pages
回复

使用道具 举报

千问 | 2005-10-30 17:05:33 | 显示全部楼层
PURPOSE
-------
This article will assist you to clarify which is the
max SGA size value according the differents kernels and methodology to increase it.

SCOPE & APPLICATION
-------------------
This is intended for Linux system administrators and for IA-32 architecture.
On Itanium processor there are not particular limits because
bypassed in a 64 bit executable.

INTRODUCTION
------------
~ Very Large Memory (VLM) on systems with up to 64GB of RAM
is the ability to use up to 64GB pagecache on 32-bit system.
The Advanced Server 2.1 and 3.0 kernel allows Oracle to allocate and use more than
4GB of memory for the database buffer cache on a 32-bit Intel platform. This
feature is also called VLM (Very Large Memory) in Oracle documents. With
Oracle9iR2 on Red Hat Linux Advanced Server, the SGA can be increased
to a theoretical limit of about 62GB depending on the available RAM memory
on the system. Current hardware limitations and practical considerations further
limit the actual size of SGA that can be configured, but it is still several times
larger than the size of the SGA without VLM. Running in VLM mode requires
some setup changes to Linux and imposes some limitations on what features and
init.ora parameters can be used.

~ PAE (Page Address Extensions)
In order to get above 4GB virtual memory on IA-32 architecture a technique
known as PAE (Page Address Extensions) is used.
It is a method that translates 32-bit (2**32 = 4GB) linear addresses
to 36-bit (2**36 = 64GB) physical addresses. In the linux kernel, the support
is provided through a compile time option that produces two
separate kernels the SMP kernel which supports only upto 4GB VM
and the enterprise kernel which can go up to 64GB VM
(also called Very Large Memory 'VLM' capable).
The enterprise kernel is able to use up to 64GB pagecache
without any modifications. This means applications like oracle
can make use of the large memory and scale up
to a large number of users without loss of performance or reliability.
(shmfs/tmpfs,ramfs is implemented using PAE)
See also
http://en.wikipedia.org/wiki/Physical_Address_Extension

- Red Hat Linux Advanced Server 2.1

~ Large SGA size capability through changing of mapped_base (Ref. [1], [2])

The default address where oracle is loaded from is 0x50000000 and the

default mapped base is 0x40000000 (decimal 1073741824). The space between

0x40000000 to 0x5000000 is reserved for loading oracle libraries. If the

mapped_base is lowered to 0x10000000 (decimal 268435456), then the space

between 0x10000000 to 0x15000000 is used for loading the oracle libraries.

Oracle executable will start getting loaded from 0x15000000 thus allowing a

bigger SGA and a larger window size. The lowered values of mapped base

specified above are examples, and the user should set these to values

appropriate for their systems. In order to use this method

It will be necessary relocating the SGA attach address.



|
|
|
|


|
|
|
|


|
|
|
|


|
|
|
|


|
| oracle libraries
| 0x50000000 |


|
|
+------------+



|
|
|
|


|
|Original Base
| 0x40000000 |decimal 1073741824


|
+------------+


|
|
|


|
|
|


|
|
|


|
|
|


|
oracle libraries
| 0x15000000 |


|
+------------+


|
|
|


|Lowered Base
| 0x10000000 |
decimal 268435456


+------------+


|
|



+------------+



Note:

Lowering mapped_base is a method available only

on RedHat Advanced Server (RHAS) 2.1

this is automatically done in Red Hat Enterprise Linux 3.0


~ Shared memory file-system(shmfs) support (Ref. [1], [2])

Memory-based file system optimized for shared memory operations

and for larger SGA size.


- Red Hat Enterprise Linux 3.0 - 4.0

~ hugemem kernel (Ref. [3], [4], [5])

Red Hat Enterprise Linux 3.0/4.0 includes a new kernel known as the

hugemem kernel. This kernel supports a 4GB per process user space

(versus 3GB for the other kernels), and a 4GB direct kernel space.

Using this kernel allows Red Hat Enterprise Linux to run on systems

with up to 64GB of main memory. The hugemem kernel is required in

order to use all the memory in system configurations containing more

than 16GB of memory. The hugemem kernel can also benefit

configurations running with less memory (if running an application

that could benefit from the larger per process user space, for example.)

The hugemem kernel feature is also called 4GB-4GB Split Kernel

A classic 32-bit 4GB virtual address space is split 3GB

for user processes and 1GB for the kernel

The new scheme (4gb/4gb) permits 4GB of virtual address space

for the kernel and almost 4GB for each user process




3GB:1GB Split



0Gb 1Gb 2Gb 3Gb 4Gb

|-------------|-------------|-------------|-------------|

|-->
Per-User Process
Kernel
Per-User Process
Kernel
>>SGA MAX Size 1.7 GB 4 – 1 – 1 – 0.3 = 1.7GB left for SGA



A picture of Memory Layout:




---------------------------








4GB +------------------+ 0xFFFFFFFF




|
|




|Kernel stuff|




|
| 0xE0000000 SSKGMTOP




|
|(from sskgm.h may17 label)




|
|




3GB +------------------+ 0xC0000000 __PAGE_OFFSET




||Stack grows| (include/asm-i386/page.h)




|vdown...|




2.98GB|------------------| 0xBF000000




|
|




|
|




|Oracle SGA|




|max 1776MB|




|max 1.75GB|




|
|




|
|




|
|




|
|




|
|




|
|




|
|




|
|




1.25GB+------------------| 0x50000000GENKSMS_SGA_ADDR




| Shared libraries |




| lib*.so|




|
|




|
|




|
|




|
|




1GB +------------------+ 0x40000000TASK_UNMAPPED_BASE




| applicaton code|




|(Oracle .text)|
^




|
|
|




|
| 0x20000000SSKGMBOTTOM|




|
| (from sskgm.h may17 label) |




|
|
|




|
|
|




128MB |------------------| 0x08000000
|




|
|
|




|
|
|




0 +------------------+ 0x00000000
|










~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

~ RedHat Advanced Server (RHAS) 2.1

~

~ Configuration : 3+1 & lower mapped Base Address

~ ->> 3Gb user process + 1gb Kernel + lower mapped Base Address

~

~ >>>SGA MAX Size 2.7 GB /proc/sys/kernel/shmmax

- Relocating the SGA (low SGA attach address):

% cd $ORACLE_HOME/rdbms/lib

% cp ksms.s ksms.s_orig

% genksms -s 0x15000000> ksms.s

% make -f ins_rdbms.mk ksms.o

% make -f ins_rdbms.mk ioracle



- lower the mapped base for a single bash terminal session

1.Open a terminal session (Oracle session).

2.Open a second terminal session and su to root (root session).

3.Find out the process id for the Oracle session.

For example: do "echo $$" in the Oracle session.

4.Now lower the mapped base for the Oracle session to 0x10000000.

From the root session, echo 268435456 >/proc//mapped_base,

whereis the process id determined in step 4.

5.From the Oracle terminal session, startup the Oracle instance.

The SGA now begins at a lower address, so more of the address

space can be used by Oracle.



Now you can increase the init.ora values of db_cache_size or db_block_buffers

to increase the size of the database buffer cache.

In this case the max SGA size will be 2.7 GB


Linux memory layout after lowering lower mapped Base Address:

-------------------------------------------------------------



4GB+------------------+ 0xFFFFFFFF

|
|

|Kernel stuff|

|
|

|
|

|
|

3GB+------------------+ 0xC0000000__PAGE_OFFSET

||Stack grows|(include/asm-i386/page.h)

|vdown...|

2.98GB |------------------| 0xBF000000SSKGMTOP

|
|

|
|

|Oracle SGA|

|max 2720MB|

|max 2.65GB|

|
|

|
|

|
|

|
|

|
|

|
|

|
|

|
|

|
|

336MB+------------------+ 0x15000000SSKGMBOTTOM

| Shared libraries |
(GENKSMS_SGA_ADDR)

| lib*.so|

256MB|------------------| 0x10000000TASK_UNMAPPED_BASE

| applicaton code|

I(Oracle .text)I

128MB+------------------+ 0x08000000

|
|

|
|

0|------------------| 0x00000000




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


~ RedHat Enterprise Linux (RHEL) 3.0 - 4.0

~

~ Default Configuration : 4gb/4gb split (hugemem kernel)

~

~ >>>SGA MAX Size 2.7 GB>>SGA MAX Size 3.42 GB 4GB – 0.33GB – 0.25GB = 3.42



How to lower the SGA attach address in short, for details see [1]Note 211424.1:



- Modify shmmax:

% echo 3000000000 > /proc/sys/kernel/shmmax

- Relocating the SGA:

% cd $ORACLE_HOME/rdbms/lib

% cp ksms.s ksms.s_orig

% genksms -s 0x15000000> ksms.s

% make -f ins_rdbms.mk ksms.o

% make -f ins_rdbms.mk ioracle



- Note:

Lowering 'mapped_base' for a single bash terminal session is a method

available only on RedHat Advanced Server (RHAS) 2.1

This is not need on Red Hat Enterprise Linux 3.0/4.0 because automatically done.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


~ RedHat Advanced Server(RHAS) 2.1(shmfs/tmpfs)

~ RedHat Enterprise Linux (RHEL) 3.0(shmfs/tmpfs, ramfs)

~

~ Configuration : VLM mode + in-memory filesystem (shmfs/tmpfs, ramfs)

~

~ >>>SGA MAX Size 62GB/proc/sys/kernel/shmmax



- Set the init.ora parameter use_indirect_data_buffers=true



- Startup oracle.





. How to use the memory file system ramfs in short,

for details see [4]Note 262004.1:



- Mount the shmfs file system as root using command:

% umount /dev/shm

% mount -t ramfs ramfs /dev/shm

% chown oracle:dba /dev/shm



- Increase the "max locked memory" ulimit (ulimit -l)

Add the following to /etc/security/limits.conf:

oracle softmemlock 3145728

oracle hardmemlock 3145728

(in case of ssh see details on [4]Note 262004.1)



- Set the init.ora parameter use_indirect_data_buffers=true



- Startup oracle.


CONCLUSION
----------
A process on a 32 bit platform can not address more than 4Gb directly.
This means we can only get 1Gb more if we use RHEL 3.0 with 4gb/4gb split kernel.
If we need larger shared pool (large Buffer Cache) We have to use VLM,
this means shmfs and indirect buffers.
With a 4Gb| lower mapped Base Address | 2.7 GB|[1,2]|
|--------|------------------|-----|---------------------------|-------------|-----|





| AS 2.1 | all| 4Gb|low SGA attach address(***)| 3.42 GB | |





|--------|------------------|-----|---------------------------|-------------|-----|





| AS 3/4 | hugemem—SMP| 64Gb| in-memory filesystem|62 GB (*)|[4,9]|





|---------------------------------------------------------------------------------|









(*) theoretic depending on phisical RAM and on block size
(**) depending on block size
(***) +4gb/4gb split, with ahttp://otn.oracle.com/tech/linux ... x-Tech-WP-Final.PDF
- Linux Virtual Memory in Red Hat Linux Advanced Server 2.f/linuxVM-WP-022 REFERENCE
.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行