ipcs命令

1.ipcs 命令解释

用途报告进程间通信设施状态。

语法
ipcs [ -m] [ -q] [ -s] [ -S] [ -P] [ -l] [ -a | -b -c -o -p -t] [ -T] [ -C CoreFile] [ -N Kernel ] [ -X ]
Flags
-a 相当于使用了-b ,-c,-o,-p,-t标志
-b
Writes the maximum number of bytes in messages on queue for message queues, the size of segments for shared
memory, and the number of semaphores in each semaphores set.
-c
Writes the login name and group name of the user that made the facility.
-o
Writes the following usage information:
* Number of messages on queue
* Total number of bytes in messages in queue for message queues
* Number of processes attached to shared memory segments
-p
Writes process number information:
* Process number of the last process to receive a message on message queues
* Process number of last process to send a message on message queues
* Process number of the creating process
* Process number of last process to attach or detach on shared memory segments
-t
Writes time information:
* Time of the last control operation that changed the access permissions for all facilities
* Time of the last msgsnd and msgrcv on message queues
* Time of the last shmat and shmdt on shared memory
* Time of the last semop on semaphore sets

描述
ipcs 命令往标准输出写入一些关于活动进程间通信设施的信息。如果没有指定标志,ipcs 命令用简短格式写入一些关于当前活动消息队列、共享内存段、信号量、远程队列和本地队列标题。

列标题和在 ipcs 命令中的列的含义列在下面。圆括号内的字母表示导致对应的报头出现的标志。all 设计符表示始终显示报头。这些标志仅仅确定提供给每个设备何种信息。但它们并不确定将列出哪些设备。

T (all)设施的类型。共有三种设施类型:
q
消息队列
m
共享内存段
s
信号量
ID (all)设施项的标识。
KEY (all)用作 msgget 子例程、semget 子例程或者 shmget 子例程的参数的键构成了设施项。

注: 当删除内存段时,共享内存段的密钥改变为 IPC_PRIVATE,直到所有附加在段上的进程和它拆离。
MODE (all)设施访问方式和标志。这种方式由 11 个字符组成,解释如下:
前两个字符如下所示:

R
如果进程在等待 msgrcv 系统调用。
S
如果进程在等待 msgsnd 系统调用。
D
如果有关的共享内存段被删除。当附加在段上的最后一个进程拆离后它就会消失。
C
当第一个附加进程运行时,如果有关的共享内存段被清空。
-
如果没有设置相应的特定标志。
接下来的九个字符作为每三个一组解释。第一组是指拥有者有许可权;第二组是指在设施项的用户组中其他用户的许可权;最后一组指所有的用户。在每组中,第一个字符表示允许读取,第二个字符表示可以写或者修改设施项,最后一个字符当前没有用过。

权限如下所示:

r
如果授予了读许可权。
w
如果授予了写许可权。
a
如果授予了修改许可权。
-
如果没有授予指定的许可权。
OWNER (all)设施项所有者的登录名。
GROUP (all)拥有设施项的组名。
CREATOR (a、c)设施项创建者的登录名。
CGROUP (a、c)设施项创建者的组名。

