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)06/01 Report--
one。 Control file
1. The role of control file in database startup for dna, oracle database control file is a very important file. It is a binary file automatically generated when the database is created, in which the status information of the database is recorded. No other user can modify the control file, only when the database is running, the database instance can modify the information in the control file. The control file mainly includes the following contents:
N database name, a control file can only belong to one database.
N time when the database was created.
N name, location, online and offline status information of the data file.
N name, location and archive information of the redo log file.
N all tablespace information.
N current log serial number.
N recent checkpoint information.
two。 The control file is read during the mount phase of database startup. The relationship between database startup and control file is shown in the following figure:
3.
The control file stores the information of creating database, redo log, data file and archived log record and so on. This valuable information is used for data maintenance and management, and many data dictionary views are information obtained from control files.
4.
3. Store multiple control files
Because the control file is very important, it requires that there can be not only one control file, usually more than 3 control files in the database, and stored on different disks. This method of using control files is also known as the multiplexing of control files. One way to achieve multiple is to copy the control file to multiple locations and modify the CONTROL_FILES parameter in the initialization parameter file to include all the control file names.
Manage redo log files
1. Function:
In order to improve disk efficiency and prevent damage to redo log files
two。 Principle:
The redo log file, also known as the online redo log, is designed to recover data.
During the operation of the database, the data changed by the user will be temporarily stored in the high-speed buffer of the database. In order to improve the speed of writing to the database, it is not necessary to write the changed data to the database file as soon as the data changes. Frequently reading and writing disks will reduce the efficiency of the database system, so when the data in the database high-speed buffer reaches a certain amount or meets certain conditions, the DBWR process will write the changed data to the data file. In this case, if there is an outage before DBWR writes the changed changes to the data file, all data in the database cache will be lost. It is obviously not possible if the data changed by this part of the user cannot be recovered after the database server is restarted.
The redo log is to save the changed data first, in which the LGWR process is responsible for writing the user-changed data to the redo log file first, so that when the database is restarted, the database system reads the changed data from the redo log file, submits the user-changed data to the database, and writes to the data file.
3.
A redo log file structure, as shown in the figure:
As can be seen in the figure above, there are three redo log groups, each containing two redo log members. When the first log group is full, it stops writing and moves to the second log group. When the second log group is full, it goes to the third log group, and the third log group is written to the first log group. Oracle uses the redo log group in this cycle.
Oracle stipulates that each database has at least two log groups, and each group contains at least one or more log members.
Before using the new redo log, the DBWR process needs to write all data changes to the data file. If the database is in archive mode, when a group of days switch occurs, the archiving process ARCH copies the data from the currently full redo log file to the archive log.
The log file size is generally appropriate in 10M-50M.
three。
Log switching and checkpoint events
Log switching is to stop the current log group and write another new log group. The system can switch automatically or manually. When the log switch occurs, the system will complete the checkpoint operation in the background to reduce the recovery time of the instance.
A checkpoint is an event that reduces the time for instance recovery. When a checkpoint occurs, it triggers the DBWR process to write the changed data in the data cache to the data file, while the checkpoint process updates the control file and the data file header to keep them consistent. A checkpoint is actually a background process that ensures that everything in the modified database buffer is written to the database file.
The more frequent the checkpoint time, the less data in the reuse logs that need to be recovered in the event of a database failure (because at the time of recovery, you do not have to check the data in the reuse logs before the recovery checkpoint). So the time for instance recovery is reduced.
Startup time:
N every three seconds (or more frequently)
N Log switching occurs
N when the immediate option closes the routine
N Manual request
Responsible for the following matters:
N Update the data file title with checkpoint information
N Update the control file with checkpoint information
N signal to DBWn at the completion checkpoint
five。 Manage archive log files
1. Introduction to archived logs
There are two operation modes of Oracle database, ARCHIVELOG mode and non-NO ARCHIVELOG mode. In non-archived mode, the previous redo log files are directly overwritten during log switching, and no archived logs are generated. The database runs in archived mode, and after the log switch, the ARCH process will archive the redo log files that it is full of. By default, oracle runs in a non-archived mode, mainly because the archiving mode will bring some performance problems to the system. The ARCH process exists only when the database is running in archived mode. The ARCH process is an optional background process for oracle, archiving the logs so that all changes made to the database can be saved in time in case the data file disk is damaged. The database administrator can also restore the database to the state it was in when the failure occurred.
1) archiving process
N is an optional background process
N online redo log files are automatically archived when ARCHIVELOG mode is set for the database
N keep a record of all changes to the database
2) Archive log files
The n database generates a copy of the online redo log group before allowing the redo log information to be overwritten.
N these copies are also known as "archive logs".
, configure database archive log steps:
N query database archiving mode to make sure that it is not currently in archiving mode
N shut down the database and start the database to MOUNT state
N set the database to bit archive mode and verify
six。 Data dictionary
1. Data dictionary definition
A data dictionary is a collection of tables and views in which oracle stores key information. Is a description of the database, containing the names and properties of all objects in the database.
1. The composition of the data dictionary
Data dictionary is divided into data dictionary table and data dictionary view. The tables in the data dictionary cannot be accessed directly, but the views in the data dictionary can be accessed. Data dictionary views are divided into two categories: static data dictionary view and dynamic data dictionary view.
1) data dictionary table
The data in the data dictionary table is the system data stored in the oracle system, while the ordinary table stores the user's data. To make it easy to distinguish between these tables, the names of these tables end with $, and they belong to the SYS user.
In order to facilitate the query of data dictionary tables, oracle establishes user views for these data dictionaries respectively, which is not only easy to remember, but also hides the relationship between data dictionary tables.
2) static data dictionary view
Views in static data dictionaries are divided into three categories, each of which consists of three prefixes: USER_*, ALL_*, and DBA_*.
N USER_*: this view stores information about objects owned by the current user (that is, all objects in that user mode).
N ALL_*: this view stores information about objects that the current user can access. (compared to USER_*, ALL_* does not need to own the object, only needs to have access to it).
N DBA_*: this view stores information about all objects in the database (provided that the current user has access and generally must have administrator privileges).
VII. dynamic data dictionary view and use
1. Concept
Except for the three types of views in the static data dictionary, the other dictionary views are mainly V$ views, so named because they all start with V$ or GV$, and these views are constantly updated to reflect the health of the current instance and database. Dynamic performance table is used to record the activity of the current database, which only exists during the operation of the database. The actual information is taken from memory and control files. Dba can use dynamic views to monitor and maintain the database.
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.