How to release IPC resource after oracle Instance crash/abort

1.ipcs -m -i  id 获得详细信息

2..ipcs -m -c 列出创建者和owner信息

3.ipcs  -m -t 最后创建和访问的时间

4.列出创建、最后一个访问共享内存的信息

# ipcs -m -p  (c 创建者pid;lpid last进程pid)  ------ Shared Memory Creator/Last-op -------- shmid      owner      cpid       lpid 1056800768 oracle     16764      5389 323158020  root       2354       2354 325713925  root       20666      20668

Oracle instance异常终止的情况下,如crash, shutdown abort等, 有时候memory,semaphores等资源并不能及时释放,这会影响下一次数据库的启动。

下面的方法可以彻底释放这些资源。
*************
ipcs命令
*************
如果一个节点上只有一个instance,那owner列为oracle的所有资源都是属于该instance所有。
[oracle@TCLUX3245 udump]$ ps -ef|grep smon
oracle   32497     1  0 13:46 ?        00:00:00 ora_smon_O01DMS0
oracle   32508 32268  0 13:46 pts/12   00:00:00 grep smon
[oracle@TCLUX3245 udump]$ ipcs

------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch     status
0xf042883c 2588674    oracle    640        270532608  11

------ Semaphore Arrays --------
key        semid      owner      perms      nsems
0xaab6350c 8847360    oracle    640        44

------ Message Queues --------
key        msqid      owner      perms      used-bytes   messages


释放资源用如下命令:
usage: ipcrm [ [-q msqid] [-m shmid] [-s semid]
          [-Q msgkey] [-M shmkey] [-S semkey] ... ]
[oracle@TCLUX3245 udump]$ ipcrm shm 2588674
resource(s) deleted
[oracle@TCLUX3245 udump]$  ipcrm -s 8847360
[oracle@TCLUX3245 udump]$ ipcs

------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch     status

------ Semaphore Arrays --------
key        semid      owner      perms      nsems

------ Message Queues --------
key        msqid      owner      perms      used-bytes   messages


**************
oradebug IPC
**************
关于oradebug用法,参见http://www.evdbt.com/Oradebug_Modrakovic.pdf
SQL> oradebug setmypid
Statement processed.
SQL> oradebug ipc
Information written to trace file.
SQL> oradebug tracefile_name
/ddms01/dms/oracle/admin/O01DMS0/udump/o01dms0_ora_32042.trc

[oracle@TCLUX3245 udump]$ cat o01dms0_ora_32042.trc
/ddms01/dms/oracle/admin/O01DMS0/udump/o01dms0_ora_32042.trc
......
......
 Area #0 `Fixed Size' containing Subareas 0-0
  Total size 0000000000129904 Minimum Subarea size 00000000
   Area  Subarea    Shmid      Stable Addr      Actual Addr
           =======
      0        0  2555909 0x00000020000000 0x00000020000000
            =======
                              Subarea size     Segment size
                          000000000012a000 0000000010200000
 Area #1 `Variable Size' containing Subareas 2-2
  Total size 000000000f000000 Minimum Subarea size 00400000
   Area  Subarea    Shmid      Stable Addr      Actual Addr
      1        2  2555909 0x00000021000000 0x00000021000000
                              Subarea size     Segment size
                          000000000f000000 0000000010200000
 Area #2 `Redo Buffers' containing Subareas 1-1
  Total size 0000000000ed6000 Minimum Subarea size 00000000
   Area  Subarea    Shmid      Stable Addr      Actual Addr
      2        1  2555909 0x0000002012a000 0x0000002012a000
                              Subarea size     Segment size
                          0000000000ed6000 0000000010200000
 Area #3 `skgm overhead' containing Subareas 3-3
  Total size 0000000000001000 Minimum Subarea size 00000000
   Area  Subarea    Shmid      Stable Addr      Actual Addr
      3        3  2555909 0x00000030000000 0x00000030000000
                              Subarea size     Segment size
                          0000000000001000 0000000010200000
Dump of Solaris-specific skgm context
sharedmmu 00000000
shareddec        0
used region        0: start 0000000020000000 length 0000000011000000
used region        1: start 00000000b6000000 length 000000003a000000
Maximum processes:               = 40
Number of semaphores per set:    = 44
Semaphores key overhead per set: = 4
User Semaphores per set:         = 40
Number of semaphore sets:        = 1
Semaphore identifiers:           = 1
Semaphore List=
  =======
  8585219
  =======
-------------- system semaphore information -------------
------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch     status
0xc268190c 2424834    oracle    640        222298112  40
0x2c0d6c74 1835011    oracle    640        81788928   10
0x97b4cc2c 2359300    oracle    640        270532608  11
0xf042883c 2555909    oracle    640        270532608  38
------ Semaphore Arrays --------
key        semid      owner      perms      nsems
0xa4524680 8060928    oracle    640        104
0x169d5be0 5472257    oracle    640        44
0x3b0d4208 7798786    oracle    640        44
0xaab6350c 8585219    oracle    640        44
------ Message Queues --------
key        msqid      owner      perms      used-bytes   messages

由trace文件可知,该instance的share memory ID为2555909,semaphore ID为Semaphore List=8585219

****************
sysresv
****************
sysresv用法:
sysresv [-if] [-d <on/off>] [-l sid1 <sid2> ...]
-i : Prompt before removing ipc resources for each sid
-f : Remove ipc resources silently, over rides -i option
-d <on/off> : List ipc resources for each sid if on
-l sid1 <sid2> .. : apply sysresv to each sid

[oracle@TCLUX3245 udump]$ sysresv

IPC Resources for ORACLE_SID "O01DDC0" :
Shared Memory:
ID              KEY
2621442         0x97b4cc2c
Semaphores:
ID              KEY
8978432         0x3b0d4208
Oracle Instance alive for sid "O01DDC0"

sysresv详细信息参见http://www.ordba.net/Tutorials/OracleUtilities~SYSRESV.htm

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值