Summary: in this tutorial, you will learn about the Oracle Database architecture and its components.
Oracle Database is an object-relational database management system developed and marketed by Oracle Corporation. Oracle Database is commonly referred to as Oracle RDBMS or simply Oracle.
Database and Instance
An Oracle Database consists of a database and at least one instance.
An instance, or database instance, is the combination of memory and processes that are a part of a running installation and a database is a set of files that store data.
The following picture illustrates the Oracle Database server architecture.
Sometimes, a database instance is referred to as an entire running database. However, it is important to understand the distinctions between the two.
First, you can start a database instance without having it accessing any database files. This is how you create a database, starting an instance first and creating the database from within the instance.
Second, an instance can access only one database at a time. When you start an instance, the next step is to mount that instance to a database. And an instance can mount only one database at a single point in time.
Third, multiple database instances can access the same database. In a clustering environment, many instances on several servers can access a central database to enable high availability and scalability.
Finally, a database can exist without an instance. However, it would be unusable because it is just a set of files.
One of the essential tasks of the Oracle Database is to store data. The following section briefly describes the physical and logical storage structure of an Oracle Database.
Physical storage structures
The physical storage structures are simply files that store data. When you execute a
CREATE DATABASE statement to create a new database, Oracle creates the following files:
- Data files: data files contain real data, e.g., sales order and customer data. The data of logical database structures such as tables and indexes are physically stored in the data files.
- Control files: every database has a control file that contains metadata. The metadata describes the physical structure of the database including the database name and the locations of data files.
- Online redo log files: every database has an online redo log that consists of two or more online redo log files. An online redo log is made up of redo entries that record all changes made to the data.
Besides these files, an Oracle database includes other important files such as parameter files, network files, backup files, and archived redo log files for backup and recovery.
Logical Storage Structures
Oracle Database uses a logical storage structure for fine-grained control of disk space usage. The following are logical storage structures in an Oracle Database:
- Data blocks: a data block corresponds to a number of bytes on the disk. Oracle stores data in data blocks. Data blocks are also referred to as logical blocks, Oracle blocks or pages.
- Extents: An extent is a specific number of logically contiguous data blocks used to store the particular type of information.
- Segments: a segment is a set of extents allocated for storing database objects, e.g., a table or an index.
- Tablespaces: a database is divided into logical storage units called tablespaces. A tablespace is a logical container for a segment. Each tablespace consists of at least one data file.
The following picture illustrates segments, extents and data blocks within a tablespace:
And the next figure shows the relationship between logical and physical storage structures:
A Database Instance is an interface between client applications (users) and the database. An Oracle instance consists of three main parts: System Global Area (SGA), Program Global Area (PGA), and background processes.
The SGA is a shared memory structure allocated when the instance started up and released when it is shut down. The SGA is a group of shared memory structures that contain data and control information for one database instance.
Different from the SGA, which is available to all processes, PGA is a private memory area allocated to each session when the session started and released when the session ends.
Major Oracle Database’s background processes
The following are the major background processes of an Oracle instance:
- PMON is the process monitor that regulates all other processes. PMON cleans up abnormally connected database connections and automatically registers a database instance with the listener process. PMON is a process that must be alive in an Oracle database.
- SMON is the system monitor process that performs system-level clean-up operation. It has two primary responsibilities including automatically instance recovery in the event of a failed instance, e.g., power failure and cleaning up of temporary files.
- DBWn is the database writer. Oracle performs every operation in memory instead of the disk because processing in memory is faster and more efficient than on disk. The DBWn process reads data from disk and writes it back to the disk. An Oracle instance has many database writers DBW0, DBW1, DBW2, and so on.
- CKPT is the checkpoint process. In Oracle, data that is on disk is called block and the data which in memory is called buffer. When a block is written to the buffer and changed, the buffer becomes dirty, and it needs to be written down to the disk. The CKPT process updates the control and data file headers with checkpoint information and signals writing of dirty buffers to disk. Note that Oracle 12c allows both full and incremental checkpoints.
- LGWR is the log writer process which is the key to the recoverability architecture. Every change occurs in the database is written out to a file called redo log for recovery purposes. And these changes are written and logged by LGWR process. The LGWR process first writes the changes to memory and then disk as redo logs which then can be used for recovery.
- ARCn is the archiver process that copies the content of redo logs to archive redo log files. The archiver process can have multiple processes such as ARC0, ARC1, and ARC3, which allow the archiver to write to various destinations such as D: drive, E drive or other storage.
- MMON is the manageability monitor process that gathers performance metrics.
- MMAN is the memory manager that automatically manages memory in an Oracle database.
- LREG is the listener registration process that registers information on the database instance and dispatcher processes with the Oracle Net Listener.