Oracle

Published on July 2016 | Categories: Documents | Downloads: 62 | Comments: 0 | Views: 922
of 54
Download PDF   Embed   Report

Comments

Content

Oracle Database Administration I Oracle Server Architecture

Overview
 Set of data to store and access information Based on a relational model of rows and columns stored in tables Also Object-oriented Object(OO) structures     Contains these components: Physical Memory Process

Oracle's Overall Role
    
Retrieve data File I/O Space Management Change Management Access Management

Database Structure
      
Data file(s) Control file(s) Redo logs Init.ora (spfile.ora - 9i) Trace Alert log Password

Instance Structure
 Memory structures are allocated  Collectively known as System Global Area. 95% defined by data block buffer cache, Shared SQL Pool, Large Pool and Java Pool.  Oracle background processes are started.  Single database accessible by multiple instances - RAC (Real Application Cluster) a.k.a. parallel server

Instance Defined
 Defined by initialization parameter(s) that determine the size and composition  Can be dynamically altered  initSID.ora (ascii file)  spfileSID.ora (binary file)  configSID.ora (usually only used to create a database ± not widely used)

Oracle Instance
   
Composed of: SGA (System Global Area) PGA (Program Global Area) Oracle BACKGROUND processes

System Global Area (SGA)
 Shared memory region allocated by Oracle for an Oracle database  Allocated when the Oracle database is started  The SGA should be in non-paged, nonswapped memory

SGA Composition
      
Buffer cache Shared SQL Pool Large pool (optional) Java pool Redo log buffer Dictionary cache Other miscellaneous items

PGA Composition
 Non-shared memory area to which a process (server or background) can write  Allocated by Oracle when a user connects to an Oracle database and a session is created

Oracle Instance
     
Required Background Processes: DBWn LGWR SMON PMON CKPT (9i)

Oracle Instance
 Optional Background Processes: (not all inclusive)        

ARCn CKPT (prior to 9i) RECO Lock (LCK0) Job Queue (SNPn) Queue Monitor (QMNn) Dispatcher (Dnnn) Server (Snnn ± for dedicated MTS servers)

Oracle Instance More Details

SGA
   
Buffer Cache Redo Log BUFFER Shared SQL Pool Dynamic (as of Oracle 9i)

Dynamic SGA
 Defined in Granules SGA < 128mb 4mb size SGA > 128mb 16mb size  Can be modified on the fly (9i)  Establish an overall maximum  Initially allocated ± 4 for small, 3 for large (fixed SGA, buffer cache, Shared pool)

Data Buffer Cache Structure
 Can be defined in two ways: * By block db_block_buffers ** By byte db_cache_size  Was divided into blocks the same size as the blocks in the data files  As of 9i, multiple buffer cache introduced (depends on block size of each tablespace)  Size and number defined in the initialization Parameter File  Holds copies of data blocks read from disk

Data Buffer Cache Contents
 Stores the most recently accessed BLOCKS OF DATA  Contains PINNED buffers * Data being accessed  Contains DIRTY buffers * Data that has been MODIFIED, but not written to disk  FREE buffers  Two lists, write and LRU

REDO Log Buffers
 Stores the REDO ENTRIES (changes to the database)  Default is four times the OS block size  Larger reduces log I/O and uncommented redo to online redo logs  Changed data is moved from the database buffer cache to the redo log buffer then to the redo log files

Shared Pool
 Can be dynamically modified (9i)  Must be an integer multiple of the granule size * Oracle will round up if not  Managed by LRU algorithm  Contains: * Library Cache * Data Dictionary Cache * Control structures * Reusable Runtime Memory

Shared Pool

Shared Pool
 Library Cache

* SHARED by all users for commonly used SQL statements * Shared and Private SQL areas for executed statements * PL/SQL Procedures and Packages * Allocation and Reuse of Memory

Library Cache
Shared SQL * PARSE TREES for SQL statements * EXECUTION plans for SQL statements * Size dependent on complexity Private SQL * Each session has one * Persistent and Runtime areas * Cursors

Library Cache
PL/SQL Program Units * Procedures, functions, Packages, anonymous blocks and database triggers Allocation and Reuse of Memory * Every SQL statement submitted, Oracle automatically allocates memory * Checks for existence * Allocate private SQL area * May flush the shared pool

PGA

PGA
 Varies depending if dedicated or Shared servers (MTS) are used  Stack space  Session information (PGA verses Shared Pool)  Memory allocated to hold a session¶s variables and arrays  Automatically managed in 9i with the SQL memory management

