Wednesday, April 25, 2012

ORA-27101: shared memory realm does not exist

In [1], it has listed some tips for resolving Oracle exception:
  • ORA-27101: shared memory realm does not exist
In this article, we will show you yet another tip of resolving ORA-27101.


The Background

There are two teams share the same DB server in our environment. Team A started an Oracle instance without shutting it down. As a team B member, how do you figure out how to shut it down?

Steps

  1. Find out the SID name:
    • ps -ef | grep smon (or pmon)
    • For example, the command shows:
      • oracle 32607 1 0 10:12 ? 00:00:03 ora_smon_SOAR2
    • So, we know the SID is named SOAR2.
  2. Find out Oracle Home path:
    • Use pmap command to report the memory map of smon process. For example, we issue: "pmap 32607" and one of the output line shows:
      • 00002b3f57270000 4K rwx-- /disk2/home/oracle/atg/OracleDB_11.2.0.2/product/11.2.0/dbhome_1/lib/libocrutl11.so
  3. Setup ORACLE_HOME and ORACLE_SID environment variable
    • For example, we have set them using Linux bash:
      • export ORACLE_HOME=/disk2/home/oracle/atg/OracleDB_11.2.0.2/product/11.2.0/dbhome_1
      • export ORACLE_SID=SOAR2
However, after we started sqlplus and tried to shutdown our instance, we got:

$sqlplus "/ as sysdba

SQL*Plus: Release 11.2.0.2.0 Production on Wed Apr 25 17:15:08 2012

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

Connected to an idle instance.

SQL> shutdown immediate;
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux-x86_64 Error: 2: No such file or directory

The Issue

The problem is that /data/home is a symbolic link to /disk2/home directory. Oracle does not recognize one name used in Oracle Home path if you started it using another name.

To check what the environment variable ORACLE_HOME was set, you can check the process environment (/proc/<pid>/environ) . For example, from the following file:
  • /proc/32607/environ
we have found that ORACLE_HOME was set to be:
  • /data/home/oracle/atg/OracleDB_11.2.0.2/product/11.2.0/dbhome_1
After we have reset our ORACLE_HOME to the new path, we have resolved ORA-27101 issue.

References

  1. ORA-27101: shared memory realm does not exist tips
  2. ORA-01031: insufficient privileges

1 comment:

kangy said...

wow. this is great. after so much of search, luckily i found your post and solved my problem. Thanks.