To learn about Oracle, we 'd better first understand the Oracle framework. In this way, we have an overall understanding of Oracle, which has the role of creating a high-level architecture.
1. Physical Structure (composed of control files, data files, redo log files, parameter files, archive files, and password files)
The data in a database is stored in physical files on the disk. When used, the data is transferred to the memory.
The control file, data file, redo log file, trace file and warning log (trace files, alert files) are database files;
The parameter file Password File is a non-database file.
1.1 data files: data files that store data. data files typically represent the volume of an Oracle database determined by the disk space and quantity they use.
For performance reasons, each type of data is stored in a corresponding file or a series of files, which are placed on different disks.
Types:
. Data Dictionary. Data
. Redo data. Index
. Temporary data, etc.
1.2 control file: contains the necessary information to maintain and verify the integrity of the database. For example, a control file is used to identify data files and redo log files. A database requires at least one control file.
Control File Content
. Database Name
. Tablespace Information
. Names and locations of all data files
. Names and locations of all redo log files
. Current Log serial number
. Checkpoint Information
. Redo log and archive current status information
Use of Control Files
The control file directs Oracle to other parts of the database file. When an instance is started, Oracle reads the name and location of the control file from the parameter file. When the database is installed, Oracle opens the control file. When the database is finally opened, Oracle reads the list of data files from the control file and opens each file.
1.3 redo log files:
Includes changes made to the database, so that data recovery can be enabled in case of a fault. A database requires at least two redo log files.
1.4 trace files and warning logs (trace files and alert files)
Each background process running in the instance is connected to a trace file. Trace file records the information of major events encountered by background processes.
Alert Log is a special trace file. Each database has a trace file that synchronously records database messages and errors.
1.5 parameter file: contains a large number of settings that affect the functions of Oracle database instances, as shown in the following settings:
. Locating Database Control Files
. The amount of memory that Oracle uses to cache data read from the disk
. Select the default optimizer.
Perform two important functions related to database files
1> specify the control file for the database
2> specify the log archiving target for the database
1.6 archive file: an offline copy of the redo log file, which may be necessary to recover from a media failure.
1.7 Password File: Authenticate which users have the permission to start and close Oracle routines.
2. Logical Structure (tablespace, segment, partition, block)
Table space: a set of data files in the basic logical structure of the database.
Segment: the space occupied by objects in the database.
ZONE: A large storage space reserved for data at one time.
Block: the most basic storage unit of Oracle, which is specified when a database is created.
3. Memory Allocation (SGA and PGA)
SGA is the memory area used to store database information, which is shared by database processes. It contains data and control information of the Oracle server. It is allocated in the actual memory of the computer where the Oracle server resides. If the actual memory is insufficient, it is written into the virtual memory.
PGA: contains the data and control information of a single server process or a single background process. Unlike the SGA shared by several processes, PGA is only used by one process, PGA is allocated when a process is created and recycled when the process is terminated.
4. background processes
Including database writer (dbwr), log writer (lgwr), system monitor (SMON), Process Monitor (pmon), Checkpoint Process (ckpt), archiving process, service process, user process)
Data Writing Process: responsible for writing changed data from the database buffer cache to the data file
Log writing process: writes changes in the redo log buffer to online redo log files.
System Monitoring: Checks Database Consistency and starts database recovery when the database is opened if necessary.
Process Monitoring: clears resources when an oracle process fails.
Checkpoint Process: updates the database status information in control files and data files whenever changes in the buffer cache are permanently recorded in the database. The process changes the title of all data files at the check point to indicate the checkpoint. Generally, this task is executed by lgwr. However, if the checkpoint significantly reduces system performance, the ckpt process can run to separate the work of the checkpoint originally executed by the lgwr process, which is implemented by the ckpt process. For many applications, the ckpt process is unnecessary. Ckpt runs only when the database has many data files and the lgwr significantly reduces the performance at the check point. The ckpt process does not write blocks to the disk. This task is completed by dbwr. The checkpoint_process parameter in the init. ora file controls the Enable or enable ckpt process. The default value is false.
Archiving process: backs up or archives a full log group during each log switch.
Service Process: User process service.
User process: On the client, the user is responsible for passing the user's SQL statement to the service process and retrieving the query data from the server segment.
5. SCN (system changenumber ):
System Change number, a serial number maintained by the system. It is automatically added when the system needs to be updated. It is an important indicator of maintaining data consistency and sequential recovery in the system.