unix/linux下的共享内存、信号量、队列信息管理
在unix/linux下,经常有因为共享内存、信号量,队列等共享信息没有干净地清楚而引起一些问题。
查看共享信息的内存的命令是ipcs [-m|-s|-q]。

默认会列出共享内存、信号量,队列信息,-m列出共享内存,-s列出共享信号量,-q列出共享队列
清除命令是ipcrm [-m|-s|-q] id。
-m 删除共享内存,-s删除共享信号量,-q删除共享队列。

 

1.1  故障发生现象及解决过程

oracle的进程已经关闭,但是执行sqlplus的时候hang住,之后报错ORA-09925: Unable to create audit trail file,加-prelim也不行,主要是oracle的进程已经关掉了,但是sqlplus却进不去。

[ZFLHRDB4:oracle]:/oracle>ps -ef|grep ora_

[ZFLHRDB4:oracle]:/oracle>

 

[ZFLHRDB4:oracle]:/oracle>sqlplus / as sysdba

 

SQL*Plus: Release 11.2.0.4.0 Production on Tue May 31 14:39:47 2016

 

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

 

 

 

 

 

ERROR:

ORA-09925: Unable to create audit trail file

IBM AIX RISC System/6000 Error: 2: No such file or directory

Additional information: 9925

ORA-09925: Unable to create audit trail file

IBM AIX RISC System/6000 Error: 2: No such file or directory

Additional information: 9925

 

 

[ZFLHRDB4:oracle]:/oracle>

[ZFLHRDB4:oracle]:/oracle>

[ZFLHRDB4:oracle]:/oracle>

[ZFLHRDB4:oracle]:/oracle>

[ZFLHRDB4:oracle]:/oracle>sqlplus -prelim / as sysdba

 

SQL*Plus: Release 11.2.0.4.0 Production on Tue May 31 14:40:26 2016

 

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

 

 

 

 

 

 

 

ERROR:

ORA-09925: Unable to create audit trail file

IBM AIX RISC System/6000 Error: 2: No such file or directory

Additional information: 9925

ORA-09925: Unable to create audit trail file

IBM AIX RISC System/6000 Error: 2: No such file or directory

Additional information: 9925

 

 

[ZFLHRDB4:oracle]:/oracle>ipcs

IPC status from /dev/mem as of Tue May 31 14:42:01 BEIST 2016

T        ID     KEY        MODE       OWNER    GROUP

Message Queues:

q         0 0x9283a0d2 -Rrw-------     root   system

q         1 0xffffffff -----------     root   system

 

Shared Memory:

m         3 0x210000ac --rw-rw----     root   system

m 395313156 0x0ecaefdc --rw-r-----   oracle asmadmin

m   9437189   00000000 --rw-r-----   oracle asmadmin

m 276824070   00000000 --rw-r-----   oracle asmadmin

m 912261127 0x210000d4 --rw-rw----     grid      dba

Semaphores:

s   3145728 0x0100324a --ra-ra-r--     root   system

s         1 0x620025b4 --ra-r--r--     root   system

s         2 0x02001958 --ra-ra-ra-     root   system

s         3 0x01001958 --ra-ra-ra-     root   system

s         9 0x010024be --ra-------     root   system

s   3145738 0x410000ab --ra-ra----     root   system

s        21 0x410000cb --ra-ra----     grid      dba

[ZFLHRDB4:oracle]:/oracle>ipcrm -m 395313156

[ZFLHRDB4:oracle]:/oracle>ipcs

IPC status from /dev/mem as of Tue May 31 14:42:23 BEIST 2016

T        ID     KEY        MODE       OWNER    GROUP

Message Queues:

q         0 0x9283a0d2 -Rrw-------     root   system

q         1 0xffffffff -----------     root   system

 

Shared Memory:

m         3 0x210000ac --rw-rw----     root   system

m   9437189   00000000 --rw-r-----   oracle asmadmin

m 276824070   00000000 --rw-r-----   oracle asmadmin

