Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Oracle Architecture With Query Flow

Architecture
Oracle Architecture consists of two things,
  • Oracle Instance – consists of Memory(SGA & PGA) and Background process
  • Oracle database files – consists of OS level database files like Datafile, logfile and controlfiles.
user process (User Process Interface) : client sending a request from one end. It starts as we use putty to connect to server machine.
server process (Oracle Process Interface) : connecting to db using command sqlplus / as sysdba. Two types of server process in oracle,
1. shared server(dispatcher): multiple user using single resources for sending request and receiving reply from the database as using single server process.(till 8i)
2. Dedicated server(listener) : each and every user uses dedicate server process as independent of other user for sharing.(from 9i) (from 10g default ).
Oracle Instance:
Oracle instance consists of memory and background process.  Oracle memory consist of
  • Program Global Area (PGA)
  • System Global Area (SGA)
and oracle background process are huge in numbers. In 9i there are 60+ background process, 10g 150+ background process and in 11g 250+ background process. Some of the important background process on requirement when database starts up is,
  • System Monitor(SMON)
  • Process Monitor(PMON)
  • Database writer(DBWR)
  • Log writer(LGWR)
  • Checkpoint(Chkpt)
  • Archiver(ARCH)
password file(orapwd) : this will maintain the user password and login details and
parameter(init.ora) : this will state the parameter required for database creation.
Datafile is the collection of segments, used to store data in the format of binary as tables,index,etc. System is the default tablespace in database level.
Control file is used to store data about the database which will control entire database. We can have  minimum of one controlfile and maximum of 8.
Logfile is used in recovery process as it takes out backup of each and every transaction logs. It consist of group (minimum -2 maximum – 32) and members (minimum – 1 maximum – 8).
Archive Logfile:
It is Backup or process of storing the transaction logs from redo online log file to Archive log destination for recovery purpose.
Query Flow :
When a Query is issued from user end, user process will be initiated and it will travel to server side. Then the server process will be initiated where, it will decides whether it needs to go for Shared server or Dedicated server.  Also Program Global Area(PGA) is allocated for user query processing like sorting operation. Then the query moves to system global area(SGA) where complete query execution happens here.
Shared Pool, Here the query enters in to  Library cache where inturns it has 2 component inside, SQL Area & PLSQL Area. If the given input is of Sql Query, it will go to Sql Area and if it’s a PLSQL Block it will go PLSQL Area.  In Share pool, Query Validation and execution plan generation will takes place as below sequence of steps.
  • Syntax & Semantic check – Query keyword & identifiers will be checked.
  • Hash Value Generation – A unique value will be assigned for the query.
  • Parsing – Hard parsing (if query is new) Soft parsing (if its an already used query)
  • Execution – By Default will create 2000 plans and picks up a best plan among it for query.
Redo log Buffer cache(rlbc), is used to take backup of all transaction logs except select query for database recovery purpose. Transaction logs in rlbc  will inturn moved to online logfiles via lgwr background process.
Database Buffer Cache, (dbbc) is where the query execution will takes place using the best execution plan it received from shared pool.  It contains 3 parts namely,
  • Default – query default execution region.
  • Keep – can able to pin small tables and frequently used ones.
  • Recycle – Can able to pin huge tables and rarely used ones.
In Dbbc, we represent storage objects are buffer where the data will be written in buffer and there status are,
  • Free – empty buffer with no data written.
  • Pinned – currently writing buffer.
  • Dirty – filled or completely written buffer.
Up on execution of a user query, if the table block image already exists in the DBBC memory means, then it is called Cache hit, where it process the execution without disturbing the datafiles. Else if the block image not available in the DBBC buffer means, then it is Cache miss, where it will call the Oracle server process to fetch the image block of the respective table and put it in the DBBC and does the execution. Except select, all other sql commands which affect the database will be written it executed data permanently to the datafile using dbwr background process upon its dirty buffer status.

Comments

Popular posts from this blog

How to find the server is whether standby (slave) or primary(master) in Postgresql replication ?

7 Steps to configure BDR replication in postgresql

How to Get Table Size, Database Size, Indexes Size, schema Size, Tablespace Size, column Size in PostgreSQL Database

Ora2PG - Oracle/MySQL to Postgres DB migration Version 20.0

PostgreSQL Introduction