In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Today, I really benefited a lot from DAVE's explanation of the backup principle of RMAN. I was only able to use the tool skillfully before, but I didn't know why. Today, I finally have an in-depth understanding of the backup principle of RMAN.
The following is my personal arrangement of the content of DAVE and the articles on the Internet.
Note: this article only explores the backup principle of RMAN, and does not talk about how to back up the database.
The component RMAN of RMAN is the concrete implementation of SMR (Server Managed Recovery: server Management recovery). RMAN mainly consists of two parts: executable file rman.exe and recover.bsq file rman.exe, like most exe files, is the startup file of rman, such as: when we execute rman target /, it is through the rman.exe connection that the rman recover.bsq file is actually a library file, and the rman program parses the code from the recover.bsq file to create PL/SQL calls executed on the target database. For example, if we issue backup database after logging in to rman, rman will parse the PL/SQL code block in the recover.bsq file according to this statement and let the database execute. So rman just plays a coordinating role and doesn't really work. User rights for RMAN in oracle 11g, rman is connected to the database through sys permissions because rman requires access to sys users on the target database and permission to start and shut down data. However, usually we can connect directly to rman target / connection, even if rman is not sys permission, that is because it is the same as sqlplus / as sysdba, which is operating system authentication. If rman does not have sys permission and makes a remote connection, it will definitely report an error of insufficient permission. In 12c, rman permissions have changed again. RMAN and the control file 1.rman read the information in the control file directly. The control file records the backup information of rman. The control file is divided into two parts: the immutable part records the data file, the path of the log file, the file name, the tablespace information, the database name and so on. This part of the data will not be overwritten. RMAN is to facilitate the backup and recovery of the database by reading this part of the information. Variable part when our RMAN is nocatalog mode, the information backed up by RMAN (including backup records, backup start and end time checkpoints) is recorded in this section, of course, this part also records a lot of other information. But when this part of the information is full, and the outside still needs to write data to this part, then you need to overwrite the information, including the backup information of RMAN. In order not to overwrite our backup information, we need to set the following parameter: controlfile_record_keep_time: this parameter specifies how many days the backup information of RMAN will not be overwritten in the control file. Show parameter control SQL > show parameter control _ file_record_keep_time
NAME TYPE VALUE-control_file_record_keep_time integer 7
Oracle defaults to 7 days, but the specific number of days should be set according to our backup plan during production. Snapshot control file RMAN needs to read a consistent control file when backing up, but the control file is an IO file that is more frequent and will inevitably be modified in the backup process. If we lock the control file in the backup process to achieve this purpose, it will be a tragedy. A lot of business in the database will not work properly. Therefore, Oracle solves this problem through snapshot control files. When we perform a backup with RMAN, a snapshot control file is generated under $ORACLE/dbs. [oracle@potato dbs] $ll total 9556-rw-rw---- 1 oracle oinstall 1544 Jul 26 15:09 hc_orcl.dat-rw-r--r-- 1 oracle oinstall 2851 May 15 2009 init.ora-rw-r- 1 oracle oinstall 24 Jul 26 15:13 lkORCL-rw-r- 1 oracle oinstall 1536 Jul 26 15:38 orapworcl-rw-r- 1 oracle oinstall 9748480 Jan 13 23:25 snapcf_orcl.f-rw-r -1 oracle oinstall 2560 Jan 13 23:18 spfileorcl.ora as above Snapcf_orcl.f is the snapshot control file, and RMAN reads the information in the file instead of actually controlling the contents of the file. Solve the problem effectively. 、
The RMAN server process rman creates two server processes when it connects to the client of the target library:
Main process: generate calls to the sys package to perform backup and restore operations and coordinate work.
Secondary process: polls rman's long transactions and records information internally.
The two packets RMAN channel service processes invoked by RMAN access two sys packets, BMS_RCVMAN and DBMS_BACKUP_RESTORE, which contain all the functions that rman operates in the target library. These two packages are installed by running the cataproc.sql script when the database is created, and they are hard-coded into the library file of the Oracle software, so these packages can be called even if the database is not open.
SYS.DBMS_RCVMAN is used to access the control file and validate the necessary information, and passes this information to the rman service process, which creates a pl/sql block based on the code in the recover.bsq file. These pl/sql blocks call SYS.DBMS_BACKUP_RESTORE to back up data files, control files, and archived redo log. After the backup set is complete, SYS.DBMS_BACKUP_RESTORE records the backup information in the control file.
After the backup of the RMAN backup process starts, establish a channel process (which should be the default setting now), because the channel program is assigned in the pga because no iUnix slaves are used. The main process of rman parses the database structure information (determining the target library version and control file information (type, current serial number, creation time) from the target library control file by compiling a DBMS_RCVMAN call. After compiling the file list, RMAN creates a snapshot control file, rman creates a call to DBMS_BACKUP_RESTORE, and allocates input and output buffers (memory) based on the number of data files. After the memory is allocated, rman initializes the backup slice, which is given a unique default name. When the backup slice is initialized, the channel process starts the database backup. Rman determines whether parameter files and control files need to be backed up. After that, rman creates a call to DBMS_BACKUP_RESTORE and allocates input and output buffers (memory) based on the number of data files. After the memory is allocated, rman initializes the backup slice, which is given a unique default name. After completing the backup of control file system and spfile, the channel process begins to read the data file and input the data block into the output buffer to write to the memory of the output buffer. During this write operation, the expiration of the term determines whether the block is initialized or whether the data block header information is zero. If the block has been used (the block information is not 0, if the block information is 0, the block can be discarded or not written, which is one of the advantages of RMAN), rman will perform a validation operation on the block. If the block and footer do not match, rman indicates the corrupted block and terminates the backup. For example, the data block is pushed into the output buffer. Generally, when the output buffer is full, the contents of the output buffer will be transferred to the backup file location. When all files are filtered through the memory buffer, the backup slice is completed, and RMAN writes backup information to the control file of the target database.
Note: some of the above content comes from the network.
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.