ORA-01034 Oracle Not Available - Database Startup and Connection Issues
ORA-01034: Oracle Not Available
Section titled “ORA-01034: Oracle Not Available”Error Overview
Section titled “Error Overview”Error Text: ORA-01034: ORACLE not available
This error occurs when attempting to connect to an Oracle database instance that is not running or not accessible. It indicates that the Oracle database instance is either shut down, in the process of starting up, or has encountered a critical failure that prevents normal operation.
Understanding Database States
Section titled “Understanding Database States”Oracle Instance States
Section titled “Oracle Instance States”Database Instance States├── SHUTDOWN - Instance completely stopped├── NOMOUNT - Instance started, no database mounted├── MOUNT - Database mounted, not open├── OPEN - Database fully operational└── RESTRICTED - Limited access mode
Startup Sequence
Section titled “Startup Sequence”-- Complete startup sequenceSTARTUP NOMOUNT; -- Start instance onlyALTER DATABASE MOUNT; -- Mount databaseALTER DATABASE OPEN; -- Open database
-- Or combinedSTARTUP; -- Complete startup to OPEN state
Common Causes
Section titled “Common Causes”Instance Not Started
Section titled “Instance Not Started”- Database was shut down normally
- System reboot without auto-start
- Manual shutdown by DBA
- Scheduled maintenance window
Startup Failures
Section titled “Startup Failures”-- Common startup issues-- Parameter file problems-- Memory allocation failures-- Control file corruption-- Redo log issues
System Issues
Section titled “System Issues”- Insufficient memory
- Disk space problems
- Permission issues
- Network connectivity problems
Diagnostic Steps
Section titled “Diagnostic Steps”Check Instance Status
Section titled “Check Instance Status”# Check if Oracle processes are runningps -ef | grep oracleps -ef | grep pmon # Process Monitorps -ef | grep smon # System Monitor
# Check listener statuslsnrctl status
# Check database status (if possible)sqlplus / as sysdba
Oracle Environment Check
Section titled “Oracle Environment Check”# Verify Oracle environment variablesecho $ORACLE_HOMEecho $ORACLE_SIDecho $PATH
# Check Oracle inventorycat $ORACLE_HOME/oraInst.loc
# Verify Oracle installationls -la $ORACLE_HOME/bin/oracle
System Resources
Section titled “System Resources”# Check available memoryfree -m# ortop
# Check disk spacedf -h $ORACLE_HOMEdf -h $ORACLE_BASE
# Check system logstail -f /var/log/messagesdmesg | grep -i oracle
Resolution Steps
Section titled “Resolution Steps”Basic Database Startup
Section titled “Basic Database Startup”-- Connect as SYSDBAsqlplus / as sysdba
-- Check current statusSELECT status FROM v$instance;
-- Start the databaseSTARTUP;
-- Verify statusSELECT name, open_mode, database_status FROM v$database;
Startup with Specific Options
Section titled “Startup with Specific Options”-- Start with parameter fileSTARTUP PFILE='/path/to/init.ora';
-- Start in restricted modeSTARTUP RESTRICT;
-- Start in mount mode onlySTARTUP MOUNT;
-- Force startup after abnormal shutdownSTARTUP FORCE;
Step-by-Step Startup
Section titled “Step-by-Step Startup”-- Manual step-by-step startupSTARTUP NOMOUNT;-- Check: Instance started but database not mounted
ALTER DATABASE MOUNT;-- Check: Database mounted but not open
ALTER DATABASE OPEN;-- Check: Database fully operational
Troubleshooting Startup Issues
Section titled “Troubleshooting Startup Issues”Parameter File Problems
Section titled “Parameter File Problems”-- If SPFILE is corruptedSTARTUP PFILE='/path/to/backup/init.ora';
-- Create new SPFILE from working PFILECREATE SPFILE FROM PFILE='/path/to/init.ora';
-- Check parameter file locationSHOW PARAMETER spfile;
Memory Issues
Section titled “Memory Issues”-- Check SGA requirementsSHOW PARAMETER sga_target;SHOW PARAMETER sga_max_size;
-- Reduce memory if needed (emergency)STARTUP PFILE='/tmp/reduced_memory.ora';
-- Sample reduced memory parameter file-- db_name=your_db-- sga_target=512M # Reduced from higher value-- pga_aggregate_target=256M
Control File Issues
Section titled “Control File Issues”-- Check control file locationsSHOW PARAMETER control_files;
-- If control files are missing/corrupted-- Restore from backup or recreateSTARTUP NOMOUNT;-- Then restore control file from backup-- Or recreate using CREATE CONTROLFILE script
Redo Log Problems
Section titled “Redo Log Problems”-- Check redo log statusSELECT * FROM v$log;SELECT * FROM v$logfile;
-- If redo logs are corruptedSTARTUP MOUNT;RECOVER DATABASE;ALTER DATABASE OPEN;
Advanced Recovery Scenarios
Section titled “Advanced Recovery Scenarios”Database Recovery After Crash
Section titled “Database Recovery After Crash”-- Attempt normal startupSTARTUP;
-- If recovery is neededSTARTUP MOUNT;RECOVER DATABASE;ALTER DATABASE OPEN;
-- If incomplete recovery neededRECOVER DATABASE UNTIL TIME '2024-01-01 12:00:00';ALTER DATABASE OPEN RESETLOGS;
Emergency Startup Procedures
Section titled “Emergency Startup Procedures”-- Force startup (use with caution)STARTUP FORCE;
-- Start with minimal parametersSTARTUP PFILE='/tmp/minimal.ora';
-- Minimal parameter file example:-- db_name=testdb-- control_files='/path/to/control01.ctl'-- compatible=19.0.0
Using RMAN for Recovery
Section titled “Using RMAN for Recovery”# Connect to RMANrman target /
# Start instance if neededstartup nomount;
# Restore and recoverrestore database;recover database;alter database open;
Automated Startup Solutions
Section titled “Automated Startup Solutions”Linux Service Configuration
Section titled “Linux Service Configuration”# Create systemd service filesudo vi /etc/systemd/system/oracle.service
# Service file content:[Unit]Description=Oracle DatabaseAfter=network.target
[Service]Type=forkingUser=oracleGroup=oinstallEnvironment=ORACLE_HOME=/u01/app/oracle/product/19.0.0/dbhome_1Environment=ORACLE_SID=ORCLExecStart=/u01/app/oracle/product/19.0.0/dbhome_1/bin/dbstartExecStop=/u01/app/oracle/product/19.0.0/dbhome_1/bin/dbshutRestart=always
[Install]WantedBy=multi-user.target
# Enable servicesudo systemctl enable oracle.servicesudo systemctl start oracle.service
Startup Script
Section titled “Startup Script”#!/bin/bash# Oracle startup script
ORACLE_HOME=/u01/app/oracle/product/19.0.0/dbhome_1ORACLE_SID=ORCLexport ORACLE_HOME ORACLE_SID
# Start listener$ORACLE_HOME/bin/lsnrctl start
# Start database$ORACLE_HOME/bin/sqlplus -s / as sysdba << EOFstartup;exit;EOF
echo "Oracle database startup completed"
Monitoring and Prevention
Section titled “Monitoring and Prevention”Health Check Script
Section titled “Health Check Script”-- Database availability checkSET PAGESIZE 0 FEEDBACK OFF HEADING OFFSELECT CASE WHEN COUNT(*) > 0 THEN 'DATABASE_AVAILABLE' ELSE 'DATABASE_NOT_AVAILABLE' ENDFROM v$database;
Automated Monitoring
Section titled “Automated Monitoring”#!/bin/bash# Oracle availability monitor
ORACLE_HOME=/u01/app/oracle/product/19.0.0/dbhome_1ORACLE_SID=ORCLexport ORACLE_HOME ORACLE_SID
# Check if database is availableRESULT=$($ORACLE_HOME/bin/sqlplus -s / as sysdba << EOFSET PAGESIZE 0 FEEDBACK OFF HEADING OFFSELECT 'AVAILABLE' FROM v\$database WHERE ROWNUM = 1;EXIT;EOF)
if [[ "$RESULT" != *"AVAILABLE"* ]]; then echo "Database not available - attempting startup" $ORACLE_HOME/bin/sqlplus -s / as sysdba << EOF startup; exit;EOF
# Send alert echo "Oracle database was down and startup attempted" | \fi
Proactive Monitoring
Section titled “Proactive Monitoring”-- Create monitoring tableCREATE TABLE db_availability_log ( check_time TIMESTAMP, status VARCHAR2(20), message VARCHAR2(200));
-- Monitoring procedureCREATE OR REPLACE PROCEDURE log_db_status ASBEGIN INSERT INTO db_availability_log VALUES ( SYSTIMESTAMP, 'AVAILABLE', 'Database operational' ); COMMIT;EXCEPTION WHEN OTHERS THEN -- Log to OS file if database not available NULL;END;/
Emergency Procedures
Section titled “Emergency Procedures”Quick Diagnostic Commands
Section titled “Quick Diagnostic Commands”# Quick status checkps -ef | grep pmon | grep -v grep
# If no processes found, attempt startupsqlplus / as sysdba << EOFstartup;exit;EOF
Recovery Checklist
Section titled “Recovery Checklist”# 1. Check Oracle processesps -ef | grep oracle
# 2. Check available resourcesfree -m && df -h
# 3. Check Oracle environmentecho $ORACLE_HOME $ORACLE_SID
# 4. Attempt startupsqlplus / as sysdbastartup;
# 5. Check alert logtail -100 $ORACLE_BASE/diag/rdbms/$ORACLE_SID/$ORACLE_SID/trace/alert_$ORACLE_SID.log
Related Errors
Section titled “Related Errors”- ORA-01033: Oracle initialization or shutdown in progress
- ORA-01092: Oracle instance terminated
- ORA-12514: TNS listener does not currently know of service
- ORA-12541: TNS no listener
Best Practices
Section titled “Best Practices”- Implement automated startup procedures
- Monitor database availability continuously
- Maintain proper backup and recovery procedures
- Document startup/shutdown procedures
- Set up alerting for database unavailability
- Regular health checks and maintenance
Troubleshooting Checklist
Section titled “Troubleshooting Checklist”- Check if Oracle processes are running
- Verify Oracle environment variables
- Check system resources (memory, disk)
- Attempt database startup
- Review alert log for errors
- Check listener status
- Verify parameter file integrity
- Test database connectivity after startup