Maximum size of SGA on Linux

Source: Internet
Author: User
Article Title: the maximum size of SGA on Linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

In Linux, the size of all SGA files is limited to 2 GB. There are multiple ways to allocate more memory for SGA, but the most reliable and flexible method needs to use shared memory files, for example, in shmfs under RHEL2.1 or ramfs under RHEL3, 4, and 5, this article describes how to create a large cache on Red Hat Enterprise Linux and its clone version.

Red Hat Enterprise Linux (RHEL) 2.1
Create a shared memory file system (shmfs)

Shmfs is a memory file system, so it can be as large as the maximum size of virtual memory supported by Red Hat Linux AS2.1, although theoretically the Enterprise Edition kernel supports more than 64 GB memory, but the current maximum is 16 GB.
Shmfs is created by the root user using the following command:
Mount-t shm shmfs-o size = 3g/dev/shm
By adding the following line to/etc/fstab, the shared memory file system can be automatically mounted:
Shmfs/dev/shm size = 3g 0 0
In the above example, I created a 3G shmfs, which is also the cache size I plan to use. Other SGA components are placed in the regular memory, instead of in this shared memory file system, do not include shmfs in the shmfs, which is slightly larger than the actual size, in this example, I use 3G shmfs as the cache.

Enable big Page Support
In the/boot/grub. conf file, add bigpages = xMB to the related kernel entries and then enable large page support. Here, x is calculated as follows:
Total SGA size (unit: G) x 1024
Then we take a whole hundred points around this value. Therefore, a 4g sga is calculated as follows:
4*1024 = 4096 = 4100
Therefore, the/boot/grub. conf file entry looks like:
Kernel/vmlinuz-2.4.9-e.40enterprise ro root =/dev/cciss/c0d0p2 bigpages = 4100 MB
After saving the file, restart the system and run the following command as the root user:
Echo 2>/proc/sys/kernel/shm-use-bigpages
You can add a line in the/etc/sysctl. conf file to fix the value:
Kernel. shm-use-bigpages = 2

Red Hat Enterprise Linux (RHEL) 3, 4, and 5
Mount the ramfs file system and make sure it is available to oracle.
Umount/dev/shm
Mount-t ramfs/dev/shm
Chown oracle: oinstall/dev/shm
Add these commands to the/etc/rc. local file. Like RHEL2.1, only the cache is stored in this location.
Because Oracle locks the shared memory for the shared pool, we must go to/etc/security/limits. modify the memlock parameter in conf. memlock is expressed in Kb. Therefore, for a 2G shared pool, we must at least (2*1024*1024 = 2097152), as shown below:
Oracle soft memlock 2097152
Oracle hard memlock 2097152
In fact, it is better to be a little bigger than this value.

Set the SHMMAX Value
For a 32-bit architecture, the shmmax value should be set to half the physical memory, and the maximum value is 4294967295. For a server with 6 GB memory, we can use the following command as the root user to set this value to 3 GB (half of the physical memory ):
Echo 3221225472>/proc/sys/kernel/shmmax
You can also set it in the/etc/sysctl. conf file:
Kernel. shmmax = 3221225472
Your/etc/sysctl. conf file should look like the following:
Kernel. shmmax = 3221225472
Kernel. shmmni = 4096
Kernel. shmall = 2097152
Kernel. sem = 1000 32000 100 150
Fs. file-max = 65536
Net. ipv4.ip _ local_port_range = 1024 65000
Kernel. shm-use-bigpages = 2
After modifying the/etc/sysctl. conf file, use the following command to apply it without restarting the system:
/Sbin/sysctl-p

Instance Parameters
You must modify some instance parameters to allow the oracle instance to use the shared memory file system. On a running instance, you can use the alter system set command or modify the spfile parameter offline ,:
-- Change the parameter value in the spfile directly.
Alter system set parameter = value SCOPE = spfile

-- Create a pfile with the contents of the current spfile.
Create pfile = '/tmp/pfile' from spfile;

-- Manually manipulate the contents of the pfile.

-- Recreate the spfile from the amended pfile.
Create spfile from pfile = '/tmp/pfile ';
The following parameters should be added to spfile or pfile:
Use_indirect_data_buffers = true
At the same time, all parameters related to db_cache_size and db_xK_cache should be removed and replaced by the old db_blcok_buffers parameter entries:
# 3Gig for an 8 K db_block_size. (3*1024*1024)/8) = 393216
Db_block_buffers = 393216
This means that the multi-block size feature will be unavailable when this method is used. Remember that cache is only part of SGA.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.