[20170704]JOXSHM_EXT_x files on Linux

简介: [20170704]JOXSHM_EXT_x files on Linux.txt --//昨天看链接www.itpub.net/thread-2089507-1-1.

[20170704]JOXSHM_EXT_x files on Linux.txt

--//昨天看链接www.itpub.net/thread-2089507-1-1.html时,发现我的一台测试机器有1堆文件在目录/dev/shm下:

$ ls -l /dev/shm | head
total 724
-rwxrwx---  1 oracle11g oinstall  4096 2015-07-08 08:38:44 JOXSHM_EXT_0_test_30113794
-rwxrwx---  1 oracle11g oinstall  4096 2015-07-08 08:38:45 JOXSHM_EXT_10_test_30113794
-rwxrwx---  1 oracle11g oinstall  4096 2015-07-08 08:38:45 JOXSHM_EXT_11_test_30113794
-rwxrwx---  1 oracle11g oinstall  4096 2015-07-08 08:38:45 JOXSHM_EXT_12_test_30113794
-rwxrwx---  1 oracle11g oinstall 12288 2015-07-08 08:38:45 JOXSHM_EXT_13_test_30113794
-rwxrwx---  1 oracle11g oinstall  4096 2015-07-08 08:38:45 JOXSHM_EXT_14_test_30113794
-rwxrwx---  1 oracle11g oinstall  4096 2015-07-08 08:38:45 JOXSHM_EXT_15_test_30113794
-rwxrwx---  1 oracle11g oinstall  4096 2015-07-08 08:38:45 JOXSHM_EXT_16_test_30113794
-rwxrwx---  1 oracle11g oinstall  4096 2015-07-08 08:38:45 JOXSHM_EXT_17_test_30113794

--//还可以发现这些打头的文件:
-rwx------ 1 oracle oinstall   3824 2016-09-02 09:45:42 PESLD_book_4e98004_10218b6900000000
-rwx------ 1 oracle oinstall  40200 2016-09-02 09:45:46 PESLD_book_4e98004_406e246900000000
-rwx------ 1 oracle oinstall   1104 2016-09-02 09:45:48 PESLD_book_4e98004_704f9b7d00000000
-rwx------ 1 oracle oinstall    608 2016-09-02 09:46:17 PESLD_book_4e98004_9001327d00000000
-rwx------ 1 oracle oinstall   2096 2016-09-02 09:45:46 PESLD_book_4e98004_b867926900000000
-rwx------ 1 oracle oinstall   1832 2016-09-02 09:45:48 PESLD_book_4e98004_c06b9f7d00000000
-rwx------ 1 oracle oinstall    720 2017-05-09 11:17:51 PESLD_book_a250003_b8749a7b00000000

$ du -sk /dev/shm
724     /dev/shm
--//占用空间不大仅仅724K.
--//google,发现如下连接://blog.tanelpoder.com/2014/05/09/what-the-heck-are-the-devshmjoxshm_ext_x-files-on-linux/.
--//按照文章的介绍,test应该对应是sid,而我这个实例早不存在.而里面存在一堆文件.我仅仅估计异常关闭数据库时没有清理.
--//我通过测试说明情况:

SYS@book> @ &r/ver1
PORT_STRING                    VERSION        BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx            11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

SCOTT@book> SHOW PARAMETER jit
NAME              TYPE     VALUE
----------------- -------- ------
java_jit_enabled  boolean  TRUE

$ ls -l /dev/shm | wc
    573    4578   49135
--//当前573个!!
SCOTT@book> @ &r/spid
       SID    SERIAL# SPID       PID  P_SERIAL# C50
---------- ---------- ------ ------- ---------- --------------------------------------------------
        56         11 57854       29          4 alter system kill session '56,11' immediate;

SCOTT@book> SELECT DBMS_JAVA.GETVERSION FROM dual;
GETVERSION
-----------
11.2.0.4.0

$ ls -l /dev/shm | wc
    737    5890   63129

--//你可以发现执行后文件数量增加了.737-573=164
$ ls -l /dev/shm | grep 2017-07-04 | wc
    164    1312   13994
--//注我喜欢讲ls定义别名如下
$ alias ls
alias ls='ls --color=auto --time-style=+"%Y-%m-%d %H:%M:%S"'
--//这样当天的日期能正常显示.比较符合国人的显示时间风格.
--//正好增加164个.

$ ls -l /dev/shm | grep 2017-07-04 | head
-rwxrwx--- 1 oracle oinstall   4096 2017-07-04 08:57:39 JOXSHM_EXT_0_book_188153859
-rwxrwx--- 1 oracle oinstall   4096 2017-07-04 08:57:39 JOXSHM_EXT_100_book_188153859
-rwxrwx--- 1 oracle oinstall   4096 2017-07-04 08:57:39 JOXSHM_EXT_101_book_188153859
-rwxrwx--- 1 oracle oinstall   4096 2017-07-04 08:57:39 JOXSHM_EXT_102_book_188153859
-rwxrwx--- 1 oracle oinstall   8192 2017-07-04 08:57:39 JOXSHM_EXT_103_book_188153859
-rwxrwx--- 1 oracle oinstall   4096 2017-07-04 08:57:40 JOXSHM_EXT_104_book_188153859
-rwxrwx--- 1 oracle oinstall   4096 2017-07-04 08:57:40 JOXSHM_EXT_105_book_188153859
-rwxrwx--- 1 oracle oinstall   8192 2017-07-04 08:57:40 JOXSHM_EXT_106_book_188153859
-rwxrwx--- 1 oracle oinstall   4096 2017-07-04 08:57:40 JOXSHM_EXT_107_book_188153859
-rwxrwx--- 1 oracle oinstall  53248 2017-07-04 08:57:40 JOXSHM_EXT_108_book_188153859

