In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "Oracle Architecture Analysis". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "Oracle Architecture Analysis".
What is an Oracle database?
As we all know, Oracle DataBase is a relational database management system (do not know what is a relational database of children's shoes self-google,baidu), similar products also have mySql,sqlServer, and so on. Very often, we will generally turn the system that carries our core data into a database server, but strictly speaking, Oracle DataBase is composed of two parts:
Example: an instance is a set of processes and memory structures initialized when the database is started
Database: a database refers to some physical files in which users store data.
That's why we generally say close and start the instance, load and unload the database.
From the concept of instance and database, we can know that the instance is temporary, it is just a set of logically divided memory structure and process structure, it will disappear with the closure of the database, and the database is actually a pile of physical files (control files, data files, log files, etc.), it is permanent (unless the disk is damaged). Databases and instances are usually one-to-one, which we call a single-instance architecture; of course, there are some complex distributed structures in which a database can handle multiple instances, such as Oracle's RAC (interested children's shoes can learn about it).
Second, the interactive process
Here is a diagram from the Internet that describes the general interaction flow of a single-instance architecture
1. User and user process interaction
User processes can be general client software, such as Oracle's sqlplus,sql developer, or some drivers, etc., all belong to user processes.
two。 User process interacts with server process
The server process is sometimes called the foreground process, of course, compared to the background process (database writer, log writer, etc., which will be mentioned later), the main function of the server process is to process the request of the user process connected to the current instance, execute the sql sent by the client and return the execution result. In the proprietary server structure, the user process and the server process are one-to-one, that is, when the listener listens to a request from the client, it will assign a corresponding server process to it. Another structure is the shared server, which is not a user process corresponding to a server process, but will be coordinated by the scheduler. I will not repeat the shared server connection in this article.
3. The server process interacts with the instance process 4. Instance interacts with the database process
The above describes some of the general interaction process when we do database connection operations. Next, let's look at the instance memory structure of Oracle
Instance memory structure and process structure
(because the memory structure is closely related to the process structure, the process will act on the corresponding memory area, for example, the database writer acts on the database buffer cache, and the log writer acts on the log buffer. Therefore, the memory structure and process structure will be described in cooperation with each other.)
The memory structure of oracle instance consists of two parts: SGA (system global area) and PGA (user global area). SGA is a shared memory area and the largest memory area, while PGA is a memory area specific to user sessions, and each session has a dedicated memory area on the server side, that is, PGA. This paper mainly analyzes and describes SGA. The composition of SGA is as follows
Database buffer cache & database writer
Buffer cache is the work area that Oracle uses to execute sql. When updating data, the user session does not update the data on disk directly. Think about it, if this is allowed, the impact of frequent disk IO on system performance is devastating. So, the actual processing flow is as follows:
one
SQL > alter system checkpoint
Checkpoints can force DBWn to write to dirty buffers. When the database crashes, because a large number of dirty buffers are not written to data files, instance recovery needs to be restored by SMON, and instance recovery needs to extract and apply redo log records, which starts from the location where the last checkpoint was initiated (the data before the checkpoint has been forced to be written to the data file) This location is called RBA (redo byte address), and CKPT constantly updates this location to the control file (to determine where to start extracting log records for instance recovery).
MMON (Manageability Monitor)
Database self-monitoring and self-tuning support process. When the instance is running, it collects a large number of statistical data about instance activity and performance, which are collected into SGA. MMON regularly captures these statistics from SGA and writes them into the data dictionary to facilitate subsequent analysis of these snapshots. (by default, MMON collects snapshots every other hour)
ARCn (Archiver)
The archiving process, which is optional, is required if the database is configured in archiving mode. The so-called archiving is to permanently save the redo log file (the production library is generally configured in archive mode) into the archived log file. The archive log file serves the same purpose as the redo log file, except that the redo log file is rewritten, while the archive log file retains a complete history of data changes.
So far, we have a general understanding of the basic memory structure and process structure of Oracle. Let's take a look at the interaction between the completed process and memory, and we can concatenate the whole interaction process according to the previous understanding.
Fourth, Oracle storage structure
The Oracle storage structure will be described from two dimensions: physical storage structure and logical storage structure.
Physical storage structure
The so-called external files mean that these files are not strictly part of the Oracle database.
Control file:
The control file is small, but important. It contains pointers to the rest of the database (including the location of redo log files, data files, archive log files, etc.), stores important serial numbers and timestamps, and stores RMAN backup details. Once the control file is damaged, the instance will be terminated immediately. generally, the data file is protected by multiplexing mechanism, that is, redundant copies in different physical locations.
Redo log file
The role of redo log files is mentioned when explaining memory and process structure. Redo logs store a series of change vectors applied to the database in chronological order (including online redo log files and archive log files). The instance recovery automatically performed by SMON at database startup and the extraction backup recovery required by disk corruption will be applied to the redo log for corresponding data recovery.
Redo log files are also recommended for multiplexing, with at least two sets of redo log files in a database. One group is for LGWR to write. The log files are of a fixed size, and the business peak will soon be full. When the log files are full, they will be switched to the second group. In the database configured for archiving mode, the archiving process (ARCn) starts to archive and backup the contents of the first group, thus writing and archiving in a cycle. It is important to note that LGWR is not allowed to rewrite the logs of the current group until the archiving process has finished archiving them.
Data file
Data files store the actual data, DBWn will write the contents of the database buffer to such files, the size and number of data files are unlimited. Starting with Oracle 10g, creating a database requires at least two data files, one for the SYSTEM table space, which is used to store the data dictionary, and one for the SYSAUX table space, which is used to store some auxiliary data for the data dictionary.
The data file consists of Oracle blocks, which is the basic unit of Oracle, which is different from the operating system block. The Oracle block is larger than the operating system block. Of course, there are some performance considerations, but we consider this situation. When the user uses the operating system command to backup the data files (suppose 1 Oracle block = 8 operating system blocks), four operating system blocks have been copied. Then CPU is preempted by DBWn, and DBWn updates the Oracle block again. At this time, when the copy command gets CPU time to copy the remaining four blocks, the data of the entire Oracle block is inconsistent. So, this is also the reason why you need to do some extra processing when performing this kind of backup (user backup), such as setting the tablespace to backup mode. Of course, there is no such problem with using RMAN, and RMAN's backup mechanism is sure to get data-consistent blocks. (this piece of content can be understood.)
For the protection of data files, you can generally make regular backups, or you can use RAID.
Instance parameter file
This file stores some parameter settings required by the database, such as the size of each memory area, the maximum number of processes allowed, the maximum number of sessions, the location of the control file, the name of the database, and so on. The parameter file is also the first file to be loaded when the instance starts.
Password file
It is commonly called an external password file. General user names and passwords are stored in the data dictionary, not in this file. In some special scenarios, such as when the instance has not been started, I may need to log in to the system as an administrator to perform some recovery or start operations. However, the data dictionary does not exist because the instance has not been started. At this time, an external password file is required to verify the user's identity.
Archive log file
ARCn's online redo log files are backed up and archived into such files, and the archive log files retain the complete history of data changes.
Logical storage structure
Oracle abstracts its physical structure from the logical storage structure, the physical mechanism can be seen by the system administrator, and the logical structure can be perceived by users. The typical logical structures are "segments" and "tablespaces".
Paragraph:
A segment is a logical structure that contains all the data. A typical segment is a "table", called a table segment, as well as index segments, undo segments, and so on.
Tablespace
Table space is logically a combination of multiple segments and physically a collection of multiple data files, which is equivalent to adding an intermediate layer in the correspondence between segments and data files to solve this many-to-many relationship.
In some early database designs, there is an one-to-one relationship between segments and data files, one segment at a time. This design has many drawbacks. First of all, the number of segments is not fixed. It is possible that there are thousands of tables in a system. Thousands of data files are needed. The system administrator will certainly freak out if he wants to manage so many files. There is also a situation where some history tables may be so large that it is certainly not possible to use a data file to host a single file as large as the underlying system limits on a single file. Tablespaces solve this problem perfectly.
There are also some logical structures such as intervals and Oracle blocks (Oracle blocks are mentioned earlier, and intervals are a collection of blocks). Here is a diagram to get an overall understanding of the storage structure of Oracle to further deepen our understanding.
Thank you for reading, the above is the content of "Oracle Architecture Analysis". After the study of this article, I believe you have a deeper understanding of Oracle architecture analysis, and the specific usage needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.