ORACLE DATABASE ARCHITECTURE & PROCESSES

Introduction 

Database is a collection of data treated as a unit. The purpose of a database is to store and retrieve related information. A database server is the key to solving the problems of information management.  

2

Oracle Products Family 


Oracle Database 10g Oracle Application Server 10g 
HTTP Server  Forms and Reports  Discoverer Plus and Viewer (BI Products)  Portal and Wireless 

Oracle Developer Suite 10g 
Oracle Forms & Reports 9i  Oracle Warehouse Builder 9i (ETL Tool)  Oracle Discoverer Administrator/Desktop 9i  Oracle JDeveloper 

Oracle Applications 11i (Oracle Apps)

3

Oracle Primary Components 

Database
- Oracle database consists of operating system files, also known as database files, that provide the actual physical storage for database information. 

Instance
- Oracle instance is the combination of the background processes and memory structures. 

Oracle server
- consists of an Oracle instance and an Oracle database.
4

Oracle Database Architecture 

The database has Physical structures and Logical structures. The Physical and Logical structures are separate. The Physical storage of data can be managed without affecting the access to logical storage structures.
5  

Oracle Database Architecture 6 .

Oracle Processes 7 .

.log..log.Oracle Database Physical Structures        Datafile Control Files Redo Log Files Archive File Parameter File Log File (alert*.) Trace File 8 . sqlnet.listener.log.

The datafiles contain all the database data. such as tables and indexes. 9   .Datafile  Every Oracle database has one or more physical datafiles. The data of logical database structures. is physically stored in the datafiles allocated for a database.

10   .Datafile Characteristics  A Datafile can be associated with only one database. One or more datafiles form a logical unit of database storage called a tablespace. Datafiles can have certain characteristics set to let them automatically extend when the database runs out of space.

Control Files  A control file contains entries that specify the physical structure of the database. to protect against a failure involving the control file. simultaneously maintain a number of identical control file copies. 11   . It contains the following information:  Database name  Names and locations of datafiles and redo log files  Time stamp of database creation Oracle can multiplex the control file. that is.

The set of redo log files is collectively known as the redo log for the database. The primary function of the redo log is to record all changes made to data. then the changes can be obtained from the redo log. 12 . A redo log is made up of redo entries (also called redo records). so work is never lost. If a failure prevents modified data from being permanently written to the datafiles.Redo log files &Archive Log Files     Oracle has a set of two or more redo log files.

13 . Oracle recommends that you create a server parameter file (SPFILE) as a dynamic means of maintaining initialization parameters. A server parameter file lets you store and manage your initialization parameters persistently in a serverserver-side disk file.Parameter Files    Parameter files contain a list of configuration parameters for that instance and database.

When an internal error is detected by a process. is a special trace file. 14 . it dumps information about the error to its trace file. while other information is for Oracle Support Services. Some of the information written to a trace file is intended for the database administrator. Trace file information is also used to tune applications and instances. or alert log. The alert file. The alert log of a database is a chronological log of messages and errors.Alert and Trace Log Files     Each server and background process can write to an associated trace file.

UserUser-managed backup and recovery requires you to actually restore backup files before you can perform a trial recovery of the backups.Backup Files  To restore a file is to replace it with a backup file. you restore a file when a media failure or user error has damaged or deleted the original file.   15 . such as applying the correct backup file when recovery is needed. ServerServer-managed backup and recovery manages the backup process. Typically. such as scheduling of backups. as well as the recovery process.

Logical Database Structures  Tablespaces Oracle Data Blocks Extents Segments    16 .

Tablespaces    A database is divided into logical storage units called tablespaces. which group related logical structures together. Each database is logically divided into one or more tablespaces. 17 . One or more datafiles are explicitly created for each tablespace to physically store the data of all logical structures in a tablespace.

ORA DATA3.ORA DATA2.ORA 18 .Tablespaces  Relationship between tablespaces and datafiles Database System Tablespace USER Tablespace DATA1.

