Oracle is a relational database management system.
It is a management system which uses the relational data model. In the relational data model, data is seen by the users in form of tables alone.
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 in Industry
In todays world, data is the key for business Every organization stores its data in multiple databases One of the most widely used database in industry is Oracle Oracle can work on various Operating Systems (Windows, Unix, etc.) The demand for Oracle in todays world is immense Many projects across the industry use Oracle as back-end for deploying its various applications.
Database Architecture - Introduction
Three Major Instances: 1. Database instance 2. File Structure 3. Data Structures
Database Instance:
Oracle Database consists of Software Modules & Database Files
Instance After the complete installation of Oracle 10g, when you start the Oracle database , then you have what is referred to as anOracle 10g Database Instance. It is the actual execution of DBMS software that manages data in the databases tablespace. Properties Of Database Instance
1. Created on loading the software from disk to memory. 2. It is an aggregation of processes and memory structures 3. It is sharable thus allowing multiple users to access the same database. File Structure- Three Basic Oracle Files
Contro l Files Redo Log Files Data Files Provides changes to Param eter File 1 2 3 Data Structures
Tablespa ces Databas e Instance Exten ts Tablespa ces Exten ts Exten ts Exten ts Data Block s Data Block s Data Block s Data Block s Data Block s Segment s Overview of Oracle Architecture SGA Shared SQL Area Database Buffer Cashe KByte 1,200,000 KByte Redo Log Buffer KByte 2,100 KByte PMON LGWR Data File Raw Device Server USER ARCH TL-812 Archive Log Mode(50M) * Fixed Size : 70 Kbyte * Variavle Size : 490 MByte 4,000,000 KByte * Total SGA Size : 1700 Mbyte DBW0 CKPT SMON RECO D000 S000 P000 Memory Structure : Shared Pool
Shared Pool Library Cache Shared SQL Area PL/SQL Procedures and Package Control Structures for examples;
Locks Library Cache handles and so on ... Dictionary Cache Control Structures for example:
Character Set Conversion Memory Network Security Attributes
and so on .. Shared Pool Contents - Text of the SQL or PL/SQL statement - Parsed form of the SQL or PL/SQL statement - Execution plan for the SQL or PL/SQL statements - Data dictionary cache containing rows of data dictionary information Library Cache - shared SQL area - private SQL area - PL/SQL procedures and package - control structures : lock and library cache handles Dictionary Cache - names of all tables and views in the database - names and datatypes of columns in database tables - privileges of all Oracle users SHARED_POOL_SIZE Reusable Runtime Memory Oracle Processes Snnn Users DBWR SGA Database Buffer Cache Redo Log Buffer Data Files Redo Log Files Control Files Offline Storage Device Dedicated Server Process LCK0 RECO PMON SMON CKPT User Process Dnnn LGWR ARCH SNPn Pnnn Background Process DBWR (Database Writer) - write all dirty buffers to datafiles - Use a LRU algorithm to keep most recently used blocks in memory - Defers write for I/O optimization dirty list reaches a threshold length A process scnas a specifed number of buffer in the LRU without finding free buffer A time-out occurs DBWR checkpoint occurs LGWR (Log Writer) - writes redo log entries to disk Commit occurs The redo log buffers pool becomes one-third full DBWR completes cleaning the buffer blocks at a checkpoint LGWR time-out - A commit confirmation is not issued until the tx has been recorded in the rego log file Contd PMON (Process Monitor) - Cleans up abnormally terminated connection - Rolls back uncommited transactions - Releases locks held by a terminated process - Frees SGA resources allocated to the failed processes - Database maintenance
SMON (System Monitor) - Performs automatic instance recovery - Reclaims space used by temporary segments no longer in use - Merges contiguous area of free space in the datafile Contd CKPT (Check Point) - is enabled by setting the parameter CHECKPOINT_PROCESS=TRUE - If enabled, take over LGWRs task of updating files at a checkpoint - Updates header of datafiles and control files at the end of checkpoint - More frequent checkpoint reduce recovery time from instance failure - CKPT improve the performance of database with many database files ARCH (Archiver) - Copies redo log files to tape or disk for media failure - Operates only when a log switch occurs - Is optional and is only needed when in ARCHIVELOG mode - May write to a tape drive or to a disk LCKn (Lock), Dnnn (Dispatcher), Snnn (Server), RECO (Recover), Pnnn(Parallel), SNPn(Job Queue), QMNn(Queue Monitor), Server/User Process User Processes - A user process is used when a user runs an application program - Runs the tool/application and is considered the client - Passes SQL to the server process and receives the results
Server Processes - A server process must place the data in the database buffer cache - Parce and execute SQL statements - Read data blocks from disk into the shred database buffers of the SGA - Return the results of SQL statements to the user process Parse : check syntax, security access, object resolution, optimization Execute : applies the parse tree to the data, perform a physical read and change Fetch : Passes data to the user (only SELECT) Oracle Files Datafile Redo Log Files Control Files Parameter File Archive File Log File (alert*.log, sqlnet.log, listener.log...) Trace File Storage Architecture Physical storage structures Data files Segments Extents Blocks Logical storage structures Tablespaces Tables / Clusters / Indexes Rows Columns Physical Storage Architecture Relationship among Segments, Extents, and Blocks Extent 24K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K Extent 72K Segment 96K Database Blocks Logical Storage Architecture Relationship between tablespaces and datafiles
USER Tablespace System Tablespace Database DATA3.ORA DATA1.ORA DATA2.ORA Contd Objects stored in tablespaces
Table Table Table INDEX INDEX INDEX INDEX INDEX INDEX INDEX INDEX INDEX INDEX Tablespace (one or more datafiles) Database Files (Physical structures associated with only one tablespace) Objects (stored in tablespace may span serveral datafiles) Block Header Table Dictionary Row Dictionary Free Space Row Data
General Block Information (Block add, Segment type) 85 ~ 100 bytes
Table info in Cluster
Row info in Block (2 byte per row)
using when New Row Insert or Update (pctfree, pctused)
Table or Index Data
Extent A set of contiguous database blocks within a datafile. Extent are allocated when. - The segment is created (INITIAL EXTENT) - The segments grows (NEXT EXTENT) - The table is altered to allocate extents. Extent are de-allocated when the - The segment is dropped and truncated. - The segment is larger than optimal and contains free extents (for rollback segments only) Each segment is created with at least on extend( initial extent ) ( Rollback segment : 2) ALTER TABLE table_name DEALLOCATE UNUSED Segment a set of one or more extents that contains all the data for a specific type of logical storage structure within a tablespace Data Segment - A collection of extents that holds all of the data for a table or a cluster Index Segment - A collection of extents that holds all of the index data for search optimization on large tables and clusters Rollback Segment - A collection of extents that holds rollback data for rollback, read-consistency, or recovery Temporary segment - A collection of extents that holds data belonging to temporary tables created during a sort operation Bootstrap segment - An extent that contains dictionary definitions for dictionary tables to be loaded when the database is opened.
Oracle Client/Server Architecture NETWORK Server A Server b Client Application Server/Server Client/Server Benefit of Client/Server Component - Database S/W work on Server - Minimize network resource - concurrency, consistency, transparency
- Only Server upgrade to increase size - Minimize Client H/W spec - concurrency, consistency, transparency
Katja Kruckeberg, Wolfgang Amann, Mike Green-Leadership and Personal Development - A Toolbox For The 21st Century Professional-Information Age Publishing (2011)