|修改时间 19-OCT-2011 类型 HOWTO 状态 REVIEWED|| |
In this Document
Applies to:Oracle Server - Enterprise Edition - Version: 22.214.171.124 to 126.96.36.199 - Release: 11.1 to 11.2Linux x86Linux x86-64
GoalOracle is creating hundreds of thousands open file descriptors in /dev/shm (open files)
$ lsof -n | grep /dev/shm | wc -lBut there are only just hundreds of files in /dev/shm
$ ls -l /dev/shm/* | wc -l1. 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?
Solution1) Let's use a test database (188.8.131.52) to demonstrate how Automatic Memory Management uses file descriptors and why there are so many Open File descriptors.
A) Before starting the 184.108.40.206 database, /dev/shm is empty and there are no open files 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 createdFor a larger MEMORY_TARGET, the number of files in /dev/shm = MEMORY_TARGET/granule sizeSee Note 947152.1 How to determine granule size.Number of open files descriptors------------------------------------------------There are 4872 open files handles why ?After starting the 220.127.116.11 database, 24 background processes were createdUNIX> ps -ef | grep -i | wc -l
$ ls -l /dev/shm
$ lsof -n | grep /dev/shm
B) Let's start the database, then check /dev/shm
UNIX> sqlplus " / as sysdba"
SQL*Plus: Release 18.104.22.168.0 - Production on Fri May 6 14:57:28 2011
Copyright (c) 1982, 2008, Oracle. All rights reserved.
Connected to an idle instance.
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
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
UNIX> lsof -n | grep /dev/shm | wc -l
24Each background process open 203 files x 24 = 4872UNIX> lsof -n | grep /dev/shm | wc -l
4872Please 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 requiredIn 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
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."
ReferencesNOTE:787780.1 - Open Files/Open File DescriptorsNOTE:947152.1 - How to determine granule size
来自 “ ITPUB博客 ” ，链接：http://blog.itpub.net/38267/viewspace-713685/，如需转载，请注明出处，否则将追究法律责任。