Questions
 What is the name of Oracle¶s memory structure?  What are its contents?  How is it divided?  If I have 150 mb SGA, why does Oracle change the size?  Can you vary sizes of Oracle blocks? If so, how?

Oracle Database
Composed of two structures:  Physical (Operating System view)  Logical (Oracle¶s view)

Physical View Files

Physical Structure
     
Made up of: Data files Redo Log Files ± two or more with members One or more Control Files One Parameter File Trace and alert log files One Password file

Datafile
   
Disk space for a tablespace One or more per tablespace Associated with only one tablespace Consists of segments: * UNDO, Temporary, Data, index, undo, LOB and cache (for the most part)

Redo Log Files
Characteristics  Record changes made to the data by various transactions  Help RECOVER the data in case of a failure  Streamline the process of how data is written to disk

Control Files
Record of the overall architecture and status of the database Easily moved and recovered Contain the following:  Database NAME  Datafiles NAMES and LOCATIONS  Redo log file NAMES, Log sequence number and LOCATIONS

Parameter File
 Attributes of an instance are defined through an Oracle Parameter File  Determines the size and characteristics of the instance  Stored in an ASCII file or housed with the database in a binary file

Parameter File
 The only Oracle file that is ASCII  All other files are binary and not directly changeable by the DBA  Read-only when the instance starts  Most changes require a stop and restart of the instance

Trace and Alert Logs
 Trace files contain information about significant events  Alert log records the commands and results of major events in the life of the database  Monitor daily  Rename for historical purposes

Logical View Structures

Logical View Structures
    
Tablespace(s) Schema objects Segments Extents Data blocks

Tablespace(s)
 Logically divides a database  One or more datafiles are explicity created for each one  Logically divided into segments that are further divided into extents and blocks  Can be defined as read-only  A unit of space to store a schema¶s objects

Object(s)
Schema(s)  A collection of objects owned by one Oracle user Object(s)  Tables, indexes, views, sequences, stored procedures, functions, packages, UNDO segments

Extents and Blocks
 A collection of the smallest object in a database  An extent can be of a varying size  Extents MUST be contiguous  Blocks are the finest collection of space in an Oracle database

Questions
 What are the physical files of a database system?  What are the logical entities of a database?  What is the smallest structure?  Which structure MUST be contiguous?  Which structure will tell you event information?

Background Processes Review

Background Processes
 Every instance has BACKGROUND PROCESSES  BACKGROUND PROCESSES perform I/O, handle process cleanup and monitor the ORACLE database  Provide support, increase performance, assist in recovery and make the database more reliable

Background Processes
     
DBW0 (DBWn) LGWR PMON SMON CKPT ARCn

Database Buffer
 After the changed data (redo entries) are written to the online redo log files, the changed data will be written to disk  These changed data are called µdirty¶  Dirty data are moved to the µwrite¶ list  Dirty data can be on the µwrite¶ list and on the LRU list

DBWn
 At some time after the redo entries have been written into the online redo logs, the database writer (DBWn) writes the dirty buffer back to the database  This is called µdelayed write¶ and is based on initialization parameters

DBWn (Database Writer)
 Can have one or more running  Only available on systems with Asynch I/O  Can use I/O slaves to duplicate the above on systems without it  Performs all WRITES to the database  Keeps the BUFFER CACHE clean and free

When does the DBWR write?
 The dirty list reaches a threshold length  A DBWR timeout  LGWR issues a checkpoint

LGWR (Log Writer)
 Writes the REDO log entries (located in the REDO LOG BUFFER) to the REDO LOG files  Only the changed data, not the entire Oracle block(s) is written to the redo logs  Issues checkpoints

Online Redo Log Files
 The online redo log files hold the µredo entries¶  Only the changed bytes are written to the online redo log file  The entire data block is not written to these logs

Online Redo Log Files
 There is a fixed number of online redo log file groups  Defined at database creation time  Can add or drop groups or members (discussed later)

Online Redo Log Files
Redo log file groups cycle If there are three redo log file groups:
 When the first group is full, LGWR starts writing tothe second group  When the second group is full, LGWR writes to the third group  When the third group is full, LGWR writes to the first group

LGWR (Log Writer)
What causes the LGWR to clear the REDO LOG BUFFER and transfer the transactions to disk? When a user process COMMITS a TRANSACTION TIME-OUT (caused every three seconds) When the redo log buffer becomes 1/3 FULL When the DBWR writes the dirty buffers to disk

   

Sponsor Documents

Or use your account on DocShare.tips

Hide

Forgot your password?

Or register your new account on DocShare.tips

Hide

Lost your password? Please enter your email address. You will receive a link to create a new password.

Back to log-in

Close