Oracle Database Architecture
Oracle Database Architecture Consists of an Oracle instance and an Oracle database.
- System Global Area (SGA): Shared by all server and background processes.
- Program Global Area (PGA): Private to each server and background process. There is one PGA for each process.
The SGA includes the following data structures:
- Database buffer cache: Caches blocks of data retrieved from the database
- Redo log buffer: Caches redo information (used for instance recovery) until it can be written to the physical redo log files stored on the disk
- Shared pool: Caches various constructs that can be shared among users
- Large pool: Is an optional area that provides large memory allocations for certain large processes, such as Oracle backup and recovery operations, and I/O server processes
- Java pool: Is used for all session-specific Java code and data within the Java Virtual Machine (JVM)
- Streams pool: Is used by Oracle Streams
Buffers in the buffer cache can be in one of the following four states:
- Pinned: Multiple sessions are kept from writing to the same block at the same time. Other sessions wait to access the block.
- Clean: The buffer is now unpinned and is a candidate for immediate aging out, if the current contents (data block) are not referenced again. Either the contents are in sync with the block contents stored on the disk or the buffer contains a consistent read (CR) snapshot of a block.
- Free or unused: The buffer is empty because the instance has just started. This state is very similar to the clean state, except that the buffer has not been used.
- Dirty: The buffer is no longer pinned but the contents (data block) have changed and must be flushed to the disk by DBWn before it can be aged out.
- User process: Is started at the time a database user requests a connection to the Oracle server
- Server process: Connects to the Oracle instance and is started when a user establishes a session
- Background processes: Are started when an Oracle instance is started
The most common background processes are the following:
- System Monitor (SMON): Performs crash recovery when the instance is started following a failure
- Process Monitor (PMON): Performs process cleanup when a user process fails
- Database Writer (DBWn): Writes modified blocks from the database buffer cache to the data files on the disk
- Checkpoint (CKPT): Updates all the data files and control files of the database to indicate the most recent checkpoint
- LogWriter (LGWR): Writes redo log entries to the disk
- Archiver (ARCn): Copies redo log files to the archival storage when a log switch occurs
Physical Database Structure(Storage):
- Control files: Contain data about the database itself (that is, physical database structure information). These files are critical to the database. Without them, you cannot open data files to access the data within the database.
- Data files: Contain the user or application data of the database.
- Online redo log files: Allow for instance recovery of the database. If the database crashes and does not lose any data files, then the instance can recover the database with the information in these files.
The following additional files are important to the successful running of the database:
- Parameter file: Is used to define how the instance is configured when it starts up
- Password file: Allows users to connect remotely to the database and perform administrative tasks
- Backup files: Are used for database recovery. You typically restore a backup file when a media failure or user error has damaged or deleted the original file.
- Archive log files: Contain an ongoing history of the data changes (redo) that are generated by the instance. Using these files and a backup of the database, you can recover a lost data file. That is, archive logs enable the recovery of restored data files.
- Trace files: Each server and background process can write to an associated trace file. When an internal error is detected by a process, the process dumps information about the error to its trace file. Some of the information written to a trace file is intended for the database administrator, whereas other information is for Oracle Support Services.
- Alert log files: These are special trace files. They are also known as alert logs. The alert log of a database is a chronological log of messages and errors. Oracle recommends that you review these files.
The Data file logically divide by the following: 1. Disk Block 2. Data Block 3. Extents 4. Segment