注: 对于 OWNER、GROUP、CREATOR 和 CGROUP,显示用户和组的标识而不显示登录名。
CBYTES (a、o)当前停留在相关消息队列中的消息的字节数。
QNUM (a、o)当前停留在相关消息队列中的消息的字节数。
QBYTES (a、b)停留在相关消息队列中消息允许的最大字节数。
LSPID (a、p)发送消息到相关队列的最后进程的标识。如果发送的最后一条消息是来自节点上的进程而不是保留该节点的队列,LSPID 是真正把消息放进队列的内核进程的 PID,而不是发送进程的 PID。
LRPID (a、p)接收来自相关队列的消息的进程标识。如果接收的最后一条消息来自一个节点上的进程而不是保留该队列的节点,LRPID 是真正接收队列上消息的内核进程的 PID,而不是接收进程的 PID。
STIME (a、t)最后一条消息发送到相关队列的时间。对于远程队列来说,这是服务器时间。没有做任何措施来补偿本地时钟和服务器时钟之间的时区差异。
RTIME (a、t)接受最后一条来自相关队列的消息的时间。对于远程队列来说,这是服务器时间。没有做任何措施来补偿本地时钟和服务器始终之间的时区差异。
CTIME (a、t)创建和改变相关项的时间。对于远程队列来说,这是服务器时间。没有做任何措施来补偿本地时钟和服务器始终之间的时区差异。
NATTCH (a、o)连接在关联的共享内存段的进程数。
SEGSZ (a、b)关联的共享内存段的大小。
CPID (a、p)共享内存项的创建程序的进程标识。
LPID (a、p)连接或者拆离共享内存段的最后一个进程的标识。
ATIME (a、t)最后一次与关联的共享内存段完成连接的时间。
DTIME (a、t)最后一次与关联的共享内存段完成拆离的时间。
NSEMS (a、b)在与信号项相关联的信号集中的信号量数量。
OTIME (a、t)在关联的信号量中完成信号量操作的时间。
SID (S)共享内存段的标识。SID 可以用作 svmon -S 命令的输入。
2.示例
# ipcs
IPC status from /dev/mem as of Thu Jan 10 11:13:27 BEIST 2008
T ID KEY MODE OWNER GROUP
Message Queues:
Shared Memory:
m 0 0x580010f7 --rw-rw-rw- root system
m 1048577 0xffffffff --rw-rw---- root system
m 1048578 0x7800000d --rw-rw-rw- root system
m 1048579 0x0d000c07 --rw-rw---- root system
m 4 0x670010a1 --rw-r--r-- root system
m 5 0x680010a1 --rw-r--r-- root system
m 6 0x700010a1 --rw------- root system
m 7 0xffffffff --rw-rw---- root haemrm
m 3145736 0xdc4c5ae4 --rw-r----- oracle oinstall
m 9 0xffffffff --rw-rw---- root system
Semaphores:
s 2097152 0x580010f7 --ra-ra-ra- root system
s 1 0x440010f7 --ra-ra-ra- root system
s 1048578 0x0100003c --ra------- root system
s 3 0x620002cc --ra-r--r-- root system
s 4 0x690010a1 --ra-ra-ra- root system
s 5 0x5800106e --ra-ra-r-- root system
s 6 0x0101c6e8 --ra-ra-ra- root system
#
# ipcs -m
IPC status from /dev/mem as of Thu Jan 10 11:13:35 BEIST 2008
T ID KEY MODE OWNER GROUP
Shared Memory:
m 0 0x580010f7 --rw-rw-rw- root system
m 1048577 0xffffffff --rw-rw---- root system
m 1048578 0x7800000d --rw-rw-rw- root system
m 1048579 0x0d000c07 --rw-rw---- root system
m 4 0x670010a1 --rw-r--r-- root system
m 5 0x680010a1 --rw-r--r-- root system
m 6 0x700010a1 --rw------- root system
m 7 0xffffffff --rw-rw---- root haemrm
m 3145736 0xdc4c5ae4 --rw-r----- oracle oinstall
m 9 0xffffffff --rw-rw---- root system
#
# ipcs -am
IPC status from /dev/mem as of Thu Jan 10 11:13:54 BEIST 2008
T ID KEY MODE OWNER GROUP CREATOR CGROUP NATTCH SEGSZ CPID LPID ATIME DTIME CTIME
Shared Memory:
m 0 0x580010f7 --rw-rw-rw- root system root system 1 134217728 184778 184778 18:12:56 no-entry 18:12:56
m 1048577 0xffffffff --rw-rw---- root system root system 1 4096 241704 241704 11:12:09 11:12:09 18:13:56
m 1048578 0x7800000d --rw-rw-rw- root system root system 2 16777216 229636 840142 13:09:59 13:11:07 18:13:46
m 1048579 0x0d000c07 --rw-rw---- root system root system 3 1440 282884 844016 11:06:48 11:06:48 18:13:38
m 4 0x670010a1 --rw-r--r-- root system root system 3 12 385454 483634 18:18:39 18:18:34 18:18:32
m 5 0x680010a1 --rw-r--r-- root system root system 3 106548 385454 483634 18:18:39 18:18:34 18:18:32
m 6 0x700010a1 --rw------- root system root system 3 3168 385454 483634 18:18:39 18:18:34 18:18:32
m 7 0xffffffff --rw-rw---- root haemrm root haemrm 1 4096 483634 483634 11:12:28 11:12:28 18:18:40
m 3145736 0xdc4c5ae4 --rw-r----- oracle oinstall oracle oinstall 112 8589955072 303200 1020402 11:07:42 11:08:42 14:08:00
m 9 0xffffffff --rw-rw---- root system root system 1 8192 241704 241704 11:13:28 11:13:28 18:21:03
#
PS:
在oracle运行过程中,会出现oracle进程突然down掉,但共享内存段依然存在的情况,这是一种非正常的数据库crash,需要用ipcrm命令来清除掉系统中存在的oracle共享内存(即SGA)
ipcrm的命令帮助如下:
#man ipcrm
ipcrm Command
Purpose
Removes message queue, semaphore set, or shared memory identifiers.
Syntax
ipcrm [ -m SharedMemoryID ] [ -M SharedMemoryKey ] [ -q MessageID ] [ -Q MessageKey ] [ -s SemaphoreID ] [ -S
SemaphoreKey ]
ipcrm -r {-q|-m|-s} Name
ipcrm -r -u [-o Owner] [-g Group]
Description
The ipcrm command removes one or more message queues, semaphore sets, or shared memory identifiers.
Flags
-g Group
Restricts the removal to unnamed semaphores matching the group specified.
-m SharedMemory ID
Removes the shared memory identifier SharedMemoryID. The shared memory segment and data structure associated
with SharedMemoryID are also removed after the last detach operation.
-M SharedMemoryKey
Removes the shared memory identifier, created with the key SharedMemoryKey. The shared memory segment and data
structure associated with it are also removed after the last detach operation.
-o Owner
Restricts the removal to unnamed semaphores matching the owner specified.
-q MessageID
Removes the message queue identifier MessageID and the message queue and data structure associated with it.
-Q MessageKey
Removes the message queue identifier, created with the key MessageKey, and the message queue and data structure
associated with it.
-r
Removes named or unnamed real-time interprocess communication objects. The named real-time object is either a
real-time message queue (-q), a real-time shared memory (-m), or a real-time semaphore (-s) and is identified by
its Name.
-s SemaphoreID
Removes the semaphore identifier SemaphoreID and the set of semaphores and data structure associated with it.
-S SemaphoreKey
Removes the semaphore identifier, created with the key SemaphoreKey, and the set of semaphores and data
structure associated with it.
-u
Removes all real-time unnamed semaphores. Using a descriptor on a destroyed unnamed semaphore can result in
unspecified behavior.
The msgctl, shmctl, and semctl subroutines provide details of the remove operations. The identifiers and keys can be
found by using the ipcs command.
Examples
To remove the shared memory segment associated with SharedMemoryID 18602, enter:
ipcrm -m 18602
[@more@]

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/8861952/viewspace-1034702/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/8861952/viewspace-1034702/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值