当前位置:网站首页>DM8 uses different databases to archive and recover after multiple failures
DM8 uses different databases to archive and recover after multiple failures
2022-07-04 08:12:00 【Song Xiaorong】
This chapter is an introduction. DM8 The database recovers after many failures , The latest database is not backed up , How to use the previous backup file to restore to the latest state of the database .
Use different archives for recovery after multiple failures
01
Backup database
Want to restore and recover in case of database failure , There must be backup files , Here is a most original database backup file , have access to DMRMAN Backup , It can also be an online backup file . Take online backup as an example .
Query the magic number of the database :
SQL> select db_magic;
Line number DB_MAGIC
---------- --------------------
1 2098604336
Backup database :
SQL> backup database full backupset 'DMAMENGFULL_DMRMAN0716';
02
Manufacturing data , Generate archive logs 1
Use DMHR Connect to the login database , Use the following command to create a table t_table1, This process generates archive logs 1.
SQL> create table dmhr.t_table1 as select * from dmhr.employee;
03
Analog fault , Delete data file
Analog fault , perform rm DMHR.DBF Delete data file
04
Restore the database with backup files and archived logs
To the latest state ( Status before failure )
Stop database , Use DMRMAN Restore 、 Restore the database and update the magic number of the database . The following three steps are a typical way to restore and recover a single database failure using archived files .
RMAN> restore database '/dm8/data/DAMENG/dm.ini' from backupset 'DMAMENGFULL_DMRMAN0716';
RMAN> recover database '/dm8/data/DAMENG/dm.ini' with archivedir '/dm8/arch';
RMAN> recover database '/dm8/data/DAMENG/dm.ini' update db_magic;
05 Open database , Manufacturing data , Generate
Archive logs after database recovery 2
Open database , Query database DMHR Next t_table1 There is , The data is correct , It indicates that the database has been restored to the latest state . Execute the following command to view DB_MAGIC, You can see DB_MAGIC Has changed .
SQL> select db_magic;
Line number DB_MAGIC
---------- --------------------
1 813815328
Use DMHR Connect to the login database , establish t_table2 surface , Generate archive logs after database recovery 2.
SQL> create table dmhr.t_table2 as select * from dmhr.employee;
06
Analog fault , Delete data file
Analog fault , perform rm DMHR.DBF Delete data file
07
Follow the steps 1 Backup files and twice
Archive log restore and restore database
Because we didn't back up after the first restore , So it can only be based on steps 1 Restore the backup file generated in , Of course, if we are in step after the first failure 4 After recovery, the backup was done normally , The recovery at this time will also be very simple , Direct use procedure 4 Single fault recovery operation is ok . But because there are only steps 1 Backup files for , Experienced two failures in the middle , So we are going to talk about cross database ( Magic number across databases ) recovery , The recovery steps are as follows :
① Use steps 1 Restore the backup file of
Execute the following command to use the steps 1 Restore the database to the state at the time of backup :
RMAN> restore database '/dm8/data/DAMENG/dm.ini' from backupset 'DMAMENGFULL_DMRMAN0716';
② Use steps 2 Archive logs generated 1 Recover to the first failure state
Execute the following command , Appoint with archivedir Parameter use archive recovery , When recovering from an archive , By default, the target library's db_magic, At this point, the target library db_magic The value is replaced by step 1 Backup set source library db_magic, So steps are used 2 Archive logs generated .
RMAN> recover database '/dm8/data/DAMENG/dm.ini' with archivedir '/dm8/arch';
③ Use steps 5 Archive logs generated 2 Restore to the latest state
Execute the following command , Use use db_magic Parameters , Appoint db_magic The value is to be restored to the archive db_magic value ( That is, use steps 5 Of db_magic, Use steps 5 Archive recovery generated ), Restore the data to step 6 Status before failure .
RMAN> recover database '/dm8/data/DAMENG/dm.ini' with archivedir '/dm8/arch' use db_magic 813815328;
④ Update database magic number
Execute the following command to update the magic number of the database db_magic Information .
RMAN> recover database '/dm8/data/DAMENG/dm.ini' update db_magic;
here , Database recovery complete , Open database , You can see dmhr Next t_table2 The table exists and the data is accurate . If you query the magic number of the database , You can see db_magic Updated .
Use dmrachk Tool View db_magic Information
Actually in the database of the current network , Unable to start after multiple database failures , We may not know the magic number information in the database every time . have access to dmrachk The tool checks db_magic Information . perform dmrachk help You can check the usage of this tool .
Execute the following command to view the archive log information , The red part is the magic number of the database .
dmrachk arch_fil=ARCHIVE_LOCAL1_0x51FA5B48[0]_2020-07-16_14-49-56.log
Checked the archive log db_magic Information , Then execute the 7 Step by step ③ Use use magic You can specify the archive log file recovery of the magic number of the database .
good , The above is the content of this sharing .
summary :
In case of multiple failure recovery , You can specify use db_magic Parameter recover database multiple times , Until it is restored to the latest state .
When using archive recovery, attention should be paid to ensuring the continuity of archive log files , If the database closes the archive in the middle and then reopens the archive , Or the archive log file is lost, causing the archive log to be discontinuous , The database cannot be restored to the latest state .
边栏推荐
- Const string inside function - C #
- PCIe knowledge points -010: where to get PCIe hot plug data
- [gurobi] establishment of simple model
- Common components of flask
- 力扣今日题-1200. 最小绝对差
- 如何用MOS管来实现电源防反接电路
- Take you to master the formatter of visual studio code
- 墨者学院-Webmin未经身份验证的远程代码执行
- Tri des fonctions de traitement de texte dans MySQL, recherche rapide préférée
- Moher College webmin unauthenticated remote code execution
猜你喜欢
Take you to master the formatter of visual studio code
【Go基础】2 - Go基本语句
[network security] what is emergency response? What indicators should you pay attention to in emergency response?
如何用MOS管来实现电源防反接电路
一文了解數據异常值檢測方法
Thesis learning -- time series similarity query method based on extreme point characteristics
弈柯莱生物冲刺科创板:年营收3.3亿 弘晖基金与淡马锡是股东
Advanced MySQL: Basics (5-8 Lectures)
[go basics] 2 - go basic sentences
Ecole bio rushes to the scientific innovation board: the annual revenue is 330million. Honghui fund and Temasek are shareholders
随机推荐
神经网络入门(下)
1. Kalman filter - the best linear filter
Group programming ladder race - exercise set l2-002 linked list de duplication
真空介电常数和真空磁导率究竟是由什么决定的?为何会存在这两个物理量?
MySQL中的文本處理函數整理,收藏速查
Sort by item from the list within the list - C #
Introduction to neural network (Part 2)
Put a lantern on the website during the Lantern Festival
Leetcode 23. 合并K个升序链表
Moher College phpmailer remote command execution vulnerability tracing
[go basics] 2 - go basic sentences
Take you to master the formatter of visual studio code
Sports [running 01] a programmer's half horse challenge: preparation before running + adjustment during running + recovery after running (experience sharing)
Add log file to slim frame - PHP
Redis sentinel mechanism
[test de performance] lire jmeter
L1-027 rental (20 points)
Heap concept in JVM
How to improve your system architecture?
Example analysis of C # read / write lock