oracle dba online training: dba technologies

29
WELCOME TO DBA TECHNOLOGIES ORACLE DATABASE ARCHITECTURE-2 By Mr. PRASAD MYNUMPATI 18 Years Real Time in INDIA- USA ww w . db a t e c hn olo g i e s. n e t ww w .db a t e c hno l o g i es .n e t Building Career With Passion

Upload: dba-technologies

Post on 06-May-2015

460 views

Category:

Education


1 download

DESCRIPTION

DBA T is pchnologies Provides Oracle DBA Online Training Class course by excellent experienced IT professionals who has more then 18+ Years of real time experience Our trainers has good training experience so that best quality output will be delivered. visit - http://www.dbatechnologies.net/

TRANSCRIPT

Page 2: Oracle DBA Online Training: DBA Technologies

database Architecture – USER TS

USER tablespace is to store data permanently

Entire Application data storage and retrieval from USER tablespacesFor load balancing purpose we use different

tablespaces on different disks for INDEX andDATAHow many tablespaces for a database? depends on design of the application and number of applications

••

Page 3: Oracle DBA Online Training: DBA Technologies

ORACLE & OS comparison

FILE SYSTEM TABLESPACE

File system Partitions (ext3) Tablespaces (Undo, Temp and Permanent)

Mount file system (To read and write) By default TS is mounted

Files & Directories Tables , Indexes (objects)

OS Block size TS Block size (Default 8K)

Multi user access based on privileges Multi users access by assigned quota

Backup FS Backup tablespace

FS consistency (fsck) Database level consistency (RMAN)

Page 4: Oracle DBA Online Training: DBA Technologies

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)

Page 5: Oracle DBA Online Training: DBA Technologies

Identifying OS for ORACLE SW version

What kind of OS we need ?•• Need to follow certification matrix From oracle metalink.

www.metalink.oracle.comNeed to choose certified OS•

• Can we install multiple versions(7,8,8i,9i,10g,11g) of Oracle SW on same server?Yes we can

Page 6: Oracle DBA Online Training: DBA Technologies

Single DB vs. Multiple databases

Can we create multiple databases by using same version of Oracle Software? Yes we canOne database vs. Multiple databases– Nature of applications

••

• Dependency

– Size of the database (maintenance)– Application Complexity

…..

Page 7: Oracle DBA Online Training: DBA Technologies

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

Page 8: Oracle DBA Online Training: DBA Technologies

ORACLE INSTANCE BACKGROUND PROCESSES

Mandate and Optional background process will be stated when INSTANCE startsAll the running background processes can be viewed@ two different levelsOS LEVEL– $echo $ORACLE_SID (Instance Name)

– $ps –ef | grep $ORACLE_SIDDATABASE LEVEL

- SQL> Select PNAME From v$process Where PNAMEis not null ORDER by PNAME;

How to see all the available background process details– SQL>Select name from v$bgprocess;

Page 9: Oracle DBA Online Training: DBA Technologies

Mandate Background Processes DBWn

DBWn : Writes dirty buffers from•Instance Buffer Cache to DBF files

SHAREDPOOLDATABASE

USER DATAFILE

Redo buffers

Page 10: Oracle DBA Online Training: DBA Technologies

Mandate Background Processes DBWn

DBWn : Writes only dirty buffers that are LRU (Least recentlyUsed buffers) to dbf files and MRU during CKPT

• What is the difference between block (file) and buffer (memory)

Data BaseBuffer Cache (Memory)

Dbf fileBlocks : (Storage) Default Block Size 8KNon default supported block sizes: 2k,4k,16k,32k

Page 11: Oracle DBA Online Training: DBA Technologies

Types of Buffers in Buffer Cache

• Dirty Buffers

• Free BuffersDATABASE BUFFER CACHE

• Pinned Buffers

Page 12: Oracle DBA Online Training: DBA Technologies

Types of Buffers in Buffer Cache

Dirty Buffers–Modified in buffer cache(memory)

that are not yet(storage)

written to data files

• Free Buffers–Ready to usePinned Buffers–Buffers that are

•in use by Oracle

Page 13: Oracle DBA Online Training: DBA Technologies

DBWn writes when?

Dirty buffers thresholdWhen required free buffers are available

•• not

• During graceful/consistent shutdown

• Any TS status change like (read only,offline or Tablespace Begin backup..)

Checkpoint•

