当前位置:网站首页>RMAN incremental recovery example (1) - without unbacked archive logs
RMAN incremental recovery example (1) - without unbacked archive logs
2022-07-02 07:04:00 【Virtuous time】
Scene demonstration , Simulate weekend evenings 0 Full preparation , Every night from Monday to Saturday 1 Level backup , If the machine crashes on Wednesday , You need to recover all data as much as possible .
Get back to thinking : Will be on the weekend 0 Level full backup, incremental backup from Monday to Tuesday, and archiving without backup ( If you can find them, they are all in one folder ), Then register , And then recover .rman It will automatically set all backups in the file and then automatically restore .
All available on weekends
– First 0 Full preparation , Insert all data
-- as follows sql To simulate business data insertion
DROP TABLE rman_validate;
CREATE TABLE rman_validate(ID NUMBER, event_desc VARCHAR2(200), insert_time DATE DEFAULT SYSDATE);
INSERT INTO rman_validate
(ID, event_desc, insert_time)
VALUES
(1, ' The weekend database is complete ', SYSDATE);
ALTER system archive log CURRENT; -- Then archive the log
SELECT * FROM rman_validate;
[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-53xm0a9Q-1641457513448)(https:/gitee.com/yangshixian/pic/raw/master/20220105215818.png#pic_center)]
perform 0 Level backup
configure default device type to disk;
configure device type disk parallelism 5 BACKUP TYPE TO COMPRESSED BACKUPSET;
configure channel device type disk maxopenfiles 50 maxpiecesize 32G;
configure controlfile autobackup on;
configure backup optimization on ;
set controlfile autobackup format for device type disk to '/data/oracle/rman_data/db0/C0_%d_%F';
run
{
sql 'alter system archive log current';
backup incremental level 0 database tag='Sunday-L0-FULLBAK'
format '/data/oracle/rman_data/db0/DB0_%d_%T_S%s_P%p'
filesperset=50;
sql 'alter system archive log current';
backup format='/data/oracle/rman_data/db0/AL0_%d_%T_S%s_P%p'
archivelog all not backed up 1 times
skip inaccessible
delete all input;
}
Monday to Friday 1 Level incremental backup
Monday Monday
-- On Monday 1 Level incremental backup
INSERT INTO rman_validate
(ID, event_desc, insert_time)
VALUES
(2, ' Monday 1 Level Iterative Incremental Backup ', SYSDATE);
SELECT * FROM rman_validate;
Conduct 1 Level backup
configure default device type to disk;
configure device type disk parallelism 5 BACKUP TYPE TO COMPRESSED BACKUPSET;
configure channel device type disk maxopenfiles 50 maxpiecesize 32G;
configure controlfile autobackup on;
configure backup optimization on ;
set controlfile autobackup format for device type disk to '/data/oracle/rman_data/db1/C1_%d_%F';
run
{
sql 'alter system archive log current';
backup incremental level 1 database tag='Monday-daily_db1'
format '/data/oracle/rman_data/db1/DB1_%d_%T_S%s_P%p'
filesperset=50;
sql 'alter system archive log current';
backup format='/data/oracle/rman_data/db1/AL1_%d_%T_S%s_P%p' tag='Monday-daily_log'
archivelog all not backed up 1 times
skip inaccessible
delete all input;
}
Tuesday Tuesday
-- On Tuesday 1 Level incremental backup
INSERT INTO rman_validate
(ID, event_desc, insert_time)
VALUES
(3, ' Tuesday 1 Level Iterative Incremental Backup ', SYSDATE);
commit;
SELECT * FROM rman_validate;
Conduct 1 Level backup
configure default device type to disk;
configure device type disk parallelism 5 BACKUP TYPE TO COMPRESSED BACKUPSET;
configure channel device type disk maxopenfiles 50 maxpiecesize 32G;
configure controlfile autobackup on;
configure backup optimization on ;
set controlfile autobackup format for device type disk to '/data/oracle/rman_data/db1/C1_%d_%F';
run
{
sql 'alter system archive log current';
backup incremental level 1 database tag='Tuesday-daily_db1'
format '/data/oracle/rman_data/db1/DB1_%d_%T_S%s_P%p'
filesperset=50;
sql 'alter system archive log current';
backup format='/data/oracle/rman_data/db1/AL1_%d_%T_S%s_P%p' tag='Tuesday-daily_log'
archivelog all not backed up 1 times
skip inaccessible
delete all input;
}
View Backup
RMAN> list backup of database summary;
List of Backups
===============
Key TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
58 B 0 A DISK 05-JAN-22 1 1 YES L0_FULLBAK
59 B 0 A DISK 05-JAN-22 1 1 YES L0_FULLBAK
60 B 0 A DISK 05-JAN-22 1 1 YES L0_FULLBAK
61 B 0 A DISK 05-JAN-22 1 1 YES L0_FULLBAK
62 B 0 A DISK 05-JAN-22 1 1 YES L0_FULLBAK
63 B 0 A DISK 05-JAN-22 1 1 YES L0_FULLBAK
64 B 0 A DISK 05-JAN-22 1 1 YES L0_FULLBAK
65 B 0 A DISK 05-JAN-22 1 1 YES L0_FULLBAK
66 B 0 A DISK 05-JAN-22 1 1 YES L0_FULLBAK
67 B 0 A DISK 05-JAN-22 1 1 YES L0_FULLBAK
68 B 0 A DISK 05-JAN-22 1 1 YES L0_FULLBAK
69 B 0 A DISK 05-JAN-22 1 1 YES L0_FULLBAK
76 B 0 A DISK 05-JAN-22 1 1 YES SUNDAY-L0-FULLBAK
77 B 0 A DISK 05-JAN-22 1 1 YES SUNDAY-L0-FULLBAK
78 B 0 A DISK 05-JAN-22 1 1 YES SUNDAY-L0-FULLBAK
79 B 0 A DISK 05-JAN-22 1 1 YES SUNDAY-L0-FULLBAK
80 B 0 A DISK 05-JAN-22 1 1 YES SUNDAY-L0-FULLBAK
81 B 0 A DISK 05-JAN-22 1 1 YES SUNDAY-L0-FULLBAK
82 B 0 A DISK 05-JAN-22 1 1 YES SUNDAY-L0-FULLBAK
83 B 0 A DISK 05-JAN-22 1 1 YES SUNDAY-L0-FULLBAK
84 B 0 A DISK 05-JAN-22 1 1 YES SUNDAY-L0-FULLBAK
90 B 1 A DISK 05-JAN-22 1 1 YES MONDAY-DAILY_DB1
91 B 1 A DISK 05-JAN-22 1 1 YES MONDAY-DAILY_DB1
92 B 1 A DISK 05-JAN-22 1 1 YES MONDAY-DAILY_DB1
93 B 1 A DISK 05-JAN-22 1 1 YES MONDAY-DAILY_DB1
99 B 1 A DISK 05-JAN-22 1 1 YES TUESDAY-DAILY_DB1
100 B 1 A DISK 05-JAN-22 1 1 YES TUESDAY-DAILY_DB1
101 B 1 A DISK 05-JAN-22 1 1 YES TUESDAY-DAILY_DB1
102 B 1 A DISK 05-JAN-22 1 1 YES TUESDAY-DAILY_DB1
Simulate machine crash
Shut down the database normally
SQL> shutdown immediate
Change the database directory and name , To start the
SQL> startup
ORACLE instance started.
Total System Global Area 2516582192 bytes
Fixed Size 9137968 bytes
Variable Size 805306368 bytes
Database Buffers 1694498816 bytes
Redo Buffers 7639040 bytes
ORA-00205: error in identifying control file, check alert log for more info
# No accident, the control file error is reported , Restore at this time
Make a full recovery
Rebuild an original folder with the same name as the folder used in the original database
SQL> startup nomount
-- Restore control files
RESTORE CONTROLFILE FROM '/data/oracle/rman_data/rman_back_all/C1_ORCLCDB_c-2858197352-20220105-07'
-- Boot to mount
SQL> alter database mount;
-- Register the backup file address
catalog start with '/data/oracle/rman_data/rman_back_all/';
-- If you can still find the archive logs that have not been backed up , Then you can put the archived log in /data/oracle/rman_data/rman_back_all Under this catalog , And then use catlog Register this archive ( Or directly execute it once after placing it catalog start with It's fine too )
-- Resume
restore database;
-- Report the following error
Starting recover at 05-JAN-22
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
using channel ORA_DISK_4
using channel ORA_DISK_5
channel ORA_DISK_1: starting incremental datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00007: /data/oracle/oradata/ORCLCDB/users01.dbf
channel ORA_DISK_1: reading from backup piece /data/oracle/rman_data/db1/DB1_ORCLCDB_20220105_S107_P1
channel ORA_DISK_2: starting incremental datafile backup set restore
channel ORA_DISK_2: specifying datafile(s) to restore from backup set
destination for restore of datafile 00004: /data/oracle/oradata/ORCLCDB/undotbs01.dbf
channel ORA_DISK_2: reading from backup piece /data/oracle/rman_data/db1/DB1_ORCLCDB_20220105_S106_P1
channel ORA_DISK_3: starting incremental datafile backup set restore
channel ORA_DISK_3: specifying datafile(s) to restore from backup set
destination for restore of datafile 00001: /data/oracle/oradata/ORCLCDB/system01.dbf
channel ORA_DISK_3: reading from backup piece /data/oracle/rman_data/db1/DB1_ORCLCDB_20220105_S105_P1
channel ORA_DISK_4: starting incremental datafile backup set restore
channel ORA_DISK_4: specifying datafile(s) to restore from backup set
destination for restore of datafile 00003: /data/oracle/oradata/ORCLCDB/sysaux01.dbf
channel ORA_DISK_4: reading from backup piece /data/oracle/rman_data/db1/DB1_ORCLCDB_20220105_S104_P1
channel ORA_DISK_1: piece handle=/data/oracle/rman_data/db1/DB1_ORCLCDB_20220105_S107_P1 tag=MONDAY-DAILY_DB1
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:00
channel ORA_DISK_1: starting incremental datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00007: /data/oracle/oradata/ORCLCDB/users01.dbf
channel ORA_DISK_1: reading from backup piece /data/oracle/rman_data/db1/DB1_ORCLCDB_20220105_S116_P1
channel ORA_DISK_3: piece handle=/data/oracle/rman_data/db1/DB1_ORCLCDB_20220105_S105_P1 tag=MONDAY-DAILY_DB1
channel ORA_DISK_3: restored backup piece 1
channel ORA_DISK_3: restore complete, elapsed time: 00:00:00
channel ORA_DISK_3: starting incremental datafile backup set restore
channel ORA_DISK_3: specifying datafile(s) to restore from backup set
destination for restore of datafile 00001: /data/oracle/oradata/ORCLCDB/system01.dbf
channel ORA_DISK_3: reading from backup piece /data/oracle/rman_data/db1/DB1_ORCLCDB_20220105_S114_P1
channel ORA_DISK_2: piece handle=/data/oracle/rman_data/db1/DB1_ORCLCDB_20220105_S106_P1 tag=MONDAY-DAILY_DB1
channel ORA_DISK_2: restored backup piece 1
channel ORA_DISK_2: restore complete, elapsed time: 00:00:00
channel ORA_DISK_2: starting incremental datafile backup set restore
channel ORA_DISK_2: specifying datafile(s) to restore from backup set
destination for restore of datafile 00004: /data/oracle/oradata/ORCLCDB/undotbs01.dbf
channel ORA_DISK_2: reading from backup piece /data/oracle/rman_data/db1/DB1_ORCLCDB_20220105_S115_P1
channel ORA_DISK_4: piece handle=/data/oracle/rman_data/db1/DB1_ORCLCDB_20220105_S104_P1 tag=MONDAY-DAILY_DB1
channel ORA_DISK_4: restored backup piece 1
channel ORA_DISK_4: restore complete, elapsed time: 00:00:00
channel ORA_DISK_4: starting incremental datafile backup set restore
channel ORA_DISK_4: specifying datafile(s) to restore from backup set
destination for restore of datafile 00003: /data/oracle/oradata/ORCLCDB/sysaux01.dbf
channel ORA_DISK_4: reading from backup piece /data/oracle/rman_data/db1/DB1_ORCLCDB_20220105_S113_P1
channel ORA_DISK_1: piece handle=/data/oracle/rman_data/db1/DB1_ORCLCDB_20220105_S116_P1 tag=TUESDAY-DAILY_DB1
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:00
channel ORA_DISK_2: piece handle=/data/oracle/rman_data/db1/DB1_ORCLCDB_20220105_S115_P1 tag=TUESDAY-DAILY_DB1
channel ORA_DISK_2: restored backup piece 1
channel ORA_DISK_2: restore complete, elapsed time: 00:00:00
channel ORA_DISK_3: piece handle=/data/oracle/rman_data/db1/DB1_ORCLCDB_20220105_S114_P1 tag=TUESDAY-DAILY_DB1
channel ORA_DISK_3: restored backup piece 1
channel ORA_DISK_3: restore complete, elapsed time: 00:00:00
channel ORA_DISK_4: piece handle=/data/oracle/rman_data/db1/DB1_ORCLCDB_20220105_S113_P1 tag=TUESDAY-DAILY_DB1
channel ORA_DISK_4: restored backup piece 1
channel ORA_DISK_4: restore complete, elapsed time: 00:00:01
starting media recovery
channel ORA_DISK_1: starting archived log restore to default destination
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=105
channel ORA_DISK_1: reading from backup piece /data/oracle/rman_data/db1/AL1_ORCLCDB_20220105_S119_P1
channel ORA_DISK_2: starting archived log restore to default destination
channel ORA_DISK_2: restoring archived log
archived log thread=1 sequence=106
channel ORA_DISK_2: reading from backup piece /data/oracle/rman_data/db1/AL1_ORCLCDB_20220105_S120_P1
channel ORA_DISK_1: piece handle=/data/oracle/rman_data/db1/AL1_ORCLCDB_20220105_S119_P1 tag=TUESDAY-DAILY_LOG
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=/data/oracle/fast_recovery_area/ORCLCDB/archivelog/2022_01_05/o1_mf_1_105_jxccj8nj_.arc thread=1 sequence=105
channel default: deleting archived log(s)
archived log file name=/data/oracle/fast_recovery_area/ORCLCDB/archivelog/2022_01_05/o1_mf_1_105_jxccj8nj_.arc RECID=50 STAMP=1093214472
channel ORA_DISK_2: piece handle=/data/oracle/rman_data/db1/AL1_ORCLCDB_20220105_S120_P1 tag=TUESDAY-DAILY_LOG
channel ORA_DISK_2: restored backup piece 1
channel ORA_DISK_2: restore complete, elapsed time: 00:00:01
archived log file name=/data/oracle/fast_recovery_area/ORCLCDB/archivelog/2022_01_05/o1_mf_1_106_jxccj8nm_.arc thread=1 sequence=106
channel default: deleting archived log(s)
archived log file name=/data/oracle/fast_recovery_area/ORCLCDB/archivelog/2022_01_05/o1_mf_1_106_jxccj8nm_.arc RECID=51 STAMP=1093214472
unable to find archived log
archived log thread=1 sequence=107
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 01/05/2022 22:41:14
RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 107 and starting SCN of 8105365
RMAN>
Solve mistakes :
RMAN> recover database until scn 8105365;
Starting recover at 06-JAN-22
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=135 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=14 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=132 device type=DISK
allocated channel: ORA_DISK_4
channel ORA_DISK_4: SID=9 device type=DISK
allocated channel: ORA_DISK_5
channel ORA_DISK_5: SID=133 device type=DISK
starting media recovery
media recovery complete, elapsed time: 00:00:00
Finished recover at 06-JAN-22
RMAN> alter database open resetlogs;
Statement processed
Verify the recovery effect
Query the database
[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-MEHPWSZx-1641457290476)(%21%5B%5D%28https:/gitee.com/yangshixian/pic/raw/master/20220106112928.png%29)]
References and commands
### Delete all rman Backup
delete backupset; # Delete all backups
### Manual archive command
alter system archive log current;
alter system switch logfile
difference :https://blog.csdn.net/fred_yang2013/article/details/45171283
### Delete archive command
# Delete the backup archive
delete archivelog all completed before 'sysdate-7';
# Delete whether it is backed up or not
delete archivelog until time 'sysdate-1' ;
# Delete all archives, whether backed up or not
delete archivelog ALL;
# View all backup archives
list backup of archivelog all;
# View all archived logs
list archivelog all;
边栏推荐
- mapreduce概念和案例(尚硅谷学习笔记)
- CRP实施方法论
- Win10: add or delete boot items, and add user-defined boot files to boot items
- In depth study of JVM bottom layer (II): hotspot virtual machine object
- js删除字符串的最后一位
- Tool grass welfare post
- 图解Kubernetes中的etcd的访问
- Sentry construction and use
- uniapp引入本地字体
- Laravel8中的find_in_set、upsert的使用方法
猜你喜欢
Latex compilation error I found no \bibstyle &\bibdata &\citation command
SQLI-LABS通关(less18-less20)
sqli-labs通关汇总-page2
Build learning tensorflow
Sqli labs customs clearance summary-page2
Cve - 2015 - 1635 (ms15 - 034) réplication de la vulnérabilité d'exécution de code à distance
In depth study of JVM bottom layer (II): hotspot virtual machine object
Sqli labs customs clearance summary-page3
In depth study of JVM bottom layer (3): garbage collector and memory allocation strategy
Latex error: the font size command \normalsize is not defined problem solved
随机推荐
Take you to master the formatter of visual studio code
Latex compiles Chinese in vscode and solves the problem of using Chinese path
Oracle EBS数据库监控-Zabbix+zabbix-agent2+orabbix
How to try catch statements that return promise objects in JS
In depth study of JVM bottom layer (II): hotspot virtual machine object
Log - 7 - record a major error in missing documents (A4 paper)
Oracle rman半自动恢复脚本-restore阶段
PM2 simple use and daemon
SQLI-LABS通关(less15-less17)
SQLI-LABS通关(less1)
Redis -- cache breakdown, penetration, avalanche
PXC high availability cluster summary
php中生成随机的6位邀请码
Latex error: the font size command \normalsize is not defined problem solved
TCP攻击
Sqli labs customs clearance summary-page4
MySQL中的正则表达式
The win10 network icon disappears, and the network icon turns gray. Open the network and set the flash back to solve the problem
uniapp引入本地字体
Sqli-labs customs clearance (less2-less5)