当前位置:网站首页>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 .
边栏推荐
- Put a lantern on the website during the Lantern Festival
- L1-025 positive integer a+b (15 points)
- 深入浅出:了解时序数据库 InfluxDB
- PCIe knowledge points -010: where to get PCIe hot plug data
- Figure guessing game
- 1、卡尔曼滤波-最佳的线性滤波器
- 谷歌官方回应:我们没有放弃TensorFlow,未来与JAX并肩发展
- Advanced MySQL: Basics (5-8 Lectures)
- Google's official response: we have not given up tensorflow and will develop side by side with Jax in the future
- The second session of the question swiping and punching activity -- solving the switching problem with recursion as the background (I)
猜你喜欢
PCIE知识点-010:PCIE 热插拔资料从哪获取
AcWing 244. Enigmatic cow (tree array + binary search)
线性代数1.1
BUUCTF(4)
Unity text superscript square representation +text judge whether the text is empty
Moher college phpMyAdmin background file contains analysis traceability
L1-027 rental (20 points)
Famous blackmail software stops operation and releases decryption keys. Most hospital IOT devices have security vulnerabilities | global network security hotspot on February 14
弈柯莱生物冲刺科创板:年营收3.3亿 弘晖基金与淡马锡是股东
zabbix监控系统邮件报警配置
随机推荐
What does range mean in PHP
Parallel shift does not provide any acceleration - C #
How to use C language code to realize the addition and subtraction of complex numbers and output structure
一文了解数据异常值检测方法
Is l1-029 too fat (5 points)
How does dataframe calculate the average value of each row as another column
Book list | as the technical support Party of the Winter Olympics, Alibaba cloud's technology is written in these books!
Azure ad domain service (II) configure azure file share disk sharing for machines in the domain service
Thesis learning -- time series similarity query method based on extreme point characteristics
SQL statement view SQL Server 2005 version number
Activiti常見操作數據錶關系
PHP converts seconds to timestamps - PHP
Convert datetime string to datetime - C in the original time zone
Common components of flask
1. Kalman filter - the best linear filter
Famous blackmail software stops operation and releases decryption keys. Most hospital IOT devices have security vulnerabilities | global network security hotspot on February 14
Li Kou today's question -1200 Minimum absolute difference
L1-021 important words three times (5 points)
BUUCTF(4)
How to get bytes containing null terminators from a string- c#