Home >php教程 >PHP开发 >ORACLE database model overview

ORACLE database model overview

黄舟
黄舟Original
2016-12-15 10:18:562330browse

An ORACLE database is a collection of data, processed into a unit. Each ORACLE database has a physical structure and a logical structure.
The physical structure of the database is determined by the operating system files that make up the database. Database files provide real physical storage for database information. Each ORACLE database is composed of three types of files, namely data files, log files and control files.
Logical database structure is the database structure involved by the user. The logical structure of an ORACLE database is determined by the following factors:
(1) One or more table spaces
(2) Database schema object
Logical storage structure such as table space is used for control How the physical space of a database is used, schema objects and the relationships between them constitute the relational design of a database.
1. Database physical structure
ORACLE database consists of three types of physical files, namely data files, log files and control files.
1. Data files
Each ORACLE database has one or more physical data files (data files). A database's data file contains all database data. The data of the logical database structure is also physically stored in the data files of the database. Data files have the following characteristics:
(1) A data file is only associated with one database
(2) Once a data file is created, the size cannot be changed
(3) A table space consists of one or more data files
In the data file Data can be read when needed and stored in the ORACLE internal storage area. For example: the user wants to access certain data in a table of the database. If the requested information is not in the memory storage area of ​​the database, it will be read from the corresponding data file and stored in the memory. When new data is modified and inserted, the data file does not have to be written immediately. In order to reduce the total amount of disk output and improve performance, the data is stored in memory, and then the ORACLE background process DBWR determines how to write it to the corresponding data file.
2. Log files
Each database has a log file group consisting of two or more log files (redo log files), and each log file is used to collect database logs.
The main function of the log is to record modifications to the database, so all modifications to the database are recorded in the log. The log file is mainly used to protect the database from failures. In order to prevent the failure of the log file itself, ORACLE allows mirrored logs (mirrored redo log) so that multiple identical log copies can be maintained on different disks.
The information in the log file is only used when recovering the database from a system failure or media failure.
3. Control file
Each ORACLE database has at least one control file (control file), which records the physical structure of the database. The main information contained is:
(1) Database name
(2) The name and location of the database data file and log file
(3) Database creation date
Every time an instance of the ORACLE database is started, its control file is used to identify the database and log files, which must be opened when proceeding with database operations. When the physical composition of the database changes, ORACLE automatically changes the control file of the database.
2.3.2 Database logical structure
The logical structure of the database includes table space, segment, extent, and block,
1. Table space
A database is divided into one or more logical units, and this logical unit is called a table space. A tablespace groups related logical structures together. DBAs can use table spaces to do the following:
(1) Control the disk allocation of database data
(2) Allocate determined space shares to database users
(3) Control the availability of data by making a single table space online or offline
(4) Perform partial database backup or recovery operations
(5) To improve performance, allocate data storage across devices
The relationship between databases, table spaces and data files is shown in Figure 2.3-2.
Each database can be logically divided into one or more table spaces. Each table space is composed of one or more data files. The table space physically stores the data of all logical structures in the table space. The DBA can create a new table space, add or delete data files to the table space, and set or change the default segment storage location.
Each ORACLE database contains a table space named SYSTEM, which is automatically created when the database is created. This table space always contains the data dictionary tables of the entire database. The smallest database may only require the SYSTEM tablespace. This tablespace must always be online. All stored data for tables and stored PL/SQL program units (procedures, functions, packages, and triggers) is stored in the SYSTEM tablespace.
Expand the table space by adding data files in the table space. The size of the table space is the sum of the sizes of the data files that make up the table space.
The DBA can make any other table space in the ORACLE database except the SYSTEM table space online or offline (the offline table space cannot have active rollback segments). A tablespace is usually online so that the data it contains is available to database users. When a tablespace is offline, its data is not available. In the following situations, the DBA can make it offline:
(1) Make part of the data unavailable, while allowing normal access to the remaining part
(2) Perform an offline table space backup
(3) In order to modify or maintain an application, Make it and its set of tables temporarily unavailable
A table space containing an active rollback segment cannot be taken offline. The table space can be taken offline only when the rollback segment is not in use.
Record the status of the table space in the data dictionary, whether online or offline. If a tablespace is offline when the database is closed, it remains offline the next time the database is mounted and reopened.
When certain errors occur, a table space can automatically change from online to offline. By using multiple table spaces, different types of data are separated, making it easier for the DBA to manage the database.
A table space in the ORACLE database is composed of one or more physical data files. One data file can only be associated with one table space.
ORACLE can control the use of disk space in more detail through logical data structures such as segments, areas, and data blocks.
2. Segment
A segment (SEGMENT) contains a specified type of logical storage structure in the table space and is composed of a group of areas. There are several types of segments in the ORACLE database: data segments, index segments, rollback segments and temporary segments.
Data segment: There is a data segment for each non-aggregated table, and all data in the table is stored in this segment. Each aggregation has a data segment, and the data for each table in the aggregation is stored in this segment.
Index segment: Each index has an index segment to store index data.
Rollback segment: It is established by the DBA and is used to temporarily store information to be undone. This information is used to generate read-consistent database information, used during database recovery, and to roll back uncommitted transactions.
Temporary segment: When a SQL statement requires a temporary work area, it is created by ORACLE. When the statement is executed, the temporary segment area is returned to the system.
ORACLE allocates space to all segments, in units of zones.
3. Area
An area (EXTENT) is a logical unit of database storage space allocation, which consists of continuous ORACLE data blocks. Each segment is composed of one or more regions. When all space in a segment has been fully used, ORACLE allocates a new area for the segment.
For maintenance purposes, each segment in the database contains a segment title block describing the characteristics of the segment and the directory of areas in the segment.
4. Data block
Data block is the unit used by ORACLE to manage storage space in data files. It is the smallest unit of I/O used by the database. Its size can be different from the standard I/O block size of the operating system.

The above is the overview of the ORACLE database model. For more related articles, please pay attention to the PHP Chinese website (www.php.cn)!


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:Linux awk commandNext article:Linux awk command