Oracle Server Architecture
An Oracle server includes an Oracle Instance and an Oracle database.
Oracle instance: An Oracle Instance is a combination of two different sets of components.
- The first component includes the Memory components. That is nothing but SGA (shared global area or system global area)
- The second component includes the Background process.
SGA (shared global area or system global area).
SGA is called system global area or shared global area.
System Global area: For the entire database there is only one set of memory components.
Shared Global area: All users Present in a database can use single set of memory components only. So we can call it’s a shared Memory.
SGA contains two types of memory components.
Mandatory memory components.
These memory components are mandatory to start the database.
- SP ( LC + DDC )
Optional memory components.
These memory components will specify as per Transactions and requirement.
- Java pool
- Recycle pool
- Streams pool
- Large pool etc…
DBBC (Database buffer cache)
- Database Buffer cache is one of the most important components of System Global Area (SGA). Database Buffer Cache is the place where recently assessed data blocks are presented.
- It consists of 3 types of buffers
Free buffer: empty buffer and allows Transactional data to use.
Pinned buffer: buffers which are supporting ongoing transactions.
Dirty buffer: having Transactional data but not yet written to disk.
SP (Shared Pool)
Shared pool maintains some information to perform transaction and perform tasks. It holds two memory components.
- Data Dictionary Cache (DDC).
The dictionary cache is the memory area designated to hold dictionary data. It’s a collection of internal tables and views of reference information about the database, the structure and users info. It is also known as the row cache because it holds data as rows instead of buffers that hold entire blocks of data.
- Library Cache (LC).
The library cache is the memory area designated to hold Transactional related information. Includes the SQL areas (stores information), PL/SQL areas or variables, SQL statement id, P-code (process code), maintain SQL statements.
RLB (Redo log buffers).
Every time user performs Transactions, for every Transaction Oracle database keeps record of changes made to data. If any block got modified in DBBC that changes will send to the redo log buffers. These redo data is useful to perform the recovery operations.
BP (BACKGROUND PROCESS)
DBWR database writer process (DBWn)
DBWR writes the contents of buffers to datafiles. The DBWn processes are responsible for writing dirty buffers in the database buffer cache to disk.
When a user process needs to access a block that is not already in the buffer cache, the process must read the block from a datafile on disk into a buffer in the cache. Before reading a block into the cache, the process must first find a free buffer. The process searches the LRU (least recently used) list, starting at the least-recently-used end of the list. The process searches either until it finds a free buffer or until it has searched the threshold limit of buffers. If an Oracle user process searches the threshold limit of buffers without finding a free buffer, the process stops searching the LRU(least recently used) list and signals the DBWR process to write some of the dirty buffers to disk
The DBWR process invokes under following conditions:
- When a server process moves a buffer to the dirty list and discovers that the dirty list has reached a threshold value.
- When a time-out occurs (every three seconds)
- When a server process searches a threshold limit of buffers in the LRU list without finding a free buffer
- Check point occurs(this is nothing but an event which writes all modified database buffers in SGA and generates SCN(system change number) when ever any changes happen in database buffer).
Log writer process (LGWR)
LGWR writes these redo entries to redo log files. It means that it overwrites old entries. But before overwriting, old entries must be copies to redo log files.
Usually Log writer process (LGWR) is fast enough to manage these issues. It writes redo entries after certain amount of time to ensure that free space is available for new redo entries.
The LGWR process invokes under following conditions:
- When user performs commit
- After every three seconds
- When redo log buffer is 1/3 full.
System monitor (SMON)
It performs recovery when a failed instance starts up again. The SMON process of one instance can perform instance recovery for other instances that have failed. SMON also cleans up temporary segments that are no longer in use and recovers failed transactions skipped during system failure. These transactions are eventually recovered by SMON when the tablespace or file is brought back online.
Process monitor (PMON)
Performs process recovery when a user process fails. PMON is responsible for cleaning up the cache and releases resources that the process was using.
At specific times, all modified database buffers in the system global area are written to the data files by DBWn. This event is called a checkpoint.
The checkpoint process is responsible for signalling DBWn at checkpoints and updating all the data files and control files of the database to indicate the most recent checkpoint.It generates SCN (system change number) whenever any changes occur in the DB. It will tag the new SCN to the CRD files.
POST-1 end. Continue… with post-2