当前位置:网站首页>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 .
边栏推荐
- 促进OKR落地的工作总结该如何写?
- Advanced MySQL: Basics (5-8 Lectures)
- Text processing function sorting in mysql, quick search of collection
- How to reset IntelliSense in vs Code- How to reset intellisense in VS Code?
- deno debugger
- L1-023 output gplt (20 points)
- 【性能测试】一文读懂Jmeter
- 真空介电常数和真空磁导率究竟是由什么决定的?为何会存在这两个物理量?
- Group programming ladder race - exercise set l2-002 linked list de duplication
- Famous blackmail software stops operation and releases decryption keys. Most hospital IOT devices have security vulnerabilities | global network security hotspot on February 14
猜你喜欢

Flask 常用组件
![[go basics] 1 - go go](/img/e2/d973b9fc9749e1c4755ce7d0ec11a1.png)
[go basics] 1 - go go

Easy to understand: understand the time series database incluxdb

神经网络入门(下)

Comprendre la méthode de détection des valeurs aberrantes des données

With excellent strength, wangchain technology, together with IBM and Huawei, has entered the annual contribution list of "super ledger"!

This article is enough for learning advanced mysql

Oceanbase is the leader in the magic quadrant of China's database in 2021
![[Gurobi] 简单模型的建立](/img/3f/d637406bca3888b939bead40b24337.png)
[Gurobi] 简单模型的建立

Common components of flask
随机推荐
snipaste 方便的截图软件,可以复制在屏幕上
Thesis learning -- time series similarity query method based on extreme point characteristics
JVM -- class loading process and runtime data area
【性能測試】一文讀懂Jmeter
What does range mean in PHP
Go h*ck yourself:online reconnaissance (online reconnaissance)
I was pressed for the draft, so let's talk about how long links can be as efficient as short links in the development of mobile terminals
Google's official response: we have not given up tensorflow and will develop side by side with Jax in the future
[test de performance] lire jmeter
[performance test] read JMeter
Activiti常见操作数据表关系
The second session of the question swiping and punching activity -- solving the switching problem with recursion as the background (I)
Comparison between applet framework and platform compilation
1. Getting started with QT
1. Qt入门
AcWing 244. Enigmatic cow (tree array + binary search)
es6总结
PHP session variable passed from form - PHP
A single element in an ordered array
团体程序设计天梯赛-练习集 L2-002 链表去重