WELCOME TO DBA TECHNOLOGIES
ORACLE DATABASE ARCHITECTURE-2 By Mr . PRASAD MYNUMPATI 18 Years Real Time in INDIA-USA
www.dbatechnologies.net
www.dbatechnologies.net Building Career With Passion
database Architecture USER TS
USER tablespace is to store data permanently Entire Application data storage and retrieval from USER tablespaces For load balancing purpose we use different tablespaces on different disks for INDEX and DATA How many tablespaces for a database? depends on design of the application and number of applications
ORACLE & OS comparison
FILE SYSTEM File system Partitions (ext3) Mount file system (To read and write) Files & Directories OS Block size Multi user access based on privileges Backup FS TABLESPACE Tablespaces (Undo, Temp and Permanent) By default TS is mounted Tables , Indexes (objects) TS Block size (Default 8K) Multi users access by assigned quota Backup tablespace
FS consistency (fsck)
Database level consistency (RMAN)
Server & Storage configuration
OS and ORACLE SW is on Server Database is going to be on high end storage
NAS (Network area Storage) SAN (Storage area Networks)
Identifying OS for ORACLE SW version
What kind of OS we need ? Need to follow certification matrix from oracle metalink. www.metalink.oracle.com Need to choose certified OS Can we install multiple versions (7,8,8i,9i,10g,11g) of Oracle SW on same server? Yes we can
Single DB vs. Multiple databases
Can we create multiple databases by using same version of Oracle Software? Yes we can One database vs. Multiple databases Nature of applications Dependency Size of the database (maintenance) Application Complexity ..
Instance and Database
Instance will be hosted on server
CPU MEM PROCESSES
Database (C,R,D files) is located on high end storage solutions like SAN with fiber optic technology. Process power and memory for all Database operations are from server resources
ORACLE INSTANCE BACKGROUND PROCESSES
Mandate and Optional background process will be stated when INSTANCE starts All the running background processes can be viewed @ two different levels OS LEVEL $echo $ORACLE_SID (Instance Name) $ps ef | grep $ORACLE_SID DATABASE LEVEL - SQL> Select PNAME From v$process Where PNAME is not null ORDER by PNAME; How to see all the available background process details SQL>Select name from v$bgprocess;
Mandate Background Processes DBWn
DBWn : Writes dirty buffers from Instance Buffer Cache to DBF files
DATABASE SHARED POOL Redo buffers
USER DATAFILE
Mandate Background Processes DBWn
DBWn : Writes only dirty buffers that are LRU (Least recently Used buffers) to dbf files and MRU during CKPT What is the difference between block (file) and buffer (memory)
Data Base Buffer Cache (Memory)
Dbf file Blocks : (Storage) Default Block Size 8K Non default supported block sizes: 2k,4k,16k,32k
Types of Buffers in Buffer Cache
Dirty Buffers Free Buffers
DATABASE BUFFER CACHE
Pinned Buffers
Types of Buffers in Buffer Cache
Dirty Buffers
Modified in buffer cache(memory) that are not yet written to data files (storage)
Free Buffers
Ready to use
Pinned Buffers
Buffers that are in use by Oracle
DBWn writes when?
Dirty buffers threshold When required free buffers are not available During graceful/consistent shutdown Any TS status change like (read only, offline or Tablespace Begin backup..) Checkpoint
Mandate Background Processes LGWR
LGWR : Log writer writes change records from redo buffers to redo log files
DATABASE SHARED POOL
Redo buffers
Current (In use) Active (Required for recovery ) Inactive (Ready to be current)
Redo log files Log Switch
LGWR writes when
At every commit Every three seconds When 1/3 full of redo log buffers When worth of redo records is 1MB What contains change vectors
Change record is combination of change vectors
Change vector contains
Scn and Time Stamp of change Transaction Id Commit details if committed ( scn and timestamp) Type of operation Segment name and type Change details
LGWR
Server Process copy redo records from user memory space (PGA) to redo log buffers for every DML and DDL LOG_BUFFER is the parameter to set redo log buffers size. Min 64k. Log buffer space (v$session_wait) wait event(in seconds) indicates insufficient log buffers size
V$system_event - log file switch completion (event,total_waits, time_waited and average_wait) Alert log file also records the above event check for checkpoint not complete Highly recommended multiplexing
Mandate background process CKPT
DBWn LRU LRU LRU SHARED POOL DATABASE BUFFER CACHE CKPT MRU MRU MRU REDO LOG BUFFERS
Data file 1
723 723 723
723
723
Control file
Data file 2
Redo log files
Mandate background process CHECKPOINT
Checkpoint is a very critical background process to reduce the instance or media recovery time Checkpoint wont write any data but in only ensures marking SCN in Redo, Control file and data files
During checkpoint DBWn writes data to dbf files and marks Redo, control file and data files with scn#
Checkpoint position (SCN) in redo is the pointer where recovery must start from Checkpoint ensures all the dirty buffers to disk (LRU & MRU) Checkpoint position is the oldest dirty buffer in the database buffer cache
Types of checkpoint
(database checkpoint) Database writes to disk all buffers modified by redo in a specific thread, occurs during the following situations
Consistent database shutdown Alter system checkpoint Online redo log switch Alter database begin backup
Thread checkpoint :
Types of checkpoint
TS and data file checkpoints:
Tablespace checkpoint is with respect to a particular table space during the status change like read only, read write, begin backup. Only for the data files that belongs to a TS
Types of checkpoint
Incremental checkpoints
It is kind of thread checkpoint in order to avoid large number of blocks at online redo log switches.
DBWn checks every 3 seconds to check any work to do, if DBWn writes dirty buffers, it advances the checkpoint position to the control file but not the data file headers
Types of checkpoint
Incremental checkpoints
It is kind of thread checkpoint in order to avoid large number of blocks at online redo log switches. DBWn checks every 3 seconds to check any work to do, if DBWn writes dirty buffers, it advances the checkpoint position to the control file but not the data file headers
Mandate background process SMON
SMON : System Monitor Responsible for Instance crash recovery (ICR) Cleans up temporary segments. For example if index creation failed it cleans up all the temporary segments. What is ICR? Instance recovery is applying records from redo to dbf files after most recent checkpoint Information from redo must be transferred to dbf to make it permanent and consistent
ICR - SMON
SMON SHARED POOL DATABASE BUFFER CACHE AFTER CRASH INSTANCE STARTUP
Crash Recovery 245 245 245 - Control file
1.Rollforward 2.Rollback (uncommitted txns) 3. Recovery done
245 Data file 1 Data file 2 Data file 3
245
245
Undo Data file 1
Committed & un committed
Committed & un committed
Mandate background process PMON
PMON : Processes Monitor Responsible for cleaning resources of a dead processes
SGA
User process
User process Crash
PMON
Mandate background process RECO
RECO : Recoverer Responsible for resolving in-doubt transactions in distributed database environment.
Distributed txn
RECO User
RECO
SQL statements processing in ORACLE DATABASE
Server Processes DATABASE BUFFER CACHE SHARED POOL
REDO BUFFERS
PARSING 1. Syntax check 2. Semantic check 3.Shared pool check
User Process
SQL> Select * from employees; data file Execution Row source generation
soft
If SP check =no hard OPTIMIZER
Multiple EPs
SQL statements processing in ORACLE DATABASE
Server Processes DATABASE BUFFER CACHE 10k 10k 10k
DBWn 20k 20k 20k PARSING 1. Syntax check 2. Semantic check 3.Shared pool check
User Process
Rows u pdated
SHARED POOL
REDO BUFFERS
SQL> Update sal=20K from salary where sal=10K
Undo data file User data file Execution Row source generation
soft
If SP check =no hard OPTIMIZER
Multiple EPs
Building career with passion
QUESTION AND ANSWER SESSION
DSNR:944 11 72 718/040-65555689 www.dbatechnologies.net