Linux Kernel Parameter and Oracle Parameter Adjustment

Source: Internet
Author: User

Linux Kernel Parameter size and Oracle has a large shutdown, such as ORA-27102 error, is caused by improper Kernel Parameter size. For details, refer to Blog:
Upon startup of Linux database get ORA-27102: out of memory Linux-X86_64 Error: 28: No space left on device
Http://www.bkjia.com/database/201202/119408.html
There is a similar problem in Oracle 11gR2:
Oracle 11gR2 RAC ORA-00845 MEMORY_TARGET not supported on this system solution
Http://www.bkjia.com/database/201202/119409.html
 
When installing Oracle, you can refer to the Oracle Installation documentation to set the relevant values. However, the values of some parameters still need to be adjusted based on our own situation.
 
 
1. Core parameters in Linux
# Vi/etc/sysctl. conf
Kernel. shmall = 2097152
Kernel. shmmax = 2147483648
Kernel. shmmni = 4096
Kernel. sem = 250 32000 100 128
Fs. file-max = 65536
Net. ipv4.ip _ local_port_range = 9000 65000
Net. core. rmem_default = 4194304
Net. core. rmem_max = 4194304
Net. core. wmem_default = 262144
Net. core. wmem_max = 262144
 
This parameter is saved in/etc/sysctl. conf. to modify the file, you do not need to restart the OS. You only need to run the following command:
#/Sbin/sysctl-p
 
The modified parameters can take effect.
 
 
2. kernel. shmmax Parameters
2.1 description
SHMMAX Available physical memory Defines the maximum allowable size of one shared memory segment. the SHMMAX setting shoshould be large enough to hold the entire SGA in one shared memory segment. A low setting can cause creation of multiple shared memory segments which may lead to performance degradation.
 
Shmmax is one of the most important parameters in core parameters. It is used to define the maximum value of a single shared memory segment. The shmmax setting should be large enough to accommodate the entire SGA in a shared memory segment, setting too low may lead to the creation of multiple shared memory segments, which may lead to a reduction in system performance.
SHMMAX is only a number used for comparison when the shared memory segment is created. When the shared memory segment is created by a Process, the operating system checks whether the required shared memory segment value is greater than the shmmax value. If yes, an error is thrown. At this time, the system will create one or more shared memory segments to meet the needs of the process. Generally, the number of shared memory segments does not have a direct relationship with system performance, nor does it have a major impact on performance.
 
When the instance is started and the Server Process is created, multiple small shared memory segments may cause slight system performance degradation at that time (you need to create multiple virtual address segments at startup, when a process is created, the process must be "identified" for multiple segments, which has some impact), but it will not be affected at other times. This means that if your program does not frequently Create Processes (and Destroy Them), performance is not a concern.
 
Oralce recommends SHMMAX> SGA (SGA_MAX_SIZE), so that there will be no or even slight performance degradation risks at any time.
 
2.2 example
As mentioned above, if shmmax is small and SGA, Oracle will create multiple shared memory segments. We can use Ipcs-sa to view the number of shared memory segments.
 
(1) view
[Root @ rac01 ~] # Cat/etc/sysctl. conf | grep kernel. shmmax
Kernel. shmmax = 20971520
[Root @ rac01 ~] # Ipcs-sa
 
------ Shared Memory Segments --------
Key shmid owner perms bytes nattch status
0x00000000 65537 oracle 640 4194304 27
0x00000000 98306 oracle 640 20971520 27
0x00000000 131075 oracle 640 20971520 27
0x00000000 163844 oracle 640 20971520 27
0x00000000 196613 oracle 640 20971520 27
0x00000000 229382 oracle 640 20971520 27
0x00000000 262151 oracle 640 20971520 27
0x00000000 294920 oracle 640 20971520 27
0xd2776b04 327689 oracle 640 20971520 27
 
------ Semaphore Arrays --------
Key semid owner perms nsems
0xfafd7074 360449 oracle 640 104
 
------ Message Queues --------
Key msqid owner perms used-bytes messages
 
Because the kernel. shmmax setting is too small, multiple shared memory segments are allocated.
 
The following changes are larger:
[Root @ rac01 ~] # Cat/etc/sysctl. conf | grep kernel. shmmax
Kernel. shmmax = 2147483648
[Root @ rac01 ~] # Sysctl-p
[Root @ rac01 ~] # Su-oracle
[Oracle @ rac01 ~] $ Sqlplus '/as sysdba'
 
SQL * Plus: Release 10.2.0.1.0-Production on Mon Nov 16 05:50:00 2009
 
Copyright (c) 1982,200 5, Oracle. All rights reserved.
 