m 912261127 0x210000d4 --rw-rw----     grid      dba

Semaphores:

s   3145728 0x0100324a --ra-ra-r--     root   system

s         1 0x620025b4 --ra-r--r--     root   system

s         2 0x02001958 --ra-ra-ra-     root   system

s         3 0x01001958 --ra-ra-ra-     root   system

s         9 0x010024be --ra-------     root   system

s   3145738 0x410000ab --ra-ra----     root   system

s        21 0x410000cb --ra-ra----     grid      dba

[ZFLHRDB4:oracle]:/oracle>ipcrm -m 9437189

[ZFLHRDB4:oracle]:/oracle>ipcrm -m 276824070

[ZFLHRDB4:oracle]:/oracle>ipcs

IPC status from /dev/mem as of Tue May 31 14:42:39 BEIST 2016

T        ID     KEY        MODE       OWNER    GROUP

Message Queues:

q         0 0x9283a0d2 -Rrw-------     root   system

q         1 0xffffffff -----------     root   system

 

Shared Memory:

m         3 0x210000ac --rw-rw----     root   system

m 912261127 0x210000d4 --rw-rw----     grid      dba

Semaphores:

s   3145728 0x0100324a --ra-ra-r--     root   system

s         1 0x620025b4 --ra-r--r--     root   system

s         2 0x02001958 --ra-ra-ra-     root   system

s         3 0x01001958 --ra-ra-ra-     root   system

s         9 0x010024be --ra-------     root   system

s   3145738 0x410000ab --ra-ra----     root   system

s        21 0x410000cb --ra-ra----     grid      dba

[ZFLHRDB4:oracle]:/oracle>sqlplus / as sysdba

 

SQL*Plus: Release 11.2.0.4.0 Production on Tue May 31 14:42:46 2016

 

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

 

Connected to an idle instance.

 

SYS@oraDESDB2>

 

 

其中68281.1中提到DETERMINING WHICH INSTANCE OWNS WHICH SHARED MEMORY SEGMENTS & SEMAPHORE SETS,即若是一个主机上有多个oracle实例的话该如何确定哪个共享内存段属于我们该清掉的oracle实例的内存段,下边给个小实验即可,相关的MOS文档可以去小麦苗的云盘下载。

 

[ZFXDESKDB2:oracle]:/oracle>ps -ef|grep ora_pmon_

  oracle 12255344 21626964   0 17:43:01  pts/0  0:00 grep ora_pmon_

  oracle 17629238        1   0 18:57:42      -  0:09 ora_pmon_raclhr2

  oracle 20250806        1   0 18:57:42      -  0:10 ora_pmon_oraESKDB2

[ZFXDESKDB2:oracle]:/oracle>which sysresv

/oracle/app/oracle/product/11.2.0/db/bin/sysresv

[ZFXDESKDB2:oracle]:/oracle>ORACLE_SID=raclhr2

[ZFXDESKDB2:oracle]:/oracle>sysresv

 

IPC Resources for ORACLE_SID "raclhr2" :

Shared Memory:

ID              KEY

5242886         0xffffffff

5242883         0xffffffff

1048583         0xd92489e0

Oracle Instance alive for sid "raclhr2"

[ZFXDESKDB2:oracle]:/oracle>ipcs

IPC status from /dev/mem as of Wed Jun  1 17:43:47 BEIST 2016

T        ID     KEY        MODE       OWNER    GROUP

Message Queues:

q         0 0x9283a0d2 -Rrw-------     root   system

q         1 0xffffffff -----------     root   system

 

Shared Memory:

m   1048576   00000000 --rw-r-----     grid      dba

m   1048577   00000000 --rw-r-----     grid      dba

m   1048578 0x210000aa --rw-rw----     root   system

m   5242883   00000000 --rw-r-----   oracle asmadmin

m   1048580   00000000 --rw-r-----   oracle asmadmin

m   1048581   00000000 --rw-r-----   oracle asmadmin

m   5242886   00000000 --rw-r-----   oracle asmadmin