Tablespaces  Objects stored in tablespaces Tablespace (one or more datafiles) Table INDEX INDEX INDEX INDEX INDEX Table INDEX INDEX INDEX INDEX INDEX Table Database Files (Physical structures associated with only one tablespace) Objects (stored in tablespace may span several datafiles) 19 .

TEMP is required when the SYSTEM tablespace is created as a locally managed tablespace. Online Analytical Processing (OLAP).  SYSAUX . 20 .Stores segments used for database options such as the Automatic Workload Repository.Used for performing large sort operations.  TEMP .Tablespaces in Oracle 10g  SYSTEM .Stores the data dictionary tables and PL/SQL code.

Used to store transaction information for read consistency and recovery purposes. USERS .Used to store segments for non-application nonmanagement tools.Used as the default tablespace for database users. 21 . UNDOTBS1 .Tablespaces in Oracle10g    TOOLS .

In addition. One data block corresponds to a specific number of bytes of physical database space on disk. Oracle database data is stored in data blocks. you can specify up to five other block sizes. 22 . The standard block size is specified by the DB_BLOCK_SIZE initialization parameter. A database uses and allocates free database space in Oracle data blocks.Oracle Data Blocks     At the finest level of granularity.

the level of logical database storage is a segment. Segments Above extents.Extents & Segments  An extent is a specific number of contiguous data blocks. A segment is a set of extents allocated for a certain logical structure. 23   . used to store a specific type of information. obtained in a single allocation.

and Blocks Segment Extent 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K Extent 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 24 Database Blocks .Relationship Segments. Extents. Extents and Blocks  Relationship among Segments.

Types of Segments  Data segment Index segment Temporary segment Rollback segment 25    .

Each cluster has a data segment. each partition has a data segment.Data segment    Each nonclustered table has a data segment. The data of every table in the cluster is stored in the cluster¶s data segment. All table data is stored in the extents of the data segment. For a partitioned table. 26 .

Index Segment  Each index has an index segment that stores all of its data. each partition has an index segment.  27 . For a partitioned index.

When the statement finishes execution.  28 . the extents in the temporary segment are returned to the system for future use.Temporary Segment  Temporary segments are created by Oracle when a SQL statement needs a temporary database area to complete execution.

Rollback segment  The information in a rollback segment was used during database recovery for generating readreadconsistent database information and for rolling back uncommitted transactions for users. 29 .

Relationship ² Database. Tablespace & Datafiles     Each database is logically divided in to one or more tablespaces. 30 . The combined storage capacity of a database tablespaces is the total storage capacity of the database. One or more datafiles are explicitly created for each tablespace to physically store the data of all logical structures in a tablespace. The combined size of the tablespace details is the storage capacity of the tablespace.

and a tablespace can hold objects from different schemas. .Objects in the same schema can be in different tablespaces. views. and indexes.Schema objects include structures like tables. .There is no relationship between a tablespace and a schema.Is a collection of Database Objects. . 31 .Overview of Schemas and Common Schema Objects  SCHEMA .

32 . Indexes can be created to increase the performance of data retrieval. A view can also be considered a stored query. Views are customized presentations of data in one or more tables or other views. Indexes and Views     Tables are the basic unit of data storage in an Oracle database.Tables.

procedure. Java class schema object. sequence. 33 . view. useruserdefined object type. materialized view. A synonym is an alias for any table. package.Clusters & Synonyms   Clusters are groups of one or more tables physically stored together because they share common columns and are often used together. function. or another synonym. type.

A data dictionary also stores the following information:  The valid users of an Oracle database.  Information about integrity constraints defined for tables in the database.Data Dictionary    Data dictionary is a set of tables and views that are used as a read-only reference about the database.  The amount of space allocated for a schema object and how much of it is in use. readIt stores information about both the logical and physical structure of the database. 34 .

35 . Every time a database is started.Overview of the Oracle Instance    An Oracle database server consists of an Oracle database and an Oracle instance. The combination of the background processes and memory buffers is called an Oracle instance. a system global area (SGA) is allocated and Oracle background processes are started.

