ORACLE Architecture and Terminology

This section will provide a basic understanding of ORACLE including the concepts and terminology of the ORACLE Server. It is important that you read through this section to familiarize yourself with the concepts and terminology to be used throughout this manual. Most of the information contained in this section is DIRECTLY extracted from ``ORACLE7 Server Concepts Manual'' and all credit should be attributed to ORACLE. Before you can begin to use ORACLE, you must have a basic understanding of the architecture of ORACLE to help you start thinking about an ORACLE database in the correct conceptual manner. Figure 1 illustrates a typical variation of ORACLE's memory and process structures; some of the memory structures and processes in this diagram are discussed in the following section. For more information on these memory structures and processes, see page 1-15 of ``ORACLE7 Server Concepts Manual.''

Figure 1. ORACLE Architecture

Memory Structures and Processes
The mechanisms of ORACLE execute by using memory structures and processes. All memory structures exist in the main memory of the computers that constitute the database system. Processes are jobs or tasks that work in the memory of these computers. Memory Structures

Logical Database Structure An ORACLE database's logical structure is determined by: y y one or more tablespaces. Several basic memory structures are associated with ORACLE: the system global area (which includes the database and redo log buffers. tables. The operations on a database must adhere to a pre-defined set of integrity rules. the database's schema objects (e. For example. 119). stored procedures). Processes A process is a ``thread of control'' or a mechanism in an operating system that can execute a series of steps. sequences. and the shared pool) and the program global area. views. An ORACLE database has both a physical and a logical structure. A PGA is created by ORACLE when a server process is started. ORACLE also creates a set of background processes for each instance (see ``ORACLE7 Server Concepts Manual'' pages 1-18.. the physical storage of data can be managed without affecting the access to logical storage structures. The information in a PGA depends on the configuration of ORACLE. An ORACLE database system has two general types of processes: user processes and ORACLE processes. Integrity rules protect the data and the structures of a database. Structures and the data contained within them can be manipulated by operations. Operations Operations are clearly defined actions that allow users to manipulate the data and structures of a database. An ORACLE instance contains the SGA and the background processes.ORACLE creates and uses memory structures to complete several jobs. The SGA is allocated when an instance starts and deallocated when the instance shuts down. System Global Area (SGA) is a shared memory region allocated by ORACLE that contains data and control information for one ORACLE instance. By separating physical and logical database structure. Integrity Rule Integrity rules are the laws that govern which operations are allowed on the data and structures of a database. indexes. The Program Global Area (PGA) is a memory buffer that contains data and control information for a server process. ORACLE processes are called by other processes to perform functions on behalf of the invoking process. A user process is created and maintained to execute the software code of an application program (such as a PRO*C program) or an ORACLE tool (such as SQL*PLUS). User processes communicate with the server processes through the program interface.g. ORACLE creates a server process to handle requests from connected user processes. Each instance that is started has its own SGA. clusters. The user process also manages the communication with the server processes. memory is used to store program code being executed and data that is shared among users. Database Structures The relational model has three major aspects: Structures Structures are well-defined objects that store the data of a database. . Some operating systems use the terms job or task.

databases and data files A database's data is collectively stored in the data files that constitute each tablespace of the database. Although databases. dictate how the physical space of a database is used. An object's segment allocates space in only one tablespace of a database. The space for this table's data segment is allocated in one or more of the data files that constitute the specified tablespace. segments. suppose a table is created in a specific tablespace using the CREATE TABLE command with the TABLESPACE option. tablespaces and data files Each tablespace in an ORACLE database is comprised of one or more operating system files called data files. and segments are closely related. including tablespaces. For example. A more complicated database might have three tablespaces. and extents. Tablespaces and Data Files Tablespaces are the primary logical storage structures of any ORACLE database. Data Files and Tablespaces . Figure 2. they have important differences: databases and tablespaces An ORACLE database is comprised of one or more logical storage units called tablespaces. schema objects. The database's data is collectively stored in the database's tablespaces. A tablespace's data files physically store the associated database data on disk. The schema objects and the relationships among them form the relational design of a database. with one data file. each comprised of two data files (for a total of six data files). For example. The usable data of an ORACLE database is logically stored in the tablespaces and physically stored in the data files associated with the corresponding tablespace. the simplest ORACLE database would have one tablespace. segments. its segment is created within a designated tablespace in the database. data files. Figure 2 illustrates this relationship. tablespaces.The logical storage structures. and tablespaces When a schema object such as a table or index is created.

Figure 3 illustrates the relationships between these data structures. You can query these data dictionary tables to obtain pertinent information about the database. Every ORACLE database contains a tablespace named SYSTEM. ORACLE uses the free space in the associated data files to allocate extents for the segment. index segments. A segment is a set of extents which have been allocated for a specific type of data structure. and only one database. and may or may not span files. Because extents are allocated as needed. Data files associated with a tablespace store all the database data in that tablespace. A database administrator can use tablespaces to do the following: y y y y y Control disk space allocation for database data. ORACLE blocks. extents. Perform partial database backup or recovery operations. however. The database administrator and end-users cannot control which data file stores an object. an ORACLE database's data is stored in data blocks (also called logical blocks. One or more datafiles form a logical unit of database storage called a tablespace. and segments. An extent cannot span files. the space is reserved to hold only the data for future segments of the associated tablespace . the names of the tables that are owned by you or ones to which you have access. Extents The next level of logical database space is called an extent. . For example. A data file can be associated with only one tablespace. Figure 4 illustrates a typical ORACLE data block. Control availability of data by taking individual tablespaces online or offline. while each index's data is stored in its own index segment.it cannot store any other program's data. The SYSTEM tablespace always contains the data dictionary tables for the entire database. As a segment (such as the data segment for a table) is created and grows in a tablespace. and all are stored in the same tablespace. and so on) in a tablespace are physically stored in one or more of the data files that constitute the tablespace.A database is divided into one or more logical storage units called tablespaces. though. when the existing extents of a segment are full. Segments The level of logical database storage above an extent is called a segment. for example. which is automatically created when the database is created. Note that a schema object does not correspond to a specific data file. Assign specific space quotas for database users. Data Blocks. See Chapter 3 for more information on how to access data dictionary tables. therefore. The extents of a single segment can be allocated in one or more data files of a tablespace (see Figure 3). rollback segments. the allocated disk space does not contain any data. An extent is a specific number of contiguous data blocks that are allocated for storing a specific type of information. ORACLE allocates another extent for that segment. rather. The units of logical database allocations are data blocks. an object can ``span'' one or more data files. Therefore. Extents. The data in the segments of objects (data segments. After a data file is initially created. each table's data is stored in its own data segment. a data file is a repository for the data of any object within a specific tablespace. Allocate data storage across devices to improve performance. Data Blocks At the finest level of granularity. and Segments ORACLE allocates database space for all data in a database. An ORACLE database uses and allocates free database space in ORACLE data blocks. the extents of a segment may or may not be contiguous on disk. or pages). ORACLE allocates space for segments in extents.

