Oracle Architecture - Structure. Oracle Architecture - Structure The Oracle Server architecture 1....

34
Oracle Architecture - Structure

description

Oracle Architecture - Structure

Transcript of Oracle Architecture - Structure. Oracle Architecture - Structure The Oracle Server architecture 1....

Page 1: Oracle Architecture - Structure. Oracle Architecture - Structure The Oracle Server architecture 1. Structures are well-defined objects that store the.

Oracle

Architecture - Structure

Page 2: Oracle Architecture - Structure. Oracle Architecture - Structure The Oracle Server architecture 1. Structures are well-defined objects that store the.

Oracle Architecture - Structure

• The Oracle Server architecture

1. Structures are well-defined objects that store the data of a database. Structures and the data contained within them can be manipulated by operations.

Page 3: Oracle Architecture - Structure. Oracle Architecture - Structure The Oracle Server architecture 1. Structures are well-defined objects that store the.

Oracle Architecture - Structure

Page 4: Oracle Architecture - Structure. Oracle Architecture - Structure The Oracle Server architecture 1. Structures are well-defined objects that store the.

Oracle Architecture - Structure

• The Oracle Server architecture can be described in three categories:

1. Physical Structure: Physical file structures that are collectively called a database

2. Logical Sturcture: memory structures that are collectively called an Oracle instance

3. User-related processes

Page 5: Oracle Architecture - Structure. Oracle Architecture - Structure The Oracle Server architecture 1. Structures are well-defined objects that store the.

Oracle Architecture - Structure

•PHYSICAL STRUCTURE

Page 6: Oracle Architecture - Structure. Oracle Architecture - Structure The Oracle Server architecture 1. Structures are well-defined objects that store the.

Oracle Architecture - Structure

•Physical Structure•The physical layer of the database consists of three types of files: 

1.Data files: One or more 2.control files: One or more3.Redo log files: Two or more

Page 7: Oracle Architecture - Structure. Oracle Architecture - Structure The Oracle Server architecture 1. Structures are well-defined objects that store the.

Oracle Architecture - Structure

•Datafiles (.dbf files):

•Datafiles store the information contained in the database. One can have as few as one data file or as many as hundreds of data files. The information for a single table can span many datafiles or many tables can share a set of data files. •These hold data that is stored in tables of a database. They are usually the largest files in the database, ranging in size from MB, GB, to TB

Page 8: Oracle Architecture - Structure. Oracle Architecture - Structure The Oracle Server architecture 1. Structures are well-defined objects that store the.

Oracle Architecture - Structure

•Control Files (.ctl):• Control files record control information

about all of the files within the database. Control files contain information used to start an instance, such as the location of datafiles and redo log files;

• Oracle needs this information to start the database instance.

• These files maintain internal consistency and guide recovery operation.

Page 9: Oracle Architecture - Structure. Oracle Architecture - Structure The Oracle Server architecture 1. Structures are well-defined objects that store the.

Oracle Architecture - Structure

•Control Files (.ctl):• Control files must be protected. Oracle

provides a mechanism for storing multiple copies of control files. These multiple copies are stored on separate disks to minimize the potential damage due to disk failure. The names of the database’s control files are specified via the CONTROL_FILES initialization parameter. 

Page 10: Oracle Architecture - Structure. Oracle Architecture - Structure The Oracle Server architecture 1. Structures are well-defined objects that store the.

Oracle Architecture - Structure

•Control Files (.ctl):•Though it is the smallest file (1MB-5MB) of the database, it is the most crucial and critical file. The criticality of this file is ascribed to the fact that if it is damaged then the database recovery operation becomes tedious. It contains the requisite information to start the database.

Page 11: Oracle Architecture - Structure. Oracle Architecture - Structure The Oracle Server architecture 1. Structures are well-defined objects that store the.

Oracle Architecture - Structure

•Redo Log Files (.rdo & .arc):

• Oracle maintains logs of all the transaction against the database. These transactions are recorded in files called Online Redo Log Files (Redo Logs).

• The main purpose of the Redo log files is to hold information as recovery in the event of a system failure. Redo log stores a log of all changes made to the database. The redo log files must perform well and be protected against hardware failures (through software or hardware fault tolerance). If redo log information is lost, one cannot recover the system. 

Page 12: Oracle Architecture - Structure. Oracle Architecture - Structure The Oracle Server architecture 1. Structures are well-defined objects that store the.

