590 likes | 867 Views
Database Architecture Overview. Oracle 11g Server Architecture. Oracle Instance Oracle Database Database Files Server Processes Memory Structures Transactions Data Dictionary Schema And Users. Oracle Server Architecture. An Oracle server:
E N D
Oracle 11g Server Architecture • Oracle Instance • Oracle Database • Database Files • Server Processes • Memory Structures • Transactions • Data Dictionary • Schema And Users
Oracle Server Architecture An Oracle server: • Is a database management system that provides an open, comprehensive, integrated approach to information management • Consists of an Oracle instance and an Oracle database Oracle Server
Overview of Primary Components Instance Userprocess SGA Shared pool Library cache Redo logbuffer cache Databasebuffer cache Serverprocess Data Dict.cache PGA PMON SMON DBWR LGWR CKPT Others Data files Control files Redo log files Parameter file Archived log files Password file Database
Oracle 11g Server Architecture • Oracle Instance • Oracle Database • Database Files • Server Processes • Memory Structures • Data Dictionary • Schema And Users
Oracle Instance • Is a means to access an Oracle database • Always opens one and only one database • Consists of memory and process structures Instance SGA Shared pool Memory structures Library cache Database buffer cache Redo logbuffer cache Data Dictionarycache Background structures PMON SMON DBWR LGWR CKPT Others
Oracle 11g Server Architecture • Oracle Instance • Oracle Database • Database Files • Server Processes • Memory Structures • Data Dictionary • Schema And Users
Header Data files (includes data dictionary) Control files Online redo log files) Physical Structure The physical structure of an Oracle database is determined by the operating system files that provide the actual physical storage for database information. • Control files • Data files • Redo log files
Oracle 11g Server Architecture • Oracle Instance • Oracle Database • Database Files • Server Processes • Memory Structures • Data Dictionary • Schema And Users
Database Files • Parameter Files • Control Files • Data Files • Redo Log Files • Undo Data Files
Oracle Database Data files Control files Redo log files Archived log files Parameter file Password file Oracle Database
Database Files • Parameter Files • Control Files • Data Files • Redo Log Files • Undo Data Files
Parameter Files • Entries are specific to the instance being accessed • There are two kinds of parameters: • Explicit: Having an entry in the file • Implicit: No entry within the file, but assuming the Oracle default values • Multiple files can be used for a single database to optimize performance in different situations.
SPFILE spfileSID.ora • Binary file with the ability to make changes persistent across shutdown and startup • Maintained by the Oracle server • Records parameter value changes made with the ALTER SYSTEM command • Can specify whether the change being made is temporary or persistent • Values can be deleted or reset to allow an instance to revert to the default value • Can be dumped to text file for manual editing
Database Files • Parameter Files • Control Files • Data Files • Redo Log Files • Undo Data Files
Control File The control file is a binary file that defines the current state of the physical database.. • Loss of the control file requires recovery • Is read at MOUNT stage • Is required to operate • Is linked to a single database • Should be multiplexed • Maintains integrity of database • Sized initially by CREATE DATABASE Database Control files
Database Files • Parameter Files • Control Files • Data Files • Redo Log Files • Undo Data Files
Database Files • Parameter Files • Control Files • Data Files • Tablespaces • http://docs.oracle.com/cd/B28359_01/server.111/b28310/tspaces.htm#i1010516 • Oracle Managed Files • Data Block • Data Types • Tables • Indexes • Redo Log Files • Undo Data Files
Data file Segment Segment Extent Blocks Logical Structure The logical structure of the Oracle architecture dictates how the physical space of a database is to be used. A hierarchy exists in this structure that consists of tablespaces, segments, extents, and blocks. Tablespace
SYSTEM and Non-SYSTEM Tablespaces • SYSTEM tablespace: • Created with the database • Contains the data dictionary • Contains the SYSTEM undo segment • Non-SYSTEM tablespaces: • Separate segments • Ease space administration • Control amount of space allocated to a user
Database Files • Parameter Files • Control Files • Data Files • Tablespaces • Oracle Managed Files • Data Block • Data Types • Tables • Indexes • Redo Log Files • Undo Data Files
Oracle Managed Files • Oracle Managed Files (OMF) simplify file administration by eliminating the need to directly manage the files in an Oracle database • This feature has two major thrusts: • Allows database objects to be created without specifying the underlying operating system files • Automatically removes obsolete data files and online redo logs • http://docs.oracle.com/cd/B28359_01/server.111/b28310/omf001.htm#ADMIN11481
Database Files • Parameter Files • Control Files • Data Files • Tablespaces • Oracle Managed Files • Data Block • Data Types • Tables • Indexes • Redo Log Files • Undo Data Files
Database Block • Minimum unit of I/O • Consists of one or more OS blocks • Set at tablespace creation • DB_BLOCK_SIZE is the default block size
Database Files • Parameter Files • Control Files • Data Files • Tablespaces • Oracle Managed Files • Data Block • Data Types • Tables • Indexes • Redo Log Files • Undo Data Files
Oracle data types Data type User-defined Built-in Scalar Collection Relationship CHAR(N), NCHAR(N)VARCHAR2(N),NVARCHAR2(N) NUMBER(P,S) DATERAW(N)BLOB, CLOB, NCLOB, BFILE LONG, LONG RAW ROWID VARRAYTABLE REF
System-Provided Datatypes Built-In Datatype Native Datatypes Extended Datatypes Support Datatypes CHARACTER Text ANSI NUMBER DB2 Image DATE SQL/DS Video LOB Audio PL/SQL Datatypes RAW ROWID BOOLEAN Spatial BINARY_INTEGER XML Time Series
Database Files • Parameter Files • Control Files • Data Files • Tablespaces • Oracle Managed Files • Data Block • Data Types • Tables • Indexes • Redo Log Files • Undo Data Files
Index-organizedtable Cluster Tables in Oracle Partitionedtable Regular table
Database Files • Parameter Files • Control Files • Data Files • Tablespaces • Oracle Managed Files • Data Block • Data Types • Tables • Indexes • Redo Log Files • Undo Data Files
Classification of Indexes • Logical • Single column or concatenated • Unique or nonunique • Function Based • Domain Based • Physical • Partitioned or nonpartitioned • B-tree • Normal or reverse key • Bitmap • Bitmap Join Index
Database Files • Parameter Files • Control Files • Data Files • Redo Log Files • Undo Data Files
Using Redo Log Files Redo log files record all changes made to data and provide a recovery mechanism from a system or media failure. • Redo log files are organized into groups. • An Oracle database requires at least two groups. • Each redo log within a group is called a member. Database Redo log files
Structure of Redo Log Files Group 1 Group 2 Group 3 Disk 1 Member Member Member Disk 2 Member Member Member
How Redo Logs Work • Redo logs are used in a cyclic fashion. • When a redo log file is full, LGWR will move to the next log group. • This is called a log switch • Checkpoint operation also occurs • Information is written to the control file
Database Files • Parameter Files • Control Files • Data Files • Redo Log Files • Undo Data Files
Undo Data Overview • Before Oracle makes a change to a database block it is copied to the Undo area. • Used for Rollback and Read Consistency.
Oracle 11g Server Architecture • Oracle Instance • Oracle Database • Database Files • Server Processes • Memory Structures • Transactions • Data Dictionary • Schema And Users
Process Structure An Oracle process is a program that depending on its type can request information, execute a series of steps, or perform a specific task. On some OS (MS Windows…) these are actually implemented as process threads. Oracle takes advantage of various types of processes: • User process: Started at the time a database user requests connection to the Oracle server • Server process: Connects to the Oracle Instance and is started when a user establishes a session. • Background process: Available when an Oracle instance is started
Background Processes The relationship between the physical and memory structures is maintained and enforced by Oracle’s background processes. • Mandatory background processes DBWn PMON CKPT LGWR SMON and others • Optional background processes ARCn LMON Snnn QMNn LMDn RECO CJQ0 Pnnn and others LCKn Dnnn
Oracle 11g Server Architecture • Oracle Instance • Oracle Database • Database Files • Server Processes • Memory Structures • Transactions • Data Dictionary • Schema And Users
Memory Structure Oracle’s memory structure consists of two memory areas known as: • System Global Area (SGA): Allocated at instance startup, and is a fundamental component of an Oracle Instance • Program Global Area (PGA): Allocated when the server process is started
System Global Area (SGA) • The SGA consists of several memory structures: • Shared pool • Database buffer cache • Redo log buffer • Other structures (e.g. lock and latch management, statistical data)
System Global Area (SGA) • SGA is dynamic and sized using MEMORY_TARGET without shutting down the instance • SGA memory allocated and tracked in granules by SGA components • Contiguous virtual memory allocation • Size based on MEMORY_TARGET
PGA Dedicated server Shared server Serverprocess Session information sort area, cursor information sort area, cursor information Stack space Stack space Userprocess SGA SGA Session information Shared SQL areas Shared SQL areas Program Global Area (PGA) The PGA is memory reserved for each user process that connects to an Oracle database. Managed as part of the MEMORY_TARGET
Oracle 11g Server Architecture • Oracle Instance • Oracle Database • Database Files • Server Processes • Memory Structures • Transactions • Data Dictionary • Schema And Users
Transactions • Oracle has an implicit transaction model. • A transaction starts immediately after the last one completes • Can be made READ-ONLY via ALTER TRANSACTION command • COMMIT or ROLLBACK ends transaction
Oracle’s Multi-Version ConcurrencyRead Consistent Row Locking With Oracle … report • Updates don’t lockout reports and reports don’t lockout updates • Reports see only committed data via Multi-Versioning • Queries yield maximum throughput with correct results - no waiting and no dirty reads! • Row locks never escalate - the most scaleable solution available Budget Table update Undo Tablespace Before Image accurate report
Multi Version Read Consistency High Throughput Concurrency