--//正常退出会话后.
$ ls -l /dev/shm | grep 2017-07-04 | wc
    164    1312   13994
--//可以发现依旧存在!!

SYS@book> shutdown immediate ;
Database closed.
Database dismounted.
ORACLE instance shut down.

$ ls -l /dev/shm | grep 2017-07-04 | wc
      0       0       0

--//你可以发现正常关闭这些文件会消失,或者这些内存的东西会回收.这样可以断定留下那些是异常关闭数据库留下的.
--//可以重复测试来证明自己的观点.

SYS@book> startup
ORACLE instance started.
Total System Global Area  634732544 bytes
Fixed Size                  2255792 bytes
Variable Size             197133392 bytes
Database Buffers          427819008 bytes
Redo Buffers                7524352 bytes
Database mounted.
Database opened.

$ ls -l /dev/shm | grep 2017-07-04 |wc
      0       0       0

SYS@book> SELECT DBMS_JAVA.GETVERSION FROM dual;
GETVERSION
-----------
11.2.0.4.0

$ ls -l /dev/shm | grep 2017-07-04 | wc
    145    1160   12360

SYS@book> shutdown abort
ORACLE instance shut down.

$ ls -l /dev/shm | grep 2017-07-04 | wc
    145    1160   12360

--//你可以发现异常关闭这些就留在/dev/shm中,消耗内存.估计进程异常kill,应该也是一样的.当然这些消耗的内存并不多,我查看几台
--//发现最大消耗9M.

--//我建议在启动数据库前实际上可以删除这些垃圾的.我全部清除后启动数据库一点问题都没有.当然要注意一些应用也可能使用这部分
--//内存,在删除前要仔细查看.
--//转抄官方的介绍:
http://docs.oracle.com/cd/E17116_01/doc/readmes.112/e11015/toc.htm#BABBCFHJ

30.1 Secure Database By Default Changes

The PUBLIC EXECUTE privilege for the DBMS_RANDOM PL/SQL package will be deprecated in future Oracle Database releases
(reference Bug 7591837). Users who need to run this PL/SQL package should be given explicit EXECUTE privileges.

30.2 Stale Native Code Files Are Being Cached

Natively compiled PL/SQL and native code generated by the JIT compiler for Oracle JVM, may be cached in operating system
files. The SHUTDOWN ABORT and SHUTDOWN IMMEDIATE commands do not clean these cached native code files (reference Bug
8527383).

To avoid problems caused by stale files in the cache, clean the files before restarting the database instance. The stale
files that belong to the instance can be identified by name. The name patterns are as follows where sid_name is the
system identifier name:

JOXSHM_EXT_*_sid_name_*
PESHM_EXT_*_sid_name_*
PESLD_sid_name_*

It is advisable to remove stale files as part of a startup script. For example, to clean stale files for the instance
passed to the startup csh script by name on Linux, add the following three lines to the startup script:

rm JOXSHM_EXT_*_$1_*
rm PESHM_EXT_*_$1_*
rm PESLD_$1_*

The location of the native cache depends on the platform. It is defined by the location of files created by the
operating system to implement shm_open requests on that platform. For example, Solaris stores shared memory segments in
/var/tmp/.SHMD and /tmp/.SHMD. Linux stores them in /dev/shm.




目录
相关文章
|
7月前
|
Linux
Linux中Too many open files 问题分析和解决
Linux中Too many open files 问题分析和解决
|
11月前
|
Linux Apache Python
【openstack排坑指南】 “too many open files” Linux系统文件句柄优化
【openstack排坑指南】 “too many open files” Linux系统文件句柄优化
147 0
|
安全 Linux
Linux - 修改系统的max open files、max user processes(附ulimit的使用方法)
Linux - 修改系统的max open files、max user processes(附ulimit的使用方法)目录 1 问题说明2 修改max open files3 修改max user processes4 附录: ulimit命令说明1 问题说明Linux 系统默认的max ope...
4656 0
|
Linux
ulimit open files linux打开文件数设置验证
1 #include 2 #include 3 #include 4 #include 5 #include 6 7 int main(int argc,char *argv[]){ 8 9 int fd; 10 char name[...
1006 0
|
Java Linux Apache
Jetty - linux -Too many open files
今天碰到个问题,jetty系统跑的时候点击页面突然报 internal server error 错,翻了一下日志,发现很多jsp not found的错误: 2013-11-28 04:29:16,500 WARN [SymmetricDS]...
1407 0
|
1天前
|
运维 关系型数据库 MySQL
day03-Linux运维-Xshell优化和Linux系统命令入门(2)
day03-Linux运维-Xshell优化和Linux系统命令入门(2)
day03-Linux运维-Xshell优化和Linux系统命令入门(2)
|
1天前
|
运维 Linux Shell
day03-Linux运维-Xshell优化和Linux系统命令入门(1)
day03-Linux运维-Xshell优化和Linux系统命令入门(1)
day03-Linux运维-Xshell优化和Linux系统命令入门(1)
|
1天前
|
运维 程序员 Linux
运维最全Linux 基本防火墙设置和开放端口命令,2024年最新程序员如何自我学习和成长
运维最全Linux 基本防火墙设置和开放端口命令,2024年最新程序员如何自我学习和成长