A database server is the key to information management. In general, a server reliably manages a large amount of data in a multiuser environment so that users can concurrently access the same data. A database server also prevents unauthorized access and provides efficient solutions for failure recovery.
Database and Instance
An Oracle database server consists of a database and at least one database instance (commonly referred to as simply an instance). Because an instance and a database are so closely connected, the term Oracle database is sometimes used to refer to both instance and database. In the strictest sense the terms have the following meanings:
-
Database
A database is a set of files, located on disk, that store data. These files can exist independently of a database instance.
-
Database instance
An instance is a set of memory structures that manage database files. The instance consists of a shared memory area, called the system global area (SGA), and a set of background processes. An instance can exist independently of database files.
A database can be considered from both a physical and logical perspective. Physical data is data viewable at the operating system level. For example, operating system utilities such as the Linux ls
and ps
can list database files and processes. Logical data such as a table is meaningful only for the database. A SQL statement can list the tables in an Oracle database, but an operating system utility cannot.
The database has physical structures and logical structures. Because the physical and logical structures are separate, the physical storage of data can be managed without affecting access to logical storage structures. For example, renaming a physical database file does not rename the tables whose data is stored in this file.
Database Storage Structures
An essential task of a relational database is data storage. This section briefly describes the physical and logical storage structures used by Oracle Database.
Physical Storage Structures
The physical database structures are the files that store the data. When you execute the SQL command CREATE DATABASE
, the following files are created:
-
Data files
Every Oracle database has one or more physical data files, which contain all the database data. The data of logical database structures, such as tables and indexes, is physically stored in the data files.
-
Control files
Every Oracle database has a control file. A control file contains metadata specifying the physical structure of the database, including the database name and the names and locations of the database files.
-
Online redo log files
Every Oracle Database has an online redo log, which is a set of two or more online redo log files. An online redo log is made up of redo entries (also called redo records), which record all changes made to data.
Many other files are important for the functioning of an Oracle database server. These files include parameter files and diagnostic files. Backup files andarchived redo log files are offline files important for backup and recovery.
Logical Storage Structures
This section discusses logical storage structures. The following logical storage structures enable Oracle Database to have fine-grained control of disk space use:
-
Data blocks
At the finest level of granularity, Oracle Database data is stored in data blocks. One data block corresponds to a specific number of bytes on disk.
-
Extents
An extent is a specific number of logically contiguous data blocks, obtained in a single allocation, used to store a specific type of information.
-
Segments
A segment is a set of extents allocated for a user object (for example, a table or index), undo data, or temporary data.
-
Tablespaces
A database is divided into logical storage units called tablespaces. A tablespace is the logical container for a segment. Each tablespace contains at least one data file.
Database Instance Structures
An Oracle database uses memory structures and processes to manage and access the database. All memory structures exist in the main memory of the computers that constitute the RDBMS.
When applications connect to an Oracle database, they are connected to a database instance. The instance services applications by allocating other memory areas in addition to the SGA, and starting other processes in addition to background processes.
Oracle Database Processes
A process is a mechanism in an operating system that can run a series of steps. Some operating systems use the terms job, task, or thread. For the purpose of this discussion, a thread is equivalent to a process. An Oracle database instance has the following types of processes:
-
Client processes
These processes are created and maintained to run the software code of an application program or an Oracle tool. Most environments have separate computers for client processes.
-
Background processes
These processes consolidate functions that would otherwise be handled by multiple Oracle Database programs running for each client process. Background processes asynchronously perform I/O and monitor other Oracle Database processes to provide increased parallelism for better performance and reliability.
-
Server processes
These processes communicate with client processes and interact with Oracle Database to fulfill requests.
Oracle processes include server processes and background processes. In most environments, Oracle processes and client processes run on separate computers.
Instance Memory Structures
Oracle Database creates and uses memory structures for purposes such as memory for program code, data shared among users, and private data areas for each connected user. The following memory structures are associated with an instance:
-
System Global Area (SGA)
The SGA is a group of shared memory structures that contain data and control information for one database instance. Examples of SGA components include cached data blocks and shared SQL areas.
-
Program Global Areas (PGA)
A PGA is a memory region that contain data and control information for a server or background process. Access to the PGA is exclusive to the process. Each server process and background process has its own PGA.