Oracle incremental backup recovery verification

First, the backup files to the destination end, decompression, the daily backup is shown below, where 0 is the level difference 20190816 incremental backups
The rest are level 1 differential incremental backup.
[oracle@beijing-fuli--03 /data/backup/oracle]$ ll
total 0
drwxr-xr-x 2 oracle oinstall 332 Aug 18 18:39 20190816
drwxr-xr-x 2 oracle oinstall 298 Aug 18 18:41 20190817
drwxr-xr-x 2 oracle oinstall 298 Aug 18 18:44 20190818
1. Restore the parameter file (parameter file will be backed up when the automatic backup control file)
RMAN>restore spfile from  '/data/backup/oracle/20190818/db2_lev1_c-2174667026-20190818-1a';
Then created as pfile, make the appropriate changes,
create pfile from spfile;
2. Restore the control file (select the last backup of the control file can)
RMAN> restore controlfile  from  '/data/backup/oracle/20190818/controlfile20190818184413.bak';
Starting restore at 18-AUG-19
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=129 device type=DISK
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/data/u01/app/oracle/oradata/db2/control01.ctl
output file name=/data/u01/app/oracle/fast_recovery_area/db2/control02.ctl
Finished restore at 18-AUG-19
3.恢复数据文件并借助归档日志实现数据一致性
3.1告诉rman备份文件在哪里:
RMAN> catalog start with '/data/backup/oracle';
3.2具体恢复,基于时间的恢复,选择一个比较大的时间,就是肯定在备份时间之后的时间!
run {
set until time "to_date('2019-08-28 20:30:13','yyyy-mm-dd hh24:mi:ss')";
restore database;
recover database;
}
3.3打开数据库:
SQL> alter database  open resetlogs;
Database altered.
 
如果你还有更多的 归档日志,可以把日志传输到目的端,然后再进行前面的步骤三,至于到底需要传那几个归档,需要你来判断,就是说只要包含最近一次备份完成后的那个点(scn)即可,然后都是oracle自动去识别哪些是需要应用的archive log,不需要你认为的指定,所以原则是竟可能多传输archive,千万别少传输!
首先在完成最后一次增量备份后,再主库insert一条数据,
SQL> insert into liuwenhe.test values (1010101);
SQL>commit;
SQL> alter system ARCHIVE LOG CURRENT;
然后把最近的archive log传给目的端,
[oracle@beijing-fuli-hadoop-02 archive]$ scp 1_32*  [email protected]:/data/backup/oracle
The authenticity of host '10.9.21.115 (10.9.21.115)' can't be established.
RSA key fingerprint is b4:c6:cf:53:53:6e:b6:9d:0b:a1:cf:45:67:ec:b9:57.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.9.21.115' (RSA) to the list of known hosts.
[email protected]'s password:
1_320_1013795224.dbf                                                                                          100% 1024     1.0KB/s   00:00
1_32_1011211412.dbf                                                                                           100%   27MB  26.9MB/s   00:00
1_32_1012767360.dbf                                                                                           100%   27MB  27.0MB/s   00:00
1_321_1013795224.dbf                                                                                          100%   75KB  75.0KB/s   00:00
1_322_1013795224.dbf                                                                                          100% 2048     2.0KB/s   00:00
1_323_1013795224.dbf                                                                                          100% 1024     1.0KB/s   00:00
1_324_1013795224.dbf                                                                                          100% 3343KB   3.3MB/s   00:00
1_325_1013795224.dbf                                                                                          100%   18KB  18.0KB/s   00:00
1_326_1013795224.dbf                                                                                          100%   12KB  12.0KB/s   00:00
1_327_1013795224.dbf
把最近的归档传给目的地,然后告诉rman备份文件以及最近的归档在哪里:
RMAN> catalog start with '/data/backup/oracle';
具体恢复,基于时间的恢复,选择一个比较大的时间,就是肯定在备份时间之后的时间!
run {
set until time "to_date('2019-08-28 20:30:13','yyyy-mm-dd hh24:mi:ss')";
restore database;
recover database;
}
3.3打开数据库:
SQL> alter database  open resetlogs;
Database altered.
发现最近的归档下已经应用了:发现1010101这条数据已经存在了,
SQL> select * from liuwenhe.test;
ID
----------
100
100
1
2
22
  1010101
6 rows selected.
 
至此完成了增量备份的恢复!
 
 
RMAN不完全恢复的主要操作命令!
a、基于TIME 参数不完全恢复
run {
      shutdown immediate;
      startup mount;
      set until time "to_date('2019-04-28 20:30:13','yyyy-mm-dd hh24:mi:ss')";
      restore database;
      recover database;
      alter database open resetlogs;
}
b、基于SCN 参数不完全恢复
run {
      shutdown immediate;
      startup mount;
      set until scn 3400;
      restore database;
      recover database;
      alter database open resetlogs;
}
c、基于SEQUENCE 参数不完全恢复:
run {
      shutdown immediate;
      startup mount;
      set until sequence 12903;
      restore database;
      recover database;
      alter database open resetlogs;

Guess you like

Origin www.linuxidc.com/Linux/2019-08/160285.htm