Page 14: Oracle DBA Online Training: DBA Technologies

)

Mandate Background Processes LGWR

• LGWR : Log writer writes change records redo buffers to redo log files

from

SHAREDPOOLDATABASE

Current (In use)Active (Required for recoveryInactive (Ready to be current)

Redo log filesLog Switch

Redo buffers

Page 15: Oracle DBA Online Training: DBA Technologies

LGWR writes when

At every commitEvery three secondsWhen 1/3 full of redo log buffersWhen worth of redo records is 1MBWhat contains change vectors– Change record is combination of change

•••••

vectors– Change vector contains

••••••

Scn and Time Stamp of changeTransaction IdCommit details if committed ( scn and timestamp)Type of operationSegment name and typeChange details

Page 16: Oracle DBA Online Training: DBA Technologies

LGWR

Server Process copy redo records from user memory space (PGA) to redo log buffers for every DML and DDLLOG_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 completeHighly recommended multiplexing

Page 17: Oracle DBA Online Training: DBA Technologies

Mandate

DBWn

background process CKPT

LRU LRU LRUSHARED POOL

DATABASE BUFFER CACHE

REDO LOGBUFFERS

MRU MRU MRUCKPT

Data723

file 1723 723

723723

Control file Data file 2 Redo log files

Page 18: Oracle DBA Online Training: DBA Technologies

Mandate background process CHECKPOINT

•Checkpoint is a very critical background process to reduce the instance or media recovery timeCheckpoint 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 fromCheckpoint ensures all the dirty buffers to disk(LRU & MRU)

Checkpoint position is the oldest dirty buffer in the database buffer cache

Page 19: Oracle DBA Online Training: DBA Technologies

Types of checkpoint

Thread 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

Page 20: Oracle DBA Online Training: DBA Technologies

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 thatbelongs to a TS

Page 21: Oracle DBA Online Training: DBA Technologies

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 dirtybuffers, it advances the checkpointposition to the control file but not thedata file headers

Page 22: Oracle DBA Online Training: DBA Technologies

Types of checkpoint

Incremental checkpointsIt is kind of thread checkpoint in order to avoid large number of blocks at online redo log switches.

••

• DBWn checks every 3 seconds to checkany work to do, if DBWn writes dirtybuffers, it advances the checkpointposition to the control file but not thedata file headers

Page 23: Oracle DBA Online Training: DBA Technologies

Mandate background process SMON

SMON : System MonitorResponsible 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–

Page 24: Oracle DBA Online Training: DBA Technologies

SHARED POOL DATABASE

BUFFER CACHE

ICR - SMON

SMON

INSTANCE STARTUP AFTER CRASH

CrashRecovery 245

245 Data file 1

245

245

Data file 2

Data file 3245 - Control file

1.Rollforward2.Rollback (uncommitted txns)3. Recovery done Committed &

un committedCommitted &un committed

245 Undo Data file 1

Page 25: Oracle DBA Online Training: DBA Technologies

Mandate background process PMON

PMON : Processes Monitor•• Responsible

resources offor cleaninga dead processes

SGA

User process

User process Crash

PMON

Page 26: Oracle DBA Online Training: DBA Technologies

Mandate background process

RECO : Recoverer

RECO

•• Responsible for resolving in-doubt transactions in distributed

database environment.Distributed txn

RECO RECO

User

Page 27: Oracle DBA Online Training: DBA Technologies

SQL statements processing in

ServerProcesses

ORACLE DATABASE

PARSING

DATABASEBUFFER CACHE

1. Syntax check2. Semantic check3.Shared pool check

SHAREDPOOL

REDO BUFFERS

UserProces

s

If SPcheck

=no

SQL> Select *from employees; soft

harddata file

OPTIMIZERExecution

Row source generation Multiple EP’s

Page 28: Oracle DBA Online Training: DBA Technologies

p

Use

SQL statements processing in

ServerProcesses

ORACLE DATABASE

PARSING

DATABASEBUFFER CACHE

1. Syntax check2. Semantic check3.Shared pool check

SHAREDPOOLUser

Process

Rows u dated

10k 10k 10k

REDOBUFFERSDBWn 20k 20k 20k

If SPcheck

=no

SQL> Updatesal=20K fromsalary where

sal=10K

softUndo data file

hardr data file

OPTIMIZERExecution

Row source generation Multiple EP’s