Connected:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0-Production
With the Partitioning, Real Application Clusters, Oracle Label Security, OLAP
And Data Mining Scoring Engine options
 
SQL> startup force
ORACLE instance started.
 
Total System Global Area 167772160 bytes
Fixed Size 1218316 bytes
Variable Size 104859892 bytes
Database Buffers 58720256 bytes
Redo Buffers 2973696 bytes
Database mounted.
Database opened.
SQL> quit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0-Production
With the Partitioning, Real Application Clusters, Oracle Label Security, OLAP
And Data Mining Scoring Engine options
 
Let's take another look:
[Root @ rac01 ~] # Ipcs-sa
 
------ Shared Memory Segments --------
Key shmid owner perms bytes nattch status
0xd2776b04 360449 oracle 640 171966464 27
 
------ Semaphore Arrays --------
Key semid owner perms nsems
0xfafd7074 491521 oracle 640 104
 
------ Message Queues --------
Key msqid owner perms used-bytes messages
Only one memory segment is allocated.
 
3. kernel. shmall
 
The kernel. shmall parameter controls the number of pages in the shared memory. The parameter size is physical memory divided by pagesize;
 
View OS system page size
# Getconf PAGESIZE
4096
 
The pagesize shown here is 4 kb. If the maximum size of a shared memory segment is 16 GB, the number of pages to be shared is 16 GB/4KB = 16777216KB/4KB = 4194304 (page ), that is, 16 GB physical memory in 64 bit system, set the kernel. shmall = 4194304 meets the requirements, almost twice the original setting of 2097152.
 
 
4. kernel. shmmni Parameters
The shmmni Kernel Parameter is the maximum number of shared memory segments (note that this parameter is not shmmin, yes
Shmmni, shmmin indicates the minimum memory segment size ). The shmmni default value is 4096, which is generally enough.
 
 
5. fs. file-max Parameters
The fs. file-max value is 512 multiplied by processes.
For example, if there are 128 processes, file-max = 512*128 = 65536.
 
 
6. parameters to be adjusted in Oracle
 
An important parameter is introduced in Oracle 10g: SGA_TARGET, which is also a new feature of Oracle 10g. Automatic Shared Memory Management (ASMM) controls this feature only by the SGA_TARGE parameter. After this parameter is set, you do not need to specify the size for each memory zone. SGA_TARGET specifies the maximum memory size that SGA can use. The size of each memory in SGA is controlled by Oracle and does not need to be specified manually.
Oracle can adjust the size of each region at any time to reach the optimum system performance, and control the sum of them within the value specified by SGA_TARGET. Once a value is specified for SGA_TARGET (the default value is 0, that is, no ASMM is started), The ASMM is automatically started.
Features.
 
After the ASSM feature is enabled after SGA_TARGET is set for 10 Gb, the memory size of the following areas is dynamically shared:
* Buffer cache (DB_CACHE_SIZE)
* Shared pool (SHARED_POOL_SIZE)
* Large pool (LARGE_POOL_SIZE)
* Java pool (JAVA_POOL_SIZE)
* Streams pool (STREAMS_POOL_SIZE)
 
The memory size of other regions in SGA is still fixed and not shared. Its meaning is the same as that of SGA_MAX_SIZE, which also indicates the maximum size of SGA. Therefore, it has a limit that its size cannot be greater than that of SGA_MAX_SIZE.
In Oracle10g, SGA_MAX_SIZE still indicates the upper limit of SGA size, while SGA_TARGET is the sum of the maximum values of all SGA components, that is, when SGA_TARGET <SGA_MAX_SIZE, oracle will ignore the value of SGA_MAX_SIZE, and SGA_TARGET becomes the limitation of SGA in this instance. It can dynamically change the size, but cannot exceed the value of SGA_MAX_SIZE.
 
When SGA_TARGET <SGA_MAX_SIZE, The SGA_MAX_SIZE becomes the size of SGA_TARGET after the instance is restarted.
 
In 11g, this SGA_TARGET can only be set to the size equal to SGA_MAX_SIZE. The setting is smaller than it, and oracle will automatically adjust it for you. If the setting is larger than it, an error occurs. Now let's think about it. oracle's processing of SGA_TARGET is moving in the correct and simple direction.
 
An important benefit of SGA_TARGET is that it can optimize SGA utilization and save memory costs. After the ASMM is started, Oracle will automatically adjust the size of each region as needed, greatly reducing memory shortage in some regions, and there is a conflict between idle memory in some regions.
 
 
 
 
Bytes -------------------------------------------------------------------------------------------------------
Blog: http://blog.csdn.net/tianlesoftware
Email: dvd.dba@gmail.com

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.