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 Overview
Section titled “Error Overview”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.
Common Causes
Section titled “Common Causes”Instance Not Started
Section titled “Instance Not Started”- Database not started after server reboot
- Instance crashed
- Background processes died
- Listener registered service but instance is down
Wrong ORACLE_SID
Section titled “Wrong ORACLE_SID”ORACLE_SIDnot set in shellORACLE_SIDpoints to different instance- Multiple Oracle homes with different SIDs
oraenvscript returned wrong SID
Connection Routing
Section titled “Connection Routing”- 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
Shared Memory Cleanup Issues
Section titled “Shared Memory Cleanup Issues”- Previous shutdown left stale memory but no instance
- IPC limits prevented SGA allocation
- Shared memory removed by
ipcrm
Diagnostic Steps
Section titled “Diagnostic Steps”Check Instance Status
Section titled “Check Instance Status”# Verify ORACLE_SIDecho $ORACLE_SID
# Check if instance is runningps -ef | grep "ora_pmon_$ORACLE_SID" | grep -v grep
# All Oracle instances on hostps -ef | grep ora_pmon | grep -v grep | awk '{print $NF}' | sed 's/ora_pmon_//'Verify Environment
Section titled “Verify Environment”# Set environment correctly. oraenvORACLE_SID = [PROD] ?
# Or manualexport ORACLE_SID=PRODexport ORACLE_HOME=/u01/app/oracle/product/19c/dbhome_1export PATH=$ORACLE_HOME/bin:$PATHTest Local Connection
Section titled “Test Local Connection”# Bypass listener with local connectionsqlplus / as sysdba
# If this fails with ORA-27101, instance is genuinely not runningCheck Shared Memory
Section titled “Check Shared Memory”# View Oracle shared memory segmentsipcs -m | grep oracle
# Show kernel limitssysctl -a | grep -E "shmmax|shmall|shmmni"
# Check current usagecat /proc/sys/kernel/shmmaxCheck Listener Status
Section titled “Check Listener Status”# Listener healthlsnrctl status
# Look for service name registeredlsnrctl services
# Confirm instance is registered with listenerResolution Steps
Section titled “Resolution Steps”1. Start the Instance
Section titled “1. Start the Instance”# Set environment. oraenv # Choose correct SID
# Startsqlplus / as sysdbaSQL> STARTUP;If startup fails, check alert log:
adrciadrci> show alert -tail 1002. Set Correct ORACLE_SID
Section titled “2. Set Correct ORACLE_SID”# Identify available SIDscat /etc/oratab
# Set the correct oneexport ORACLE_SID=PROD
# Permanent in user profileecho 'export ORACLE_SID=PROD' >> ~/.bash_profileecho 'export ORACLE_HOME=/u01/app/oracle/product/19c/dbhome_1' >> ~/.bash_profileecho 'export PATH=$ORACLE_HOME/bin:$PATH' >> ~/.bash_profile3. Connect via Listener Instead
Section titled “3. Connect via Listener Instead”# Use TNS service name to route through listenersqlplus user/pass@PROD
# Verify TNS entrytnsping PROD4. Clean Up Stale IPC
Section titled “4. Clean Up Stale IPC”# Only after confirming no instance running for that SID# List Oracle shared memoryipcs -m | grep oracle
# Remove specific segment (CAUTION)ipcrm -m <shmid>
# Remove semaphoresipcs -s | grep oracleipcrm -s <semid>
# Better: use sysresv to validate before removingsysresv -i -l PROD5. Fix Shared Memory Limits
Section titled “5. Fix Shared Memory Limits”If startup fails with ORA-27101 plus ORA-04031 or ORA-27123:
# Edit /etc/sysctl.confkernel.shmmax = 17179869184 # 16GB or largerkernel.shmall = 4194304 # in pages of 4KBkernel.shmmni = 4096
# Applysysctl -p
# For larger SGAs, use HugePagesvm.nr_hugepages = 20486. Restart Listener
Section titled “6. Restart Listener”# Stop and start listenerlsnrctl stoplsnrctl start
# Force instance registrationsqlplus / as sysdbaSQL> ALTER SYSTEM REGISTER;
# Verifylsnrctl servicesCommon Scenarios
Section titled “Common Scenarios”Scenario 1: After Server Reboot
Section titled “Scenario 1: After Server Reboot”$ sqlplus / as sysdbaERROR:ORA-01034: ORACLE not availableORA-27101: shared memory realm does not existLinux-x86_64 Error: 2: No such file or directoryFix: Database didn’t auto-start. Either run dbstart or set up systemd service.
Scenario 2: Wrong ORACLE_SID
Section titled “Scenario 2: Wrong ORACLE_SID”ORACLE_SID=PROD set, but instance running is TEST.Fix: export ORACLE_SID=TEST and retry.
Scenario 3: Listener Stale Registration
Section titled “Scenario 3: Listener Stale Registration”TNSping works, but connection returns ORA-27101.Fix: Listener has stale entry for crashed instance. Restart listener.
Sample Output
Section titled “Sample Output”$ echo $ORACLE_SIDPROD
$ sqlplus / as sysdbaERROR:ORA-01034: ORACLE not availableORA-27101: shared memory realm does not existLinux-x86_64 Error: 2: No such file or directoryProcess ID: 0Session ID: 0 Serial number: 0
$ ps -ef | grep ora_pmonoracle 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 sysdbaSQL> -- connected to TEST
# Option B: start PROD$ export ORACLE_SID=PROD$ sqlplus / as sysdbaSQL> STARTUP;ORACLE instance started.Database mounted.Database opened.Prevention Strategies
Section titled “Prevention Strategies”Auto-Start Configuration
Section titled “Auto-Start Configuration”# /etc/oratab - mark databases for auto-startPROD:/u01/app/oracle/product/19c/dbhome_1:YTEST:/u01/app/oracle/product/19c/dbhome_1:N
# Use dbstart on boot# Add to /etc/rc.d/rc.localsu - oracle -c "/u01/app/oracle/product/19c/dbhome_1/bin/dbstart $ORACLE_HOME"systemd Service (Recommended)
Section titled “systemd Service (Recommended)”[Unit]Description=Oracle Database PRODAfter=network.target
[Service]Type=forkingRemainAfterExit=yesUser=oracleGroup=oinstallExecStart=/u01/app/oracle/product/19c/dbhome_1/bin/dbstart /u01/app/oracle/product/19c/dbhome_1ExecStop=/u01/app/oracle/product/19c/dbhome_1/bin/dbshut /u01/app/oracle/product/19c/dbhome_1
[Install]WantedBy=multi-user.targetsystemctl enable oracle-dbsystemctl start oracle-dbEnvironment Setup Discipline
Section titled “Environment Setup Discipline”. /etc/oratab.profile # source standard env
# Helper functionsfunction go() { export ORACLE_SID=$1 . oraenv <<< $1}
# Usage: go PRODHealth Monitoring
Section titled “Health Monitoring”#!/bin/bash# Check all instances in /etc/oratabwhile 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" fi fidone < /etc/oratabDocument Per-Host Inventory
Section titled “Document Per-Host Inventory”- Maintain a CMDB/wiki listing all instances per host
- Include SID, version, listener port, services
- Update on every install/decommission
Related Errors
Section titled “Related Errors”- 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
Troubleshooting Checklist
Section titled “Troubleshooting Checklist”- Verify
ORACLE_SIDmatches running instance - Check for
ora_pmon_$SIDprocess - Confirm
ORACLE_HOMEis 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