The architecture of an Oracle database consists of four aspects: the physical structure, logical structure, memory structure, and process of a database.
1. Physical Structure
The physical database structure is determined by the operating system files that comprise the database, and the Oracle database files include:
Data file
A data file is used to store all the data in a database, such as data and index data in a database table. Usually think of *.dbf format, for example: USERCIMS.DBF.
Log files (Redo log file)
Log files are used to record all changes made by the database, such as additions, deletions, and modifications, so that it can be used to recover the database in the event of a system failure. The name is usually LOG*.DBF format, such as: LOG1CIMS.DBF,LOG2CIMS.DBF.
Control file
Each Oracle database has a corresponding control file, which is a small binary file that records the physical structure of the database, such as the database name, the database's data file, and the name and location of the log file. Used to open and access the database. The name is usually in CTRL*CTL format, such as Ctrl1cims.ctl.
Configuration file
The configuration file records some important parameters of the Oracle database runtime, such as the size of the data block, the configuration of the memory structure, and so on. The name is usually Init*.ora format, such as: Initcims.ora.
2 Logical Structure
The logical structure of the Oracle database describes how the database logically stores the data in the database. Logical structures include table spaces, segments, extents, data blocks, and schema objects. The logical structure of a database governs how a database uses the physical space of the system. Schema objects and their relationships describe the design between relational databases.
A database is logically composed of one or more table spaces, which are data warehouses that are physically grouped in a database, each of which consists of segments (segment), a segment consisting of a set of zones (extent), and a block of contiguous blocks of databases (database Blocks), and a database block corresponds to one or more physical blocks on the hard disk. A tablespace is a physical file (that is, a data file) that holds one or more databases. The data in a database is logically stored on the tablespace.
Table Space (tablespace)
The Oracle database is divided into one or more logical structures called table spaces, which consist of two types of table spaces, System tablespace, and non-system tablespace, where the system tablespace is created automatically when the database is installed and contains all the data dictionaries for the database, stored procedures, packages, Definitions of functions and triggers, and system rollback segments. In addition, you can also include user data.
A table space contains a number of segments, each of which can consist of discontinuous sections, each consisting of a contiguous set of data blocks that are the smallest unit of operation of the database.
Each table space corresponds to one or more data files, and each data file can belong to only one table space.
Database blocks (db block)
A database block is also known as a logical block or an Oracle block, which corresponds to one or more physical blocks of a disk, and its size is determined by the initialization parameters Db-block-size (in file Init.ora), typically 2k in size. The Pckfree and pctused two parameters are used to optimize the use of data block space.
Area (extent)
A zone is a logical unit of allocation of a database storage space consisting of a contiguous set of data blocks.
Segment (segment)
A segment is a collection of one or more disjoint extents that includes all the data for a particular logical structure within a table space, which cannot be stored across table spaces. Oracle databases include data segments, index segments, temporary segments, rollback segments, and so on.
Schema objects (schema object)
The schema objects for an Oracle database include tables, views, sequences, consent words, indexes, triggers, stores. procedures, and so on, they will focus on the following chapters.
3. Oracle Server system processes and memory architecture
When the Oracle database is started on a computer server, it is said that an Oracle instance (Instance) is started on the server. Oracle Instance (Instance) is a software mechanism for accessing and controlling a database that contains both the system global Area (SGA) and the Oracle process. The SGA is a set of shared memory buffers that the system allocates for the instance, which holds the DB instance and control information for the governance and operation of the data in the database.
A process is an extremely important concept in the operating system. A process performs a set of actions to complete a specific task. For Oracle database governance systems, processes are composed of user processes, server processes, and background processes.
When a user runs an application, the system establishes a user process for it. The server process processes the request to the user process that is connected to it, communicates with the user process, and serves the Oracle request for the connected user process.
In order to improve the performance of the system and to realize the multi-user function, Oracle also launches some background processes in the background for database data operation.
The background processes of the system process mainly include:
Smon System Monitoring process: (System Monitor) is responsible for completing the automatic instance Recovery and recycling classification (sort) tablespace.
Pmon Process Monitoring process: (Process Monitor) to implement user process recovery, clean up the memory area and release the resources required for the process.
DBWR Database Write process: The governance process of the database buffer.
Under its governance, there is always a certain number of free buffer blocks in the database buffers to ensure that user processes can always find free buffer blocks for their use.
LGWR log File Write process: is the governance process of the log buffer, which is responsible for writing log entries in the log buffers to log files on disk. There is only one LGWR process per instance.
The ARCH archive process: (Archiver process) copies the already filled online log files to a specified storage device. The arch operation is performed only when the log filegroup switch is present. Arch is not required, but only when an automatic archive is available or when a request is filed manually.
RECO recovery process: a process that is used when there is a distributed option, primarily to resolve failures that occur when referencing a distributed transaction. It can only occur in systems that promise distributed transactions.
LCKN blocking process: Used for parallel server systems, mainly to complete the blocking between instances.
Memory Structure (SGA)
The SGA is a set of shared memory buffers that Oracle allocates for an instance that contains data and control information for that instance. The SGA is automatically assigned when the instance is started and is retracted when the instance is closed. All data operations of the database are carried out through the SGA.
The memory in the SGA can be divided into the following areas depending on the storage information: Buffer Cache: Stores a copy of the database block in the database. It consists of a set of buffer blocks that are shared by all user processes that are linked to the instance. The number of buffer blocks is determined by the initialization parameter db_block_buffers, and the size of the buffer block is determined by the initialization parameter db_block_size. Large blocks of data can improve query speed. It is operated by the DBWR.
B. Log buffer redo log buffer: The change information that holds the data operation. They are stored in the log buffer in the form of log entries (redo entry). When database recovery is required, log entries are used to refactor or roll back changes made to the database. The size of the log buffer is determined by the initialization parameter Log_buffer. A large log buffer can reduce the number of log file I/O. The background Process LGWR writes the information in the log buffer to the log file of the disk, and initiates the arch background process to archive the log information.
C. Shared pool: Contains the SQL statement information used to process. It contains the shared SQL area and the data dictionary store. The shared SQL area contains information that is used to execute a specific SQL statement. The data dictionary area is used to hold the data dictionary, which is shared by all user processes.
Cursors: Some memory pointers to execute pending SQL statements
Other information areas: In addition to the above information areas, there are some communication information (such as blocking information) between the processes, and in the multi-thread server configuration, there are also information about the global area of the program, the request queue and the response queue. This article from: http://hi.baidu.com/ipbun/blog/item/3f75d7230a7f5ee698250a7c.html
Structure of the Oracle database