04SampleArchitecture-1
Short Description
Sample Architecture...
Description
4. A sample relational db server
7/24/13 10:32 PM
A sample relational database server
© Janusz R. Getta
CSCI317/MCS9317 Database Performance Tuning, SCSSE, Spring 2013
1
4. A sample relational db server
7/24/13 10:32 PM
Oracle system architecture Oracle Instance (software) Transient memory Background processes
© Janusz R. Getta
Oracle Database (data) Persistent memory
CSCI317/MCS9317 Database Performance Tuning, SCSSE, Spring 2013
2
4. A sample relational db server
7/24/13 10:32 PM
Oracle system architecture Clients
...
Server process PGA
Server process PGA
Server process PGA
Server process PGA
Server process PGA
...
Server process PGA
System Global Area (SGA) Data buffer caches
DBWR
Shared pool
CKPT
Database files © Janusz R. Getta
LGWR
Log files
Redo log buffer
Large pool
ARCH
Control files
Java pool
Background processes PMON SMON
Archive log & backup files
CSCI317/MCS9317 Database Performance Tuning, SCSSE, Spring 2013
3
4. A sample relational db server
7/24/13 10:32 PM
Data buffer caches DEFAULT pool contains miscellaneous data blocks KEEP pool contains frequently accessed data blocks KEEP pool retains data blocks RECYCLE pool contains data blocks from full table scans RECYCLE pool eliminates data blocks as soon as they are no longer needed nK pools contain data blocks from nK tablespaces DEFAULT pool 2K pool © Janusz R. Getta
RECYCLE pool
KEEP pool 4K pool
8K pool
16K pool
32K pool
CSCI317/MCS9317 Database Performance Tuning, SCSSE, Spring 2013
4
4. A sample relational db server
7/24/13 10:32 PM
Redo log buffer Redo log buffer is a circular buffer that contains information (redo entires) about changes made to the database by INSERT, UPDATE, DELETE, CREATE, ALTER, and DROP statements Log writer background process writes the contents of redo log buffer into a group of mirrored redo log files; the files are cyclical such that when one is full log writer uses the next one; the first file is overwritten only after it has been checkpointed or archived
Redo Log buffer © Janusz R. Getta
CSCI317/MCS9317 Database Performance Tuning, SCSSE, Spring 2013
5
4. A sample relational db server
7/24/13 10:32 PM
Redo log buffer The modifications of data blocks are initially recorded in redo log buffer; then log writer process writes the contents of redo log buffer into one of the files from a circular group of redo log files; these files are used to recover the transactions when the system fails Redo log buffer is flushed into redo log file in one of the cases: (1) every three seconds, (2) whenever a transaction commits, (3) when log writer process (LGWR) is is asked to switch log files, (4) when redo log buffer is 1/3 full © Janusz R. Getta
CSCI317/MCS9317 Database Performance Tuning, SCSSE, Spring 2013
6
4. A sample relational db server
7/24/13 10:32 PM
Redo log buffer Default size of redo log buffer is controlled by LOG_BUFFER parameter, it is max(256 kbytes, (128*number CPUs)) the smallest size is 256Kbytes The systems with many concurrent transactions would benefit from a larger redo log buffer because log write can operate on the buffer concurrently with the transactions Long transactions writing a lot to a database benefit from a large redo log buffer
© Janusz R. Getta
CSCI317/MCS9317 Database Performance Tuning, SCSSE, Spring 2013
7
4. A sample relational db server
7/24/13 10:32 PM
Shared pool LIBRARY cache contains parse trees and execution plans for SQL statements, PL/SQL procedures and packages and control structures such as locks and library cache handles DICTIONARY cache contains a collection of data dictionary relational tables containing information about the structures of the database LRU strategy is used to control allocation and deallocation of memory in Shared pool
LIBRARY cache © Janusz R. Getta
DICTIONARY cache
Control structures
CSCI317/MCS9317 Database Performance Tuning, SCSSE, Spring 2013
8
4. A sample relational db server
7/24/13 10:32 PM
Large pool Large pool cache contains session memory for the shared server and XA interface (transactions interact with more than one database), I/O server processes, backup and restore operations, and parallel execution message buffer Large pool is used to store large memory allocations Large pool is strongly recommended when using multithreaded server
LARGE pool © Janusz R. Getta
CSCI317/MCS9317 Database Performance Tuning, SCSSE, Spring 2013
9
4. A sample relational db server
7/24/13 10:32 PM
Java pool Java pool consists of transient memory used by the local Java Virtual Machine Java pool is needed only with Java stored procedures, Java Beans, or other options included in Jserver option of the system
JAVA pool © Janusz R. Getta
CSCI317/MCS9317 Database Performance Tuning, SCSSE, Spring 2013
10
4. A sample relational db server
7/24/13 10:32 PM
Process Global Area Process Global Area (PGA) is a transient memory area that contains data and control information for a server process Process Global Area (PGA) consist of private SQL area (bind information and run-time memory structures), cursor areas, stack space, session memory, and SQL work areas (sorting, hashing, operations on bitmaps)
Connection information SORT area © Janusz R. Getta
Cursor state
Stack space HASH area
CSCI317/MCS9317 Database Performance Tuning, SCSSE, Spring 2013
11
4. A sample relational db server
7/24/13 10:32 PM
Database files UNI (database) STAFF (tablespace)
staff01.dbf staff02.dbf std01.dbf std02.dbf (file) (file) (file) (file) STAB (table)
SUBJ (table)
SYSTEM (tablespace)
STUDENT (tablespace)
SIDX (index)
STD (table)
std03.dbf (file) ENROLMENT (table)
STAB SIDX STD ENROLMENT SUBJ (data seg) (data seg)(index seg) (data seg) (data seg)
system01.dbf (file) SYS (table) SYS (data segment)
(extents) (data blocks)
© Janusz R. Getta
CSCI317/MCS9317 Database Performance Tuning, SCSSE, Spring 2013
12
4. A sample relational db server
7/24/13 10:32 PM
File system mechanisms Operating file systems: these are the files that appear in a file system of a given operating system Raw partitions: these are very big sections of persistent storage without any sort of file system on it; raw partitions are not buffered - all I/O is direct without any buffering from operation system Automatic Storage Management (ASM): ASM is a file system exclusively designed for a database; data is still stored in files; file system is ASM Clustered file system: it is a traditional file system that is shared by many nodes (computers) in a clustered environment. © Janusz R. Getta
CSCI317/MCS9317 Database Performance Tuning, SCSSE, Spring 2013
13
4. A sample relational db server
7/24/13 10:32 PM
Parameter files Parameter files tell the system where to find control files, trace files, and what are the initial values of certain system parameters, e.g. DB_NAME, SGA_MAX_SIZE, SORT_AREA_SIZE, etc A name of server parameter file (SPFILE) is spfile.ora A legacy parameter file has a name init.ora A sample contents of init.ora: db_block_size=8192 db_cache_size=100M open_cursors=100 background_dump_dest= /packages/csoracle/u02/app/oracle/admin/csci/bdump core_dump_dest=/packages/csoracle/u02/app/oracle/admin/csci/cdump timed_statistics=TRUE user_dump_dest=/packages/csoracle/u02/app/oracle/admin/csci/udump © Janusz R. Getta
CSCI317/MCS9317 Database Performance Tuning, SCSSE, Spring 2013
14
4. A sample relational db server
7/24/13 10:32 PM
Online redo log files Online redo log files are used for instance recovery after crash, media recovery after a data file restore from backup, standby database processing, redo log mining processes for information sharing The system implements write-ahead logging algorithm that writes all old/new values in to the log files before the modifications are performed in a database NOLOGGING attribute allows from the exclusion of the operations on some data objects, e.g. tablespaces, to be logged The system needs at least two files in a group of redo log files; it is recommended to mirror the redo log file groups on different disk drives © Janusz R. Getta
CSCI317/MCS9317 Database Performance Tuning, SCSSE, Spring 2013
15
4. A sample relational db server
7/24/13 10:32 PM
Online redo log files Each redo log group consists of one or more redo log members where the individual redo log file members are the mirror images of each other Redo log files are fixed in size and are used in a circular fashion Switching from one group of log files to another triggers checkpointing, i.e the systems writes all modified blocks in data buffer cache do persistent storage
© Janusz R. Getta
CSCI317/MCS9317 Database Performance Tuning, SCSSE, Spring 2013
16
4. A sample relational db server
7/24/13 10:32 PM
Archived log files The archived log files are the copies of log files performed when the old contents of a cyclic redo log file is about to be overwritten The log files are archived when the system runs in ARCHIVELOG mode
© Janusz R. Getta
CSCI317/MCS9317 Database Performance Tuning, SCSSE, Spring 2013
17
4. A sample relational db server
7/24/13 10:32 PM
Control files The control files contain information about all files in a database and are used to maintain internal consistency of the system The control files also contain information about checkpoints, database name, timestamp when a database was created, archive rego log history, and recovery manager information The control files are vital to startup of the system; it is recommended to mirror the control files on different disk drives
© Janusz R. Getta
CSCI317/MCS9317 Database Performance Tuning, SCSSE, Spring 2013
18
4. A sample relational db server
7/24/13 10:32 PM
Trace files Trace file contain information written by the background processes when an internal error occurs or when the lower level tracing is turned on There are two types of trace files: (1) Trace files requested by database administrator; these are the results of enabling SQL_TRACE=TRUE; these contains diagnostic information about user session (2) Trace files server generated in the responses to the system internal errors
© Janusz R. Getta
CSCI317/MCS9317 Database Performance Tuning, SCSSE, Spring 2013
19
4. A sample relational db server
7/24/13 10:32 PM
Alert file Alert file (alert log) contains a history of a database: log file switches, internal errors, block corruption errors, deadlock errors, created tablespaces, tablespaces taken offline/online, shutdown and restart operations, administrative operations, errors of shared servers and dispatchers, and errors occurred during automatic refresh of materialized views, etc
© Janusz R. Getta
CSCI317/MCS9317 Database Performance Tuning, SCSSE, Spring 2013
20
4. A sample relational db server
7/24/13 10:32 PM
Background processes DBWR0..DBWR19 Database writer processes The database writer processes are responsible for writing the modified data blocks ("dirty blocks) from data buffer cache to persistent storage
LGWR Log writer process The log writer process writes all redo entries that have been copied into log buffer since the last time it wrote
CKPT Checkpoint process The checkpoint process updates the datafile headers and the control files to record the checkpoint event; the checkpoint process does not write the data blocks from data buffer cache to persistent storage (see DBWRn) © Janusz R. Getta
CSCI317/MCS9317 Database Performance Tuning, SCSSE, Spring 2013
21
4. A sample relational db server
7/24/13 10:32 PM
Background processes SMON System monitor process The system monitor process is responsible for recovery, cleaning up temporary segments when no longer needed, and coalescing contiguous free extents
PMON Process monitor The process monitor performs a recovery when a user process fails, cleans up data buffer cache and releases the resources occupied the failed process
CJQ0..CJQn Job queue processes The job queue processes run the scheduled users' jobs in batch processing
© Janusz R. Getta
CSCI317/MCS9317 Database Performance Tuning, SCSSE, Spring 2013
22
4. A sample relational db server
7/24/13 10:32 PM
Background processes RECO Recoverer process The recoverer process resolves the failures involving the distributed transactions
ARCH0..ARCH9 Archiever processes The archiever processes copy the contents of redo log file to another persistent storage location after a log file switch has occurred
Dnnn Dispatcher processes The dispatcher processes are the components of multithreaded database server; dispatcher processes handle multiple connections between client processes and server processes © Janusz R. Getta
CSCI317/MCS9317 Database Performance Tuning, SCSSE, Spring 2013
23
4. A sample relational db server
7/24/13 10:32 PM
Background processes LMS Lock manager server process The lock manager server process provides inter-instance resource management in Real Application Cluster option
QMN0..QMN9 Queue monitor processes The queue monitor processes manage job queues in Advanced Queuing option
Snnn Server processes The server processes handle the requests of the users connected to the instance; parse and run SQL, read data blocks; return the results
© Janusz R. Getta
CSCI317/MCS9317 Database Performance Tuning, SCSSE, Spring 2013
24
4. A sample relational db server SELECT * FROM EMPLOYEE WHERE employee_id = :1 FOR UPDATE OF salary
Clients
Oracle process flows ...
1
6
Server process PGA 5
3
Server process PGA
DBWR
Server process PGA
Server process PGA
Server process PGA
...
Server process PGA
System Global Area (SGA)
2
Data buffer caches
4
7/24/13 10:32 PM
Shared pool
CKPT
Database files © Janusz R. Getta
LGWR
Log files
Redo log buffer
Large pool
ARCH
Control files
Java pool
Background processes PMON SMON
Archive log & backup files
CSCI317/MCS9317 Database Performance Tuning, SCSSE, Spring 2013
25
4. A sample relational db server UDATE EMPLOYEE SET salary = :2 WHERE employee_id = :1;
Clients
7/24/13 10:32 PM
Oracle process flows ...
1
Server process PGA
Server process PGA
Server process PGA 5
3
Server process PGA
Server process PGA
...
Server process PGA
System Global Area (SGA)
2
4
Data buffer caches
Shared pool
Redo log buffer
Large pool
Java pool
6
DBWR
CKPT
LGWR
ARCH
Background processes PMON SMON
6
EMPLOYEE
UNDO tbs
Database files © Janusz R. Getta
Log files
Control files
Archive log & backup files
CSCI317/MCS9317 Database Performance Tuning, SCSSE, Spring 2013
26
4. A sample relational db server UDATE EMPLOYEE SET salary = :2 WHERE employee_id = :1;
7/24/13 10:32 PM
Oracle process flows
COMMIT;
Clients
...
1
Server process PGA
Server process PGA
Server process PGA 5
3
Server process PGA
Server process PGA
...
Server process PGA
System Global Area (SGA)
2
4
Data buffer caches
Java pool
Large pool
Redo log buffer
Shared pool
6 7
DBWR
CKPT
6
7
LGWR
8
Background processes PMON SMON
ARCH 8
EMPLOYEE
8
UNDO tbs
Database files © Janusz R. Getta
Log files
Control files
Archive log & backup files
CSCI317/MCS9317 Database Performance Tuning, SCSSE, Spring 2013
27
4. A sample relational db server
7/24/13 10:32 PM
Typical performance problems Category Memory
Problem Poor data buffer cache hit ratio
Contention
Redo log waits Free list waits Rollback waits
I/O
Disk contention Slow access to data dictionary Slow disk sorts High physical I/O
© Janusz R. Getta
Caused by Large table scans, not enough RAM, invalid table/index placement in buffer caches Incorrect size of redo logs, too small redo log buffer Bot enough lists with free data blocks Insufficient number of rollback segments Incorrect size of redo logs, too small redo log buffer SYSTEM tablespace on frequently used device Tablespace used for sorting on frequently used device Large table scans, too small buffer cache, invalid object placement in KEEP RECYCLE caches
CSCI317/MCS9317 Database Performance Tuning, SCSSE, Spring 2013
28
4. A sample relational db server
7/24/13 10:32 PM
Typical performance problems Category Space
Problem Caused by Out of space conditions Poorly forecasted data volumes Tablespace fragmentation
SQL
Large join queries
Object activity
Chaining in tables Rollback extension Many large table scans Object fragmentation
© Janusz R. Getta
Invalid settings of object space size or tablespace object setting, not using locally managed tablespaces Overnormalized database design Incorrect setting of PCTFREE, PCTUSED, too small database block size Incorrect size of rollback segments, not using auto-UNDO management Incorrect indexing schema Incorrect initial sizing, not performing defragmentation
CSCI317/MCS9317 Database Performance Tuning, SCSSE, Spring 2013
29
4. A sample relational db server
7/24/13 10:33 PM
References T. Kyte Expert Oracle Database Architecture 9i, 10g, and 11g Programming techniques and Solutions, Apress 2011, chapters 2, 3, 4 G. Harrison Oracle Performance Survival Guide, Prentice Hall, 2010, chapter 2
© Janusz R. Getta
CSCI317/MCS9317 Database Performance Tuning, SCSSE, Spring 2013
30
View more...
Comments