{"id":1440,"date":"2011-08-07T18:26:33","date_gmt":"2011-08-07T23:26:33","guid":{"rendered":"http:\/\/appcrawler.com\/wordpress\/?p=1440"},"modified":"2011-08-07T18:26:33","modified_gmt":"2011-08-07T23:26:33","slug":"ipcrm-not-removing-sga-shared-memory-segment","status":"publish","type":"post","link":"http:\/\/appcrawler.com\/wordpress\/2011\/08\/07\/ipcrm-not-removing-sga-shared-memory-segment\/","title":{"rendered":"ipcrm not removing SGA shared memory segment"},"content":{"rendered":"<p>Today, I had an issue I had seen before, but I can never remember how I fix it.  As such, I wanted to document it here.<\/p>\n<p>Although rare, periodically an abnormally terminated instance will leave behind a shared memory segment.  Since the SGA is attached by key which is the database name and instance_number, this means you can&#8217;t restart the instance until you remove this shared memory segment.<\/p>\n<pre lang=\"text\">\r\ndell11gr1:oracle:dublin:\/u01\/app\/oracle\/product\/11.2.0\/dbhome_1\/rdbms\/admin>ipcs -a\r\n\r\n------ Shared Memory Segments --------\r\nkey        shmid      owner      perms      bytes      nattch     status\r\n0x00000000 6160386    root      644        52         2\r\n0x00000000 6193156    root      644        16384      2\r\n0x00000000 6225925    root      644        268        2\r\n0xea42bf0c 6881286    oracle    660        4096       0\r\n0x00000000 7143431    oracle    660        608174080  1          dest\r\n\r\n------ Semaphore Arrays --------\r\nkey        semid      owner      perms      nsems\r\n0x3c490990 1310721    oracle    660        104\r\n0xdd54209c 2228226    oracle    640        154\r\n\r\n------ Message Queues --------\r\nkey        msqid      owner      perms      used-bytes   messages\r\n\r\ndell11gr1:oracle:dublin:\/u01\/app\/oracle\/product\/11.2.0\/dbhome_1\/rdbms\/admin>ipcrm -m 7143431\r\ndell11gr1:oracle:dublin:\/u01\/app\/oracle\/product\/11.2.0\/dbhome_1\/rdbms\/admin>ipcs -p\r\n\r\n------ Shared Memory Creator\/Last-op --------\r\nshmid      owner      cpid       lpid\r\n6160386    root       2382       2943\r\n6193156    root       2382       2943\r\n6225925    root       2382       2943\r\n6881286    oracle     7223       31321\r\n7143431    oracle     30892      31244\r\n\r\n\r\n------ Message Queues PIDs --------\r\nmsqid      owner      lspid      lrpid\r\n\r\ndell11gr1:oracle:dublin:\/u01\/app\/oracle\/product\/11.2.0\/dbhome_1\/rdbms\/admin>ps -ef | grep 30892\r\noracle   31529 30326  0 21:40 pts\/0    00:00:00 grep 30892\r\n<\/pre>\n<p>As you can see, the creating PID is no longer in the process table.  Also, but not shown, the last process to attach to the shared memory segment had already been killed.  <\/p>\n<p>To resolve this, it&#8217;s lsof to the rescue&#8230;<\/p>\n<pre lang=\"text\">\r\nlsof | grep shmid #in the ipcs output above.\r\n<\/pre>\n<p>Alternatively, you can brute force your way in if the attached PID is not a background process.  See below&#8230;<\/p>\n<pre lang=\"text\">\r\ndell11gr1:oracle:dublin:\/u01\/app\/oracle\/product\/11.2.0\/dbhome_1\/rdbms\/admin>ps -ef | grep LOCAL\r\noracle   30961     1  0 21:27 ?        00:00:04 oracle+ASM1_asmb_dublin (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))\r\noracle   30985     1  0 21:27 ?        00:00:02 oracledublin (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))\r\noracle   31547 30326  0 21:40 pts\/0    00:00:00 grep LOCAL\r\ndell11gr1:oracle:dublin:\/u01\/app\/oracle\/product\/11.2.0\/dbhome_1\/rdbms\/admin>kill -9 30961 30985\r\ndell11gr1:oracle:dublin:\/u01\/app\/oracle\/product\/11.2.0\/dbhome_1\/rdbms\/admin>ipcs -a\r\n\r\n------ Shared Memory Segments --------\r\nkey        shmid      owner      perms      bytes      nattch     status\r\n0x00000000 6160386    root      644        52         2\r\n0x00000000 6193156    root      644        16384      2\r\n0x00000000 6225925    root      644        268        2\r\n0xea42bf0c 6881286    oracle    660        4096       0\r\n\r\n------ Semaphore Arrays --------\r\nkey        semid      owner      perms      nsems\r\n0x3c490990 1310721    oracle    660        104\r\n0xdd54209c 2228226    oracle    640        154\r\n\r\n------ Message Queues --------\r\nkey        msqid      owner      perms      used-bytes   messages\r\n\r\ndell11gr1:oracle:dublin:\/u01\/app\/oracle\/product\/11.2.0\/dbhome_1\/rdbms\/admin>\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Today, I had an issue I had seen before, but I can never remember how I fix it. As such, I wanted to document it here. Although rare, periodically an abnormally terminated instance will leave behind a shared memory segment.&hellip;<\/p>\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"http:\/\/appcrawler.com\/wordpress\/2011\/08\/07\/ipcrm-not-removing-sga-shared-memory-segment\/\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"footnotes":""},"categories":[19,28,27,22],"tags":[],"_links":{"self":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/1440"}],"collection":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/comments?post=1440"}],"version-history":[{"count":14,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/1440\/revisions"}],"predecessor-version":[{"id":1477,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/1440\/revisions\/1477"}],"wp:attachment":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/media?parent=1440"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/categories?post=1440"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/tags?post=1440"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}