36 . which is private to each server and background process. System Global Area (SGA).Instance Memory Structures     Oracle creates and uses memory structures to complete several jobs. which is shared by all server and background processes. Program Global Areas (PGA). there is one PGA for each process. Two basic memory structures are associated with Oracle: the system global area and the program global area.

If multiple users are concurrently connected to the same instance. 37 . then the data in the instance¶s SGA is shared among the users. SGA is sometimes called the shared global area. Oracle automatically allocates memory for an SGA when you start an instance.SGA (System Global Area)     A system global area (SGA) is a group of shared memory structures that contain data and control information for one Oracle database instance.

SGA·s Memory Structures        Database buffer cache Redo log buffer Shared pool Java pool Large pool Streams pool Data dictionary cache 38 .

Shared Pool .Caches the most recently used SQL statements that have been issued by database users. Redo Log Buffer .Caches the data that has been most recently accessed by database users. 39 .SGA Data Structures    Database Buffer Cache .Stores transaction information for recovery purposes.

Caches the most recently used Java objects and application code. Large Pool .SGA Data Structures    Java Pool .Caches the data associated with queued message requests. 40 . Streams Pool .Caches data for large operations such as Recovery Manager (RMAN) backup and restore activities and Shared Server components.

The PGA area is a non-shared area of memory noncreated by oracle when a server process is started. 41   . A server process is a process that services a client¶s requests. The information in a PGA depends on the oracle configuration.PROGRAM GLOBAL AREA (PGA)  PGA is a memory buffer that contains data and control information for a server process. A PGA is created by oracle when a server process is started.

42 . All memory structures exist in the main memory of the computers that constitute the database system.Oracle Background Processes    An Oracle database uses memory structures and processes to manage and access the database. The background processes consolidate functions that would otherwise be handled by multiple Oracle programs running for each user process.

43 .Server Processes   Oracle creates server processes to handle requests from connected user processes. A server process communicates with the user process and interacts with Oracle to carry out requests from the associated user process.

Oracle Background Processes            System Monitor (SMON) Process Monitor (PMON) Database Writer (DBWn) Log Writer (LGWR) Checkpoint (CKPT) Archiver (ARCn) Recoverer (RECO) Job Queue Monitor (CJQn) Job Queue (Jnnn) Queue Monitor (QMNn) Parallel Query Slave (Qnnn)        Dispatcher (Dnnn) Shared Server (Snnn) Memory Manager (MMAN) Memory Monitor (MMON) Memory Monitor Light (MMNL) Recovery Writer (RVWR) Change Tracking Writer (CTWR) 44 .

coalesces free space in the database.Background Processes  System Monitor (SMON)  Performs instance recovery following an instance crash. and manages space used for sorting. 45   . Database Writer  Writes modified database blocks from the SGA¶s Database Buffer Cache to the datafiles on disk. Process Monitor (PMON)  Cleans up failed user database connections.

46 . Checkpoint  Updates the database files following a Checkpoint Event.Background Processes    Log Writer  Writes transaction recovery information from the SGA¶s Redo Log Buffer to the online Redo Log files on disk. Archiver  Copies the transaction recovery information written to disk by LGWR (log writer) to the online Redo Log files and to a secondary location in case it is needed for recovery.

 Job Queue Monitor   Job Queue  47 . Executes database jobs that have been scheduled using Oracle¶s job scheduling feature feature.Background Processes  Recoverer  Recovers failed transactions that are distributed across multiple databases when using Oracle¶s distributed database feature. Assigns jobs to the Job Queue processes when using Oracle¶s job scheduling feature.

48  Parallel Query Slave   Dispatcher  .Background Processes  Queue Monitor  Monitors the messages in the message queue when Oracle¶s Advanced Queuing feature is used. Used to carry out portions of a larger overall query when Oracle¶s Parallel Query feature is used. Assigns user¶s database requests to a queue where they are then serviced by Shared Server processes when Oracle¶s Shared Server feature is used.