m   1048583 0xd92489e0 --rw-r-----   oracle asmadmin

m   1048584 0xd1a4a5d8 --rw-r-----     grid      dba

m   8388617 0x3f516768 --rw-r-----   oracle asmadmin

m 759169034 0x21000148 --rw-rw----   oracle      dba

Semaphores:

s   3145728 0x0100324a --ra-ra-r--     root   system

s         1 0x620025b4 --ra-r--r--     root   system

s         2 0x02001958 --ra-ra-ra-     root   system

s         3 0x01001958 --ra-ra-ra-     root   system

s         9 0x010024be --ra-------     root   system

s   1048590 0x410000a8 --ra-ra----     root   system

s  11534361 0x41000147 --ra-ra----   oracle      dba

[ZFXDESKDB2:oracle]:/oracle>ipcs -m

IPC status from /dev/mem as of Wed Jun  1 17:43:56 BEIST 2016

T        ID     KEY        MODE       OWNER    GROUP

Shared Memory:

m   1048576   00000000 --rw-r-----     grid      dba

m   1048577   00000000 --rw-r-----     grid      dba

m   1048578 0x210000aa --rw-rw----     root   system

m   5242883   00000000 --rw-r-----   oracle asmadmin

m   1048580   00000000 --rw-r-----   oracle asmadmin

m   1048581   00000000 --rw-r-----   oracle asmadmin

m   5242886   00000000 --rw-r-----   oracle asmadmin

m   1048583 0xd92489e0 --rw-r-----   oracle asmadmin

m   1048584 0xd1a4a5d8 --rw-r-----     grid      dba

m   8388617 0x3f516768 --rw-r-----   oracle asmadmin

m 759169034 0x21000148 --rw-rw----   oracle      dba

[ZFXDESKDB2:oracle]:/oracle>ipcrm -m 5242886

[ZFXDESKDB2:oracle]:/oracle>ipcrm -m 5242883

[ZFXDESKDB2:oracle]:/oracle>ipcrm -m 1048583

[ZFXDESKDB2:oracle]:/oracle>sysresv

 

IPC Resources for ORACLE_SID "raclhr2" :

Shared Memory

ID              KEY

No shared memory segments used

Oracle Instance not alive for sid "raclhr2"

Oracle Instance not alive for sid "raclhr2"

[ZFXDESKDB2:oracle]:/oracle>ps -ef|grep ora_pmon_

  oracle 17629238        1   0 18:57:42      -  0:09 ora_pmon_raclhr2

  oracle 20250806        1   0 18:57:42      -  0:10 ora_pmon_oraESKDB2

  oracle 23330844 21626964   0 17:44:46  pts/0  0:00 grep ora_pmon_

[ZFXDESKDB2:oracle]:/oracle>sqlplus / as sysdba

 

SQL*Plus: Release 11.2.0.4.0 Production on Wed Jun 1 17:44:52 2016

 

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

 

Connected to an idle instance.

 

SYS@raclhr2> shutdown abort

ORACLE instance shut down.

SYS@raclhr2> exit

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,

Data Mining and Real Application Testing options

 

 

 

 故障处理总结

 

① ipcs和ipcrm应该学会使用

② sysresv的使用可以查看对应实例的共享内存段

③ 文章中的所有MOS文章在小麦苗的云盘中http://yunpan.cn/cdEQedhCs2kFz (提取码:ed9b) 

④ 关于ipcs的使用cuug的老师也讲过公开课,公开课的录像文件参考http://yunpan.cn/cdEQedhCs2kFz (提取码:ed9b) 

 

 About Me

....................................................................................................................................................

本文作者:小麦苗,只专注于数据库的技术,更注重技术的运用

于 2016-04-06 10:00~ 2016-04-11 19:00 在中行完成

【版权所有,文章允许转载,但须以链接方式注明源地址,否则追究法律责任】

....................................................................................................................................................

IPCS和IPCRM使用_共享内存

本文分享自微信公众号 - DB宝(lhrdba)。
如有侵权,请删除。