Home php教程 PHP开发 ORACLE database model overview

ORACLE database model overview

Dec 15, 2016 am 10:18 AM

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 of this Website
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1659
14
PHP Tutorial
1258
29
C# Tutorial
1232
24
What to do if the oracle can't be opened What to do if the oracle can't be opened Apr 11, 2025 pm 10:06 PM

Solutions to Oracle cannot be opened include: 1. Start the database service; 2. Start the listener; 3. Check port conflicts; 4. Set environment variables correctly; 5. Make sure the firewall or antivirus software does not block the connection; 6. Check whether the server is closed; 7. Use RMAN to recover corrupt files; 8. Check whether the TNS service name is correct; 9. Check network connection; 10. Reinstall Oracle software.

How to solve the problem of closing oracle cursor How to solve the problem of closing oracle cursor Apr 11, 2025 pm 10:18 PM

The method to solve the Oracle cursor closure problem includes: explicitly closing the cursor using the CLOSE statement. Declare the cursor in the FOR UPDATE clause so that it automatically closes after the scope is ended. Declare the cursor in the USING clause so that it automatically closes when the associated PL/SQL variable is closed. Use exception handling to ensure that the cursor is closed in any exception situation. Use the connection pool to automatically close the cursor. Disable automatic submission and delay cursor closing.

How to create cursors in oracle loop How to create cursors in oracle loop Apr 12, 2025 am 06:18 AM

In Oracle, the FOR LOOP loop can create cursors dynamically. The steps are: 1. Define the cursor type; 2. Create the loop; 3. Create the cursor dynamically; 4. Execute the cursor; 5. Close the cursor. Example: A cursor can be created cycle-by-circuit to display the names and salaries of the top 10 employees.

What to do if the oracle log is full What to do if the oracle log is full Apr 12, 2025 am 06:09 AM

When Oracle log files are full, the following solutions can be adopted: 1) Clean old log files; 2) Increase the log file size; 3) Increase the log file group; 4) Set up automatic log management; 5) Reinitialize the database. Before implementing any solution, it is recommended to back up the database to prevent data loss.

What steps are required to configure CentOS in HDFS What steps are required to configure CentOS in HDFS Apr 14, 2025 pm 06:42 PM

Building a Hadoop Distributed File System (HDFS) on a CentOS system requires multiple steps. This article provides a brief configuration guide. 1. Prepare to install JDK in the early stage: Install JavaDevelopmentKit (JDK) on all nodes, and the version must be compatible with Hadoop. The installation package can be downloaded from the Oracle official website. Environment variable configuration: Edit /etc/profile file, set Java and Hadoop environment variables, so that the system can find the installation path of JDK and Hadoop. 2. Security configuration: SSH password-free login to generate SSH key: Use the ssh-keygen command on each node

Oracle's Role in the Business World Oracle's Role in the Business World Apr 23, 2025 am 12:01 AM

Oracle is not only a database company, but also a leader in cloud computing and ERP systems. 1. Oracle provides comprehensive solutions from database to cloud services and ERP systems. 2. OracleCloud challenges AWS and Azure, providing IaaS, PaaS and SaaS services. 3. Oracle's ERP systems such as E-BusinessSuite and FusionApplications help enterprises optimize operations.

How to stop oracle database How to stop oracle database Apr 12, 2025 am 06:12 AM

To stop an Oracle database, perform the following steps: 1. Connect to the database; 2. Shutdown immediately; 3. Shutdown abort completely.

How to create oracle dynamic sql How to create oracle dynamic sql Apr 12, 2025 am 06:06 AM

SQL statements can be created and executed based on runtime input by using Oracle's dynamic SQL. The steps include: preparing an empty string variable to store dynamically generated SQL statements. Use the EXECUTE IMMEDIATE or PREPARE statement to compile and execute dynamic SQL statements. Use bind variable to pass user input or other dynamic values ​​to dynamic SQL. Use EXECUTE IMMEDIATE or EXECUTE to execute dynamic SQL statements.

See all articles