ID 1321306.1
修改时间 19-OCT-2011 类型 HOWTO 状态 REVIEWED |
In this Document
Goal
Solution
References
Applies to:
Oracle Server - Enterprise Edition - Version: 11.1.0.7 to 11.2.0.2 - Release: 11.1 to 11.2Linux x86
Linux x86-64
Goal
Oracle is creating hundreds of thousands open file descriptors in /dev/shm (open files)
$ lsof -n | grep /dev/shm | wc -l
247455
247455
But there are only just hundreds of files in /dev/shm
$ ls -l /dev/shm/* | wc -l
262
262
1. Why is Oracle keeping hundreds of thousands Open File descriptors in /dev/shm while there are just hundreds of files ?
2. Is this a known issue? ( any notes/documents/bug reports/fixes exist).
3. Or is this expected behavior. of oracle?
Solution
1) Let's use a test database (11.1.0.7) to demonstrate how Automatic Memory Management uses file descriptors and why there are so many Open File descriptors.
A) Before starting the 11.1.0.7 database, /dev/shm is empty and there are no open files
$ ls -l /dev/shm
total 0
$ lsof -n | grep /dev/shm
B) Let's start the database, then check /dev/shm
UNIX> sqlplus " / as sysdba"
SQL*Plus: Release 11.1.0.7.0 - Production on Fri May 6 14:57:28 2011
Copyright (c) 1982, 2008, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 845348864 bytes
Fixed Size 1316656 bytes
Variable Size 578816208 bytes
Database Buffers 260046848 bytes
Redo Buffers 5169152 bytes
Database mounted.
Database opened.
SQL> show parameter memory_target
NAME TYPE VALUE
-------------- ----------- ------
memory_target big integer 808M
SQL> show parameter memory_max_target
NAME TYPE VALUE
----------------- ------------- ------
memory_max_target big integer 808M
C) let's check /dev/shm again
UNIX> ls -l /dev/shm/* | wc -l
203
UNIX> lsof -n | grep /dev/shm | wc -l
4872
$ ls -l /dev/shm
total 0
$ lsof -n | grep /dev/shm
B) Let's start the database, then check /dev/shm
UNIX> sqlplus " / as sysdba"
SQL*Plus: Release 11.1.0.7.0 - Production on Fri May 6 14:57:28 2011
Copyright (c) 1982, 2008, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 845348864 bytes
Fixed Size 1316656 bytes
Variable Size 578816208 bytes
Database Buffers 260046848 bytes
Redo Buffers 5169152 bytes
Database mounted.
Database opened.
SQL> show parameter memory_target
NAME TYPE VALUE
-------------- ----------- ------
memory_target big integer 808M
SQL> show parameter memory_max_target
NAME TYPE VALUE
----------------- ------------- ------
memory_max_target big integer 808M
C) let's check /dev/shm again
UNIX> ls -l /dev/shm/* | wc -l
203
UNIX> lsof -n | grep /dev/shm | wc -l
4872
Number of files in /dev/shm
-----------------------------------------
There are 203 files ( 4 MB size, which is the granule size)
This is approximately MEMORY_TARGET/4MB
Since MEMORY_TARGET < 1 GB, 203 x 4 MB files are created
For a larger MEMORY_TARGET, the number of files in /dev/shm = MEMORY_TARGET/granule size
See Note 947152.1 How to determine granule size.
Number of open files descriptors
------------------------------------------------
There are 4872 open files handles why ?
After starting the 11.1.0.7 database, 24 background processes were created
UNIX> ps -ef | grep -i | wc -l
24
Each background process open 203 files x 24 = 4872
UNIX> lsof -n | grep /dev/shm | wc -l
4872
Please note that there are no connections to the database yet. Oracle is not leaking file descriptors.
For each instance running on the server, each Oracle background process will open files under /dev/shm for the suitable instance. Those files will be opened as long as the database is running. No connections are required
In a dedicated server environment, a dedicated process is created for each database connection.
Each dedicated process needs to connect to /dev/shm shared memory segments, so opens MEMORY_TARGET/ file descriptors. In addition, it generates file descriptors for each datafile.
These file descriptors persist until the connections are terminated.
2) That is the expected behavior. and it is also documented in the Reference Manual
Oracle Database Administrator's Reference
11g Release 1 (11.1) for Linux and UNIX-Based Operating Systems
Part Number B32009-09
Appendix C
Administering Oracle Database on Linux
C.6 Allocating Shared Resources
"The number of file descriptors for each Oracle instance are increased by 512*PROCESSES. Therefore, the maximum number of file descriptors should be at least this value, plus some more for the operating system requirements. For example, if the cat /proc/sys/fs/file-max command returns 32768 and PROCESSES are 100, you can set it to 6815744 or higher as root, to have 51200 available for Oracle."
11g Release 1 (11.1) for Linux and UNIX-Based Operating Systems
Part Number B32009-09
Appendix C
Administering Oracle Database on Linux
C.6 Allocating Shared Resources
"The number of file descriptors for each Oracle instance are increased by 512*PROCESSES. Therefore, the maximum number of file descriptors should be at least this value, plus some more for the operating system requirements. For example, if the cat /proc/sys/fs/file-max command returns 32768 and PROCESSES are 100, you can set it to 6815744 or higher as root, to have 51200 available for Oracle."
References
NOTE:787780.1 - Open Files/Open File DescriptorsNOTE:947152.1 - How to determine granule size
产品
|
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/38267/viewspace-713685/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/38267/viewspace-713685/