730 likes | 1.24k Views
Oracle Architecture. Or why Access is not a “real” database. Objectives. Describe the Oracle7 Server architecture Understand what is involved in administering a database Understand how to create a complete database. DBA Duties. Understand the Oracle Server Architecture
E N D
Oracle Architecture Or why Access is not a “real” database
Objectives • Describe the Oracle7 Server architecture • Understand what is involved in administering a database • Understand how to create a complete database
DBA Duties • Understand the Oracle Server Architecture • Design & create the database • Start up & shut down the database • Back up & restore the database • Enroll & monitor users • Manage database storage • Grant database privileges
Oracle Server Architecture Objectives • Define the Oracle Server components • Distinguish between user & server processes • Define the background processes
Overview Background Processes Server Processes System Global Area User Processes
System Global Area (SGA) Components SGA Database Buffer Cache Redo Log Buffer Shared Pool
System Global Area (SGA) Components The Shared Pool Dictionary Cache Library Cache Text of Statement Parsed Form of Statement Execution Plan
System Global Area (SGA) Components The Database Buffer Cache
System Global Area (SGA) Components The Redo Log Buffer
System Global Area (SGA) Components SGA Database Buffer Cache Redo Log Buffer Shared Pool
Overview Background Processes Server Processes System Global Area User Processes
Database Writer - DBWR Log Writer - LGWR Checkpoint - CKPT System Monitor - SMON Process Monitor - PMON Archiver - ARCH Recoverer - RECO Lock - LCKn Snapshot Refresh - SNPn Shared Server - Snnn Dispatcher - Dnnn Parallel Query Pnnn Background Processes
Mandatory Background Processes • PMON • SMON • DBWR • LGWR • If any of these 4 processes fail, the instance will crash, & it will have to be restarted.
PMON & SMON Processes PMON SMON SGA Redo Log Buffer Shared Pool Database Buffer Cache
PMON • Cleans up abnormally terminated connections • Rolls back uncommitted transactions • Releases locks held by a terminated process • Frees SGA resources allocated to the failed processes • Restarts failed shared server & dispatcher processes
SMON • Performs automatic instance recovery • Reclaims space used by temporary segments no longer in use • Merges contiguous areas of free space in the datafiles
RECO, LCKn, Pnnn, & SNPn Processes • The RECO process resolves failure involving a distributed transaction • The LCKn process performs inter-instance locking in a parallel server system • The Pnnn process provides parallel query, index creation, data loading, & Create Table As Select capabilities
RECO, LCKn, Pnnn, & SNPn Processes Continued • The SNPn process performs automatic refreshes of snapshots (read-only replicated tables). It is also responsible for the server job queues & replication queues.
DBWR Process • Manages the database buffer cache so that server processes can always find free buffers • Writes all changed buffers to datafiles • Uses a LRU algorithm to keep most recently used blocks in memory • Defers writes for I/O optimization
LGWR, ARCH, & CKPT Processes • LGWR - Writes redo log entries to disk • ARCH - Copies online redo log files to a designated storage device once LGWR switches to a new group • CKPT - Ensures that all modified database buffers are written to the database files
Overview Background Processes Server Processes System Global Area User Processes
User Processes - used when a user runs an application program Runs the program & is considered the client Passes SQL to the server process & receives the results Server Processes - must place the data in the database buffer cache Parse & execute SQL statements Read data blocks from disk into the shared database buffers Return the results of SQL statements to the user process User & Server Processes
An Oracle Instance • The combination of the SGA & the database background processes. • An instance is started (memory is allocated & the background processes are started) & then a database (datafiles) is mounted by the instance. • The server processes & user processes are not defined as part of an Oracle instance.
An Oracle Database • Composed of 1 or more control files, datafiles, & redo log files • Datafiles - Contain all the database data • Redo log files - Hold records of all changes made to the database for recovery purposes • Control files - Record the physical structure & the status of the database
Redo Log Files • Also referred to as groups • Are written in a circular fashion • There must be at least 2 redo log groups • Should be placed on the fastest & least loaded I/O device • May be multiplexed • The same data is written to every member of the same group • Each member of a group should be located on a different disk to guard against failure
Redo Log Files Log Files Member A Group 1 Group 2 Group 3 Log Files Member B Group 1 Group 2 Group 3
Control Files • All necessary database files & log files are identified in the control file • The name of the database is stored in the control file • A control file is required to mount, open, & access the database • Synchronized information needed for recovery is stored there • The recommended configuration is a minimum of 2 control files on different disks
The Parameter File • A text file containing a list of instance configuration parameters • How much memory to use for memory structures in the SGA • What to do with filled online redo log files • The names & locations of the database’s control files
The Alert & Trace Files • Oracle uses the alert file as an alternative to displaying error messages on the console if an error occurs while an Oracle instance is running • If an internal error is detected by a server or background process the information is dumped to an associated trace file • It is important that the DBA check the alert file daily
Summary • The SGA is a group of the following shared memory constructs • Shared Pool • Database buffer cache • Redo Log buffer • The background processes asynchronously perform distinct tasks on behalf of all database users • Server processes use shared memory to process SQL statements
Summary - continued • User processes run the tool/application & exchange SQL statement processing with the server processes • An Oracle instance consists of the SGA & the background processes • An Oracle database contains all the datafiles, redo log files, & control files • Redo log files record all changes made to the database, & are used for data recovery
Summary - continued • A control file describes the structure of the database & is needed to mount & open the database • A parameter file is used to size the SGA & locate the control files when starting up an Oracle instance • An alert file of a database is a chronological log of messages & errors