Oracle Database vs. Oracle Database Instance
Oracle uses a multi-layered architecture where the database and database instance are distinct yet interconnected. Understanding their differences is key for Oracle DBAs.
1. Oracle Database 📂
An Oracle Database is a collection of physical files that store data and metadata. It consists of:
✅ Datafiles (.dbf
) – Store actual user and system data.
✅ Control files (.ctl
) – Track database structure and SCN.
✅ Redo log files (.log
) – Record all changes for recovery.
✅ Temporary & Undo tablespaces – Handle transactions and rollback.
✅ Archived logs – Used for database recovery (in ARCHIVELOG mode).
✅ Password File
✅ Alert logs logs
✅ Trace logs logs
🔹 The database persists even when the Oracle instance is shut down.
2. Oracle Database Instance 🚀
An Oracle Instance is a combination of memory structures (SGA & PGA) and background processes that interact with the database.
Instance Components:
✅ SGA (System Global Area) – Shared memory that holds cached data and SQL execution plans.
✅ PGA (Program Global Area) – Memory specific to each session/process.
✅ Background Processes – Key ones include:
- DBWR (Database Writer) – Writes data from memory to disk.
- LGWR (Log Writer) – Writes redo logs to disk for recovery.
- SMON (System Monitor) – Handles recovery and maintenance.
- PMON (Process Monitor) – Manages user connections and process cleanup.
🔹 The instance exists only when the database is running.
Key Differences:
Feature | Oracle Database | Oracle Instance |
---|---|---|
Definition | A collection of physical storage files | A combination of memory structures & background processes |
Persistence | Permanent (even after shutdown) | Temporary (exists only when running) |
Components | Datafiles, Control files, Redo logs, Tablespaces | SGA, PGA, Background Processes (DBWR, LGWR, PMON, SMON, etc.) |
Location | Stored on disk | Resides in RAM (memory) |
Startup Required? | Exists even when shut down | Created only when the database starts |
Example | /u01/oradata/orcl/system01.dbf | orcl (instance name) managed by pmon |
Real-World Example:
- When you start an Oracle database, an instance is created in memory.
- When you shut down the database, the instance is removed, but the database files remain.
- If a server crashes, the database files remain intact, but the instance must be restarted.
Command to Check Database & Instance:
Please log into an Oracle server, set up your environment with the database shutdown and perform a "start nomount". The database is NOT running, only the Oracle instance. You can start the instance without the database running.
ReplyDelete