Manages the size of each individual SGA component when Oracle¶s Automatic Shared Memory Management feature is used. 49  Memory Manager   Memory Monitor  . Gathers and analyzes statistics used by the Automatic Workload Repository feature.Background Processes  Shared Server  Server Processes that are shared among several users when Oracle¶s Shared Server feature is used.

Keeps track of which database blocks have changed when Oracle¶s incremental Recovery Manager feature is used. 50  Recovery Writer   Change Tracking Writer  . Writes recovery information to disk when Oracle¶s Flashback Database Recovery feature is used.Background Processes  Memory Monitor Light  Gathers and analyzes statistics used by the Automatic Workload Repository feature.

51 . Passes SQL to the server process and receives the results.User Processes    A user process is used when a user runs an application program. Runs the tool/application and is considered the client.

optimization ‡ Execute : applies the parse tree to the data.Server Processes     A server process must place the data in the database buffer cache Parse and execute SQL statements Read data blocks from disk into the shared database buffers of the SGA Return the results of SQL statements to the user process ‡ Parse : check syntax. object resolution. security access. perform a physical read and change ‡ Fetch : Passes data to the user (only SELECT) 52 .

 TNS-based application.ORA (Server .ORA (Server .ORA ( Server )  TNSNAMES.Client )  53 . Oracle Protocol Adapters.  Oracle¶s Network applications to access the underlying network protocol transparently. TNSNetwork software like TCP/IP.Oracle Network  What is TNS? Transparent Network Substrate.   Configuration File LISTENER.Client )  SQLNET.

EXPIRE_TIME = 0 SQLNET.ORA SQLNET. beq) LISTENER= (ADDRESS_LIST= (ADDRESS= (PROTOCOL=tcp) (HOST=local host) (PORT=1521) ) ) SID_LIST_LISTENER= (SID_LIST= (SID_DESC= (SID_NAME=BRBINFO1) (ORACLE_HOME=/oracle/oracle10) (ENVS='EPC_DISABLED=TRUE') ) ) STARTUP_WAIT_TIME_LISTENER=0 CONNECT_TIMEOUT_LISTENER=0 LOG_DIRECTORY_LISTENER=/oracle/oracle10/ network/log LOG_FILE_LISTENER=listener TRACE_LEVEL_LISTENER=OFF 54 .SQL*Net Configuration TNSNAMES.ORA # SQLNET.ORA info = (DESCRIPTION= (ADDRESS_LIST= (ADDRESS= (PROTOCOL=tcp) (HOST=local host) (PORT=1521) ) ) (CONNECT_DATA= (SID=SIDNAME) ) )   LISTENER.AUTHENTICATION_S ERVICES=(none.

A computer running an application (a local computer or client workstation) runs the application in a user process. The client application attempts to establish a connection to the server using the proper Oracle Net Services driver.     The server detects the connection request from the application and creates a dedicated server process on behalf of the user process. 55 .How Oracle Works?  An instance has started on the computer running Oracle (often called the host or database server). The server is running the proper Oracle Net Services driver.

the user changes a name in a row of a table. For example. If a shared SQL area is found. then the server process checks the user¶s access privileges to the requested data. so it can be parsed and processed. The server process retrieves any necessary data values from the actual datafile (table) or those stored in the SGA.How Oracle Works?  The user runs a SQL statement and commits the transaction. then a new shared SQL area is allocated for the statement. The server process receives the statement and checks the shared pool for any shared SQL area that contains a similar SQL statement. and the previously existing shared SQL area is used to process the statement. If not. 56     .

The DBWn process writes modified blocks permanently to disk when doing so is efficient. the database server manages other users¶ transactions and prevents contention between transactions that request the same data. 57     .How Oracle Works?  The server process modifies data in the system global area. Throughout this entire procedure. If it is not successful. then an error message is transmitted. If the transaction is successful. then the server process sends a message across the network to the application. the LGWR process immediately records the transaction in the redo log file. the other background processes run. watching for conditions that require intervention. Because the transaction is committed. In addition.

Any Queries ?? 58 .