Oracle Database Frequently Asked Questions

Q1: What to do when encountering permission errors during installation?

A: Ensure the installation is executed using the oracle user, and this user belongs to both oinstall and dba groups. Verify user and group configurations in /etc/passwd and /etc/group files.

Q2: How to resolve insufficient memory errors during installation?

A: Oracle Database requires adequate memory. Solutions include:

  • Increasing system physical memory
  • Adjusting kernel parameters: kernel.shmmax and kernel.shmall
  • Selecting smaller configuration options during installation (such as Desktop class installation)

Q3: How to run Oracle Database in Docker?

A: Oracle provides official Docker images:

# Oracle Database Free (19c)
docker pull container-registry.oracle.com/database/free:19.3.0.0
docker run -d -p 1521:1521 --name oracle-free container-registry.oracle.com/database/free:19.3.0.0

# Note: Initial startup may take considerable time for initialization

Connection Issues

Q4: How to resolve ORA-12541: TNS:no listener error?

A: This error indicates the listener is not running. Solutions:

# Start listener
lsnrctl start

# Check listener status
lsnrctl status

# Ensure listener configuration is correct (listener.ora file)

Q5: ORA-12170: TNS:Connect timeout occurred error?

A: Network connection timeout. Check:

  • Database server accessibility (ping test)
  • Firewall blocking port 1521
  • Listener listening on correct IP address
  • tnsnames.ora configuration correctness

Q6: How to reset sys/system passwords?

A: Use orapwd tool to reset password file:

# Stop database
sqlplus / as sysdba
SHUTDOWN IMMEDIATE;

# Recreate password file
orapwd file=$ORACLE_HOME/dbs/orapw$ORACLE_SID password=new_password force=y

# Start database
STARTUP;

Performance Issues

Q7: How to optimize slow queries?

A: Performance optimization steps:

  1. Analyze execution plan: Use EXPLAIN PLAN to view query execution path
  2. Check indexes: Ensure columns in WHERE clause have appropriate indexes
  3. Collect statistics: EXEC DBMS_STATS.GATHER_TABLE_STATS
  4. SQL Tuning Advisor: Use Oracle SQL Tuning Advisor
  5. Check wait events: Query v$session_wait view

Q8: How to view currently executing slow queries?

A: Query v$session and v$sql views:

SELECT s.sid, s.serial#, s.username, s.status, 
       q.sql_text, q.elapsed_time, q.cpu_time
FROM v$session s, v$sql q
WHERE s.sql_id = q.sql_id
  AND s.status = 'ACTIVE'
  AND q.elapsed_time > 1000000; -- Execution time over 1 second

Q9: What to do when memory usage is too high?

A: Adjust memory parameters:

  • SGA_TARGET: Total System Global Area size
  • PGA_AGGREGATE_TARGET: Total Program Global Area size
  • MEMORY_TARGET: Automatic Memory Management (11g and above)
-- View current memory usage
SHOW PARAMETER memory;
SHOW PARAMETER sga;
SHOW PARAMETER pga;

-- Dynamic adjustment (requires sysdba privileges)
ALTER SYSTEM SET MEMORY_TARGET = 4G SCOPE=BOTH;

Backup and Recovery Issues

Q10: How to handle RMAN backup failures?

A: Common RMAN troubleshooting:

  • Insufficient space: Check backup destination directory space
  • Permission issues: Ensure oracle user has write permissions to backup directory
  • Missing archive logs: Ensure all archive logs are available
  • Channel configuration: Verify RMAN channel configuration is correct

Q11: How to recover a mistakenly deleted table?

A: Recovery methods depend on backup strategy:

  1. Flashback Table (if enabled):
    FLASHBACK TABLE table_name TO BEFORE DROP;
    
  2. RMAN Point-in-Time Recovery:
    RUN {
        SET UNTIL TIME "TO_DATE('2026-03-30 08:00:00', 'YYYY-MM-DD HH24:MI:SS')";
        RESTORE DATABASE;
        RECOVER DATABASE;
    }
    
  3. Data Pump Import: Restore from recent export file

Version Differences

Q12: What are the main differences between Oracle Database 19c and 26ai?

A: Main differences include:

  • AI Features: 26ai integrates AI-driven automated management capabilities
  • Performance Optimization: 26ai provides smarter resource management and query optimization
  • Security: 26ai enhances security monitoring and threat detection capabilities
  • Cloud Native Support: 26ai has better support for containerization and cloud environments

Q13: What should be noted when upgrading from 19c to 26ai?

A: Upgrade considerations:

  • Compatibility Check: Use Database Upgrade Assistant (DBUA) for pre-checks
  • Backup: Complete database backup must be performed before upgrade
  • Test Environment: Validate upgrade process in test environment first
  • Application Compatibility: Ensure applications are compatible with new version
  • Licensing: Confirm licensing requirements for new version

Daily Maintenance

Q14: How to clean up archive logs?

A: Archive log cleanup methods:

# Use RMAN to delete backed-up archive logs
rman target /
DELETE ARCHIVELOG ALL COMPLETED BEFORE 'SYSDATE-7';

# Manual deletion (not recommended unless certain they are backed up)
rm $ORACLE_BASE/fast_recovery_area/*/archivelog/*.arc

Q15: What to do when tablespace is full?

A: Tablespace expansion methods:

-- Add data file
ALTER TABLESPACE users ADD DATAFILE '/u01/app/oracle/oradata/ORCL/users02.dbf' SIZE 1G;

-- Resize existing data file
ALTER DATABASE DATAFILE '/u01/app/oracle/oradata/ORCL/users01.dbf' RESIZE 2G;

-- Enable autoextend
ALTER DATABASE DATAFILE '/u01/app/oracle/oradata/ORCL/users01.dbf' AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;

Q16: How to monitor database health status?

A: Health monitoring methods:

  • AWR Reports: Generate and analyze AWR reports regularly
  • ADDM Reports: Automatic Database Diagnostic Monitor
  • OEM: Oracle Enterprise Manager
  • Custom Scripts: Monitor key metrics (session count, locks, tablespace usage, etc.)

Troubleshooting

Q17: What to do when database cannot start?

A: Startup troubleshooting steps:

  1. Check alert log: $ORACLE_BASE/diag/rdbms/<DB_NAME>/trace/alert_<SID>.log
  2. Check control files: Ensure control files exist and are accessible
  3. Check data files: Ensure all data files exist
  4. Check parameter file: Verify spfile or pfile configuration is correct
  5. Try mount mode: STARTUP MOUNT then troubleshoot step by step

Q18: How to handle deadlocks?

A: Deadlock handling methods:

  • Automatic handling: Oracle automatically detects and terminates one of the transactions
  • Manual intervention: Query v$lock and v$session to find blocking sessions and kill them
    ALTER SYSTEM KILL SESSION 'sid,serial#' IMMEDIATE;
    
  • Prevention measures: Ensure consistent access order at application level

Licensing and Costs

Q19: What are the limitations of Oracle Database free versions?

A: Oracle Database Free (19c/26ai) limitations:

  • CPU Limit: Maximum 2 CPUs
  • Memory Limit: Maximum 2GB RAM
  • Storage Limit: Maximum 12GB user data
  • Feature Limit: Does not include enterprise edition advanced features (such as RAC, Data Guard, etc.)

Q20: How to reduce Oracle licensing costs?

A: Cost optimization strategies:

  • Use free versions: For development and small production environments
  • Plan CPU licensing appropriately: Purchase based on actual usage
  • Consider cloud services: OCI, AWS RDS, etc. pay-as-you-go models
  • Regular audits: Ensure license compliance and avoid over-usage

Reference Resources