Process Architecture Process Architecture - A portion of a program that can run independently of and...

31
Process Architecture • Process Architecture - A portion of a program that can run independently of and concurrently with other portions of the program. Some operating systems use the terms job or task • An Oracle database server has: – User processes – Oracle processes

Transcript of Process Architecture Process Architecture - A portion of a program that can run independently of and...

Process Architecture

• Process Architecture - A portion of a program that can run independently of and concurrently with other portions of the program. Some operating systems use the terms job or task

• An Oracle database server has:– User processes– Oracle processes

User and Oracle Processes

• User (Client)Processes– Used to run the software

code of an application program

– Manage communication with the server process through the program interface

– Two types:• Connection• Session

• Oracle Processes– Used to run Oracle

database server code– Two Types:

• Server Processes• Background Process

Connection- Definition

• A physical path between your client process and the database instance.

• The connection is made between the client process and either a dedicated server or dispatcher.

Sessions are where you execute SQL commands, commit transactions and run stored procedures.

Session- Definition

• A session is a logical entity that exists in the instance. It is a†collection of data structures in memory that represent a unique session.

Differentiating between Connection and Session

• One or many Sessions may share the same physical connection to the database

OR• There could be a connection to the database with no

associated sessionsOR• A physical connection could be drop leaving a session

intact (idle) and would remain so until the connection was reestablished

Sever Process

• Handles requests of user processes connected to the instance

• Perform system functions:– Run SQL statements– Read data blocks from data file into the shared database

buffers of the SGA– Returns results in a readable format for the application

• Two configurations for Server Processes:– Dedicated server configuration– Shared server configuration

Dedicated Server Configuration

• For each user the database application is run by a different user processes that one that runs the Oracle process

Dedicated Server Configuration- Diagram

Shared Server

• The database application is run by a different user process than the one that runs the Oracle database server code

Shared Server- Diagram

Dedicated Server vs. Shared Server

• Dedicated Server– No waiting for long transactions– Scalability (Provided sufficient CPU and RAM are

available)– Recommended configuration

• Shared Server– Reduces the number of threads– Reduces the memory needed– Maximize concurrent users

Background Processes

• Database Writer (DBWn)• Log Writer (LGWR)• Checkpoint (CKPT)• System Monitor (SMON)• Process Monitor (PMON)• Archiver (ARCn)• Recoverer (RECO)• Dispatcher(Dnnn)

Background Processes - Diagram

Database Writer (DBWn)

Utilizes the Least Recently Used (LRU) algorithm for buffer management

Database Writer (DBWn)

• Manages the buffer cache so that users processes can always find free buffers

• Writes dirty buffers from the data buffer cache to the database when:– # of free buffers gets too low– Directed by the checkpoint process

Checkpoint (CKPT)

Checkpoint (CKPT)

• Coordinates the process of seeing that all transactions completed or rolled back prior to the checkpoint time have been written to back-up storage

• Writes a checkpoint number to the redo log file

• Writes a checkpoint number to the header of each tablespace and to the control file

Log Writer (LGWR)

Switch occurs only if the prior checkpoint for the next Redo Log File is complete

Log Writer (LGWR)

• Clears the Redo Log Buffer by writing its contents to a Redo Log File

• LGWR initiates a checkpoint when redo log file is full and then switches to the next Redo Log File

Archiver (ARCn)

Archiver (ARCn)

• Copies redo log files to a designated storage device after a log switch occurs

• ARCn begins writing when a log file becomes inactive

• The system will hang if the ARCn has not completed writing before that redo log file is used again

System Monitor (SMON)

SMON regularly checks if it is needed or can be called by other processes when needed

System Monitor (SMON)

• Performs recovery at start-up• Responsible for cleaning up temporary

segments no loner in use• Recovers terminated transactions skipped

during start-up, once system is available

Process monitor (PMON)

PMON regularly checks if it is needed or can be called by other processes when needed

Process monitor (PMON)

• Performs automatic processes recovery when a user process fails

• Responsible for cleaning up the database buffer cache

• Reclaims memory and other resources allocated to the failed process

• Checks status or dispatcher and server, restarts if necessary

Recoverer (RECO)

RECO fails to connect to remote serve it automatically tries again at timed interval

Recoverer (RECO)

• Used to resolve failures involving distribute transactions

• Can automatically complete the Commit or Rollback Commands, locally

• Remove all related pending transactions, globally

Dispatcher (Dnnn)

Dispatcher (Dnnn)

Dispatcher (Dnnn)

• Directs multiple incoming network session requests to a pool of shared server processes– Places a single program interface call on to a

common request queue– Removes the result from its own response queue– Returns completed request to appropriate user

References

• Oracle Database Concepts - Chapter 9 Process Architecture

• Oracle Database Developer’s Guide- Chapter 4 Managing Oracle Database Processes

• Expert Oracle Database Architecture - Thomas Kyle