This block size can differ from the standard I/O block size of the operating system that executes ORACLE. The ORACLE block format is similar regardless of whether the data block contains table. index.2048). Extents and Data Blocks ORACLE manages the storage space in the data files of a database in units called data blocks. or clustered data. A data block corresponds to a block of physical bytes on disk.Figure 3. . Figure 4 shows the format of a data block. A data block is the smallest unit of I/O used by a database. equal to the ORACLE data block size (specifically set when the database is created . The Relationship Among Segments.

PCTFREE and PCTUSED. such as block address. Row Directory This portion of the block contains row information about the actual rows in the block (including addresses for each row piece in the row data area). the storage parameter PCTFREE can also be specified when creating or altering indicies (index segments). Free Space Free space is used to insert new rows and for updates to rows that require additional space (e. Data Block Format Header (Common and Variable) The header contains general block information.Figure 4. Table Directory The table directory portion of the block contains information about the tables having rows in this block.g. Once the space has been allocated in the row directory of a block's header. such as data. when a trailing null is updated to a non-null value). Both of these parameters can only be specified when creating or altering tables and clusters (data segments). Rows can span blocks. this space is not reclaimed when the row is deleted. Space Used for Transaction Entries Data blocks allocated for the data segment of a table. allow a developer to control the use of free space for inserts of and updates to the rows in data blocks. index. . Whether issued insertions actually occur in a given data block is a function of the value for the space management parameter PCTFREE and the amount of current free space in that data block. segment type. or the index segment of an index can also use free space for transaction entries. In addition. Two space management parameters. While some block overhead is fixed in size (about 107 bytes). Row Data This portion of the block contains table or index data. the total block overhead size is variable. cluster. or rollback..

two or more redo log files. An incremental extent is a subsequent extent of the same or incremented size of the previous extent in that segment. and one or more control files. see ``ORACLE7 Server Concepts Manual. Storage parameters for a table. the free space of the data block can only be used for updates to rows already contained in the data block. snapshot. assume that you specify the following parameter within a CREATE TABLE statement: pctused 40 In this case. each segment in a database is created with at least one extent to hold its data. For example. Before this value is achieved. Every non-clustered table in an ORACLE database has a single data segment to hold all of its data. For more information on Data Blocks.The PCTFREE parameter is used to set the percentage of a block to be reserved (kept free) for possible updates to rows that already are contained in that block. For more information on these physical storage files. For example. assume that you specify the following parameter within a CREATE TABLE statement: pctfree 20 This states that 20\% of each data block used for this table's data segment will be kept free and available for possible updates to the existing rows already within each block. No matter what type. After a data block becomes full. The files of a database provide the actual physical storage for database information. as determined by PCTFREE. Each ORACLE database is comprised of these types of files: one or more data files.'' Physical Database Structure An ORACLE database's physical structure is determined by the operating system files that constitute the database. or cluster control the way that a data segment's extents are allocated.'' . This extent is called the segment's initial extent. Setting these storage parameters directly via the CREATE TABLE/SNAPSHOT/CLUSTER or ALTER TABLE/SNAPSHOT/CLUSTER commands affects the efficiency of data retrieval and storage for that data segment. If the data blocks of a segment's initial extent become full and more space is required to hold new data. see ``ORACLE7 Server Concepts Manual. Segments and Extents. the block is not considered for the insertion of new rows until the percentage of the block being used falls below the parameter PCTUSED. a data block used for this table's data segment is not considered for the insertion of any new rows until the amount of used space in the blocks falls to 39\% or less (assuming that the block's used space has previously reached PCTFREE). The data segment for a table is indirectly created via the CREATE TABLE/SNAPSHOT command. ORACLE automatically allocates an incremental extent for that segment.

Maintaining the Free Space of Data Blocks with PCTFREE and PCTUSED .Figure 5.