Oracle Architecture - Structure

•Redo Log Files (.rdo & .arc):

•When a transaction occurs in the database, it is entered in the redo log buffers, while the data blocks affected by the transactions are not immediately written to disk. In an Oracle database there are at least two or more Redo Log files. 

Oracle writes to redo log file in a cyclical order i.e. after the first log file is filled, it writes to the second log file, until that one is filled. When all the Redo Log files have been filled, it returns to the first log file and begin overwrite its content with new transaction data. Note, if the database is running in the ARCHIVELOG Mode, the database will make a copy of the online redo log files before overwriting them. 

Page 13: Oracle Architecture - Structure. Oracle Architecture - Structure The Oracle Server architecture 1. Structures are well-defined objects that store the.

Oracle Architecture - Structure

•Redo Log Files (.rdo & .arc):• These files contain information that helps in

recovery in the event of system failure. It contains information stored in the Redo Log Buffer. The information in the Redo Log Buffer is written into Redo Log files by the LGWR background process. The Redo Log files are generally multiplexed and copied for recovery purposes. Sets of redo Log files are known as Redo Log groups. Each database has minimum of two Redo Log groups. Redo Log groups are used in a circular fashion.

Page 14: Oracle Architecture - Structure. Oracle Architecture - Structure The Oracle Server architecture 1. Structures are well-defined objects that store the.

Oracle Architecture - Structure

•LOGICAL STRUCTURE

Page 15: Oracle Architecture - Structure. Oracle Architecture - Structure The Oracle Server architecture 1. Structures are well-defined objects that store the.

Oracle Architecture - Structure

• Logical Structure• The logical structure for Oracle RDBMS consists

of the following elements:

• Tablespace• Schema

Page 16: Oracle Architecture - Structure. Oracle Architecture - Structure The Oracle Server architecture 1. Structures are well-defined objects that store the.

Oracle Architecture - Structure

•Tablespace

•The Oracle database consists of one or more logical portions called as ‘Tablespaces’. A tablespace is a logical grouping of related data. 

A database administrator can use Tablespaces to do the following: 

•Control disk space allocation for database data.•Assign specific space quotas for database users.•Perform partial database backup or recovery operations.•Allocate data storage across devices to improve performance.

Page 17: Oracle Architecture - Structure. Oracle Architecture - Structure The Oracle Server architecture 1. Structures are well-defined objects that store the.

Oracle Architecture - Structure

• Table spaces: – These are at the highest level of Oracle disk-space

management.

• Segments• Extents• Data blocks:

– These are at the lowest level of Oracle disk-space management.

Page 18: Oracle Architecture - Structure. Oracle Architecture - Structure The Oracle Server architecture 1. Structures are well-defined objects that store the.

Oracle Architecture - Structure

Page 19: Oracle Architecture - Structure. Oracle Architecture - Structure The Oracle Server architecture 1. Structures are well-defined objects that store the.
Page 20: Oracle Architecture - Structure. Oracle Architecture - Structure The Oracle Server architecture 1. Structures are well-defined objects that store the.

Oracle Architecture - Structure

•Segments

•The level of logical database storage above an extent is called a segment. A segment is a set of extents that have been allocated for a specific type of data structure, and all are stored in the same tablespace. For example, each table's data is stored in its own data segment, while each index's data is stored in its own index segment.• 

An Oracle database can use four types of segments: 

•Data segment-- Stores user data within the database.•Index segment-- Stores indexes.•Rollback segment--Stores rollback information. This information is used when data must be rolled back.•Temporary segment—• Created when a SQL statement needs a temporary work area; these segments are destroyed when the SQL statement is finished. These segments are used during various database operations, such as sorts.

Page 21: Oracle Architecture - Structure. Oracle Architecture - Structure The Oracle Server architecture 1. Structures are well-defined objects that store the.

Oracle Architecture - Structure

•Extents• The next level of logical database space is

called an extent. An extent is a specific number of contiguous data blocks that are allocated for storing a specific type of information. 

•Data Blocks•At the finest level of granularity, an ORACLE database's data is stored in data blocks (also called logical blocks, ORACLE blocks, or pages). An ORACLE database uses and allocates free database space in ORACLE data blocks

Page 22: Oracle Architecture - Structure. Oracle Architecture - Structure The Oracle Server architecture 1. Structures are well-defined objects that store the.

