Skip to content

ORA-27101: Shared Memory Realm Does Not Exist

ORA-27101: Shared Memory Realm Does Not Exist

Section titled “ORA-27101: Shared Memory Realm Does Not Exist”

Error Text: ORA-27101: shared memory realm does not exist

ORA-27101 means the Oracle client process cannot find the shared memory segment (SGA) for the target instance. The instance is likely not running, the ORACLE_SID environment variable points to a non-running instance, or the connection is going to a different host than expected.

  • Database not started after server reboot
  • Instance crashed
  • Background processes died
  • Listener registered service but instance is down
  • ORACLE_SID not set in shell
  • ORACLE_SID points to different instance
  • Multiple Oracle homes with different SIDs
  • oraenv script returned wrong SID
  • TNS entry forces local bypass via (SERVER=DEDICATED) to non-existent local instance
  • BEQ (bequeath) protocol used instead of network listener
  • Listener not registered or wrong service name
  • Previous shutdown left stale memory but no instance
  • IPC limits prevented SGA allocation
  • Shared memory removed by ipcrm
Terminal window
# Verify ORACLE_SID
echo $ORACLE_SID
# Check if instance is running
ps -ef | grep "ora_pmon_$ORACLE_SID" | grep -v grep
# All Oracle instances on host
ps -ef | grep ora_pmon | grep -v grep | awk '{print $NF}' | sed 's/ora_pmon_//'
Terminal window
# Set environment correctly
. oraenv
ORACLE_SID = [PROD] ?
# Or manual
export ORACLE_SID=PROD
export ORACLE_HOME=/u01/app/oracle/product/19c/dbhome_1
export PATH=$ORACLE_HOME/bin:$PATH
Terminal window
# Bypass listener with local connection
sqlplus / as sysdba
# If this fails with ORA-27101, instance is genuinely not running
Terminal window
# View Oracle shared memory segments
ipcs -m | grep oracle
# Show kernel limits
sysctl -a | grep -E "shmmax|shmall|shmmni"
# Check current usage
cat /proc/sys/kernel/shmmax
Terminal window
# Listener health
lsnrctl status
# Look for service name registered
lsnrctl services
# Confirm instance is registered with listener
Terminal window
# Set environment
. oraenv # Choose correct SID
# Start
sqlplus / as sysdba
SQL> STARTUP;

If startup fails, check alert log:

Terminal window
adrci
adrci> show alert -tail 100
Terminal window
# Identify available SIDs
cat /etc/oratab
# Set the correct one
export ORACLE_SID=PROD
# Permanent in user profile
echo 'export ORACLE_SID=PROD' >> ~/.bash_profile
echo 'export ORACLE_HOME=/u01/app/oracle/product/19c/dbhome_1' >> ~/.bash_profile
echo 'export PATH=$ORACLE_HOME/bin:$PATH' >> ~/.bash_profile
Terminal window
# Use TNS service name to route through listener
sqlplus user/pass@PROD
# Verify TNS entry
tnsping PROD
Terminal window
# Only after confirming no instance running for that SID
# List Oracle shared memory
ipcs -m | grep oracle
# Remove specific segment (CAUTION)
ipcrm -m <shmid>
# Remove semaphores
ipcs -s | grep oracle
ipcrm -s <semid>
# Better: use sysresv to validate before removing
sysresv -i -l PROD

If startup fails with ORA-27101 plus ORA-04031 or ORA-27123:

Terminal window
# Edit /etc/sysctl.conf
kernel.shmmax = 17179869184 # 16GB or larger
kernel.shmall = 4194304 # in pages of 4KB
kernel.shmmni = 4096
# Apply
sysctl -p
# For larger SGAs, use HugePages
vm.nr_hugepages = 2048
Terminal window
# Stop and start listener
lsnrctl stop
lsnrctl start
# Force instance registration
sqlplus / as sysdba
SQL> ALTER SYSTEM REGISTER;
# Verify
lsnrctl services
$ sqlplus / as sysdba
ERROR:
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux-x86_64 Error: 2: No such file or directory

Fix: Database didn’t auto-start. Either run dbstart or set up systemd service.

ORACLE_SID=PROD set, but instance running is TEST.

Fix: export ORACLE_SID=TEST and retry.

TNSping works, but connection returns ORA-27101.

Fix: Listener has stale entry for crashed instance. Restart listener.

$ echo $ORACLE_SID
PROD
$ sqlplus / as sysdba
ERROR:
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux-x86_64 Error: 2: No such file or directory
Process ID: 0
Session ID: 0 Serial number: 0
$ ps -ef | grep ora_pmon
oracle 12345 1 0 May08 ? 00:00:00 ora_pmon_TEST
# Only TEST is running, not PROD
# Option A: switch to TEST
$ export ORACLE_SID=TEST
$ sqlplus / as sysdba
SQL> -- connected to TEST
# Option B: start PROD
$ export ORACLE_SID=PROD
$ sqlplus / as sysdba
SQL> STARTUP;
ORACLE instance started.
Database mounted.
Database opened.
Terminal window
# /etc/oratab - mark databases for auto-start
PROD:/u01/app/oracle/product/19c/dbhome_1:Y
TEST:/u01/app/oracle/product/19c/dbhome_1:N
# Use dbstart on boot
# Add to /etc/rc.d/rc.local
su - oracle -c "/u01/app/oracle/product/19c/dbhome_1/bin/dbstart $ORACLE_HOME"
/etc/systemd/system/oracle-db.service
[Unit]
Description=Oracle Database PROD
After=network.target
[Service]
Type=forking
RemainAfterExit=yes
User=oracle
Group=oinstall
ExecStart=/u01/app/oracle/product/19c/dbhome_1/bin/dbstart /u01/app/oracle/product/19c/dbhome_1
ExecStop=/u01/app/oracle/product/19c/dbhome_1/bin/dbshut /u01/app/oracle/product/19c/dbhome_1
[Install]
WantedBy=multi-user.target
Terminal window
systemctl enable oracle-db
systemctl start oracle-db
/home/oracle/.bash_profile
. /etc/oratab.profile # source standard env
# Helper functions
function go() {
export ORACLE_SID=$1
. oraenv <<< $1
}
# Usage: go PROD
#!/bin/bash
# Check all instances in /etc/oratab
while IFS=: read -r sid home auto_start rest; do
[[ "$sid" =~ ^# ]] && continue
[[ -z "$sid" ]] && continue
if [ "$auto_start" = "Y" ]; then
if ! pgrep -f "ora_pmon_$sid" > /dev/null; then
echo "DOWN: $sid"
mail -s "Oracle $sid not running" [email protected] < /dev/null
fi
fi
done < /etc/oratab
  • Maintain a CMDB/wiki listing all instances per host
  • Include SID, version, listener port, services
  • Update on every install/decommission
  • ORA-01034: ORACLE not available
  • ORA-01089: Immediate shutdown in progress
  • ORA-27102: Out of memory
  • ORA-27123: Unable to attach to shared memory
  • ORA-27125: Unable to create shared memory segment
  • Verify ORACLE_SID matches running instance
  • Check for ora_pmon_$SID process
  • Confirm ORACLE_HOME is set correctly
  • Try local connection (sqlplus / as sysdba) before TNS
  • Check listener has correct service registered
  • Inspect alert log for startup failures
  • Validate kernel parameters for SGA size
  • Configure auto-start to prevent recurrence