Oracle Architecture - Structure

•Schema• The database schema is a collection of logical-structure objects,

known as schema objects that define how you see the database's data. A schema also defines a level of access for the users. All the logical objects in oracle are grouped into a schema. 

A scheme is a logical grouping of objects such as: 

• Tables• Clusters• Indexes• Views• Stored procedures• Triggers• Sequences

Page 23: Oracle Architecture - Structure. Oracle Architecture - Structure The Oracle Server architecture 1. Structures are well-defined objects that store the.

Oracle Architecture - Structure

•User/SystemProcesses

Page 24: Oracle Architecture - Structure. Oracle Architecture - Structure The Oracle Server architecture 1. Structures are well-defined objects that store the.

Oracle Architecture - Structure

•Processes 

•A process is a ``thread of control'' or a mechanism in an operating system that can execute a series of steps. Some operating systems use the terms job or task.

Page 25: Oracle Architecture - Structure. Oracle Architecture - Structure The Oracle Server architecture 1. Structures are well-defined objects that store the.

Oracle Architecture - Structure

•Oracle processes There are two categories of processes that run with an Oracle database. They are mentioned below: 

•User processes•System processes

• The following figure illustrates the relationship between user processes, server processes, PGA, and session:

Page 26: Oracle Architecture - Structure. Oracle Architecture - Structure The Oracle Server architecture 1. Structures are well-defined objects that store the.

Oracle Architecture - Structure

•The Oracle memory structureThe most basic components of Oracle memory are: 

•SGA- System Global Area. SGA is allocated whenever an Oracle instance starts and gets de-allocated when the Oracle instance is shutdown.• Components of SGA:

1.The Database Buffer Cache2.The Redo Log Buffer3.The Shared Pool

Page 27: Oracle Architecture - Structure. Oracle Architecture - Structure The Oracle Server architecture 1. Structures are well-defined objects that store the.

Oracle Architecture - Structure

•The Oracle memory structureThe most basic components of Oracle memory are: 

•PGA- It stands for Program Global Area. It is a region in memory that contains data and control information for a single process. This can be either a server or a background process. A PGA is allocated whenever an Oracle database user connects to a database and a session is created for him/her.

Page 28: Oracle Architecture - Structure. Oracle Architecture - Structure The Oracle Server architecture 1. Structures are well-defined objects that store the.

Oracle Architecture - Structure

Page 29: Oracle Architecture - Structure. Oracle Architecture - Structure The Oracle Server architecture 1. Structures are well-defined objects that store the.

Oracle Architecture - Structure

•The first interaction with the Oracle-based application comes from the user computer that creates a user process. •The user process then communicates with the server process on the host computer. Here, PGA is used to store session specific information.

Oracle has a large number of background processes. The background processes are categorized into: 

•Required Oracle background processes•Optional Oracle background processes

Page 30: Oracle Architecture - Structure. Oracle Architecture - Structure The Oracle Server architecture 1. Structures are well-defined objects that store the.

Oracle Architecture - Structure

1.Some of the background processes are: 

1. DBWR – It writes data blocks from SGA to data files.2. LGWR – It writes data from the Log Buffer to the redo log.3. CKPT – It timestamps all the data files and the control files whenever a checkpoint occurs.4. PMON – It stands for process monitor. It keeps track of database processes. It also cleans up the process that has died pre-maturely. The result is that all the cache and the resources are freed up. It also restarts those dispatcher processes that might have failed.

Page 31: Oracle Architecture - Structure. Oracle Architecture - Structure The Oracle Server architecture 1. Structures are well-defined objects that store the.

Oracle Architecture - Structure

4.SMON – It stands for system monitor. It performs instance recovery at instance startup.

• Some of the main functions of background processes are:o Communication among Oracle instanceso Performing computer maintenance

Page 32: Oracle Architecture - Structure. Oracle Architecture - Structure The Oracle Server architecture 1. Structures are well-defined objects that store the.

Oracle Architecture - Structure

Page 33: Oracle Architecture - Structure. Oracle Architecture - Structure The Oracle Server architecture 1. Structures are well-defined objects that store the.

Oracle Architecture - Structure

Page 34: Oracle Architecture - Structure. Oracle Architecture - Structure The Oracle Server architecture 1. Structures are well-defined objects that store the.

Oracle Architecture - Structure