19c PDB PITR恢复测试丨【绽放吧!数据库】

举报
snowofsummer 发表于 2021/08/04 09:07:41 2021/08/04
【摘要】 数据库版本:Version 19.11.0.0.0环境准备:1,备份pdb01数据库backup pluggable database pdb01 format '/u01/bak/pb01%U';2,在pdb01创建相关测试表,并记录当前SCNalter pluggable database pdb01 open;ALTER SESSION SET CONTAINER=PDB01;crea...

数据库版本:Version 19.11.0.0.0


环境准备:

1,备份pdb01数据库

backup pluggable database pdb01 format '/u01/bak/pb01%U';


2,在pdb01创建相关测试表,并记录当前SCN

alter pluggable database pdb01 open;
ALTER SESSION SET CONTAINER=PDB01;
create table test01(id int);
desc test01;
-记录当前SCN:2769894

-

3,备份CDB数据库

backup database format '/u01/bak/%U';


4,删除pdb01 的中测试表test01

alter pluggable database pdb01 open;
ALTER SESSION SET CONTAINER=PDB01;
drop table test01;


执行恢复测试:

1,恢复CDB

startup nomount;
restore controlfile from '/u01/bak/con1404krbb_36_1_1';
alter database mount;
RUN
{ 
  SET UNTIL SCN 2770042;
  RESTORE DATABASE;
  RECOVER DATABASE;
}
alter database open resetlogs;


2,pdb01执行PITR

alter pluggable database pdb01 close;
run{
SET UNTIL SCN 2769894;  
	restore database pdb01;
	recover database pdb01;
}

alter pluggable database pdb01 open resetlogs;


恢复日志:

RMAN> startup nomount;
restore controlfile from '/u01/bak/con1404krbb_36_1_1';
alter database mount;

Oracle instance started

Total System Global Area    4999609720 bytes

Fixed Size                     9145720 bytes
Variable Size                939524096 bytes
Database Buffers            4043309056 bytes
Redo Buffers                   7630848 bytes

RMAN>
Starting restore at 23-JUL-21
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=743 device type=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/u01/app/oracle/oradata/CDB/control01.ctl
output file name=/u01/app/oracle/oradata/CDB/control02.ctl
Finished restore at 23-JUL-21

RMAN>
released channel: ORA_DISK_1
Statement processed

RMAN> RUN
{
  SET UNTIL SCN 2770042;
  RESTORE DATABASE;
  RECOVER DATABASE;
}
alter database open resetlogs;2> 3> 4> 5> 6>
executing command: SET until clause

Starting restore at 23-JUL-21
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=743 device type=DISK

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/CDB/system01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/CDB/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/CDB/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00007 to /u01/app/oracle/oradata/CDB/users01.dbf
channel ORA_DISK_1: reading from backup piece /u01/bak/1004kr6r_32_1_1
channel ORA_DISK_1: piece handle=/u01/bak/1004kr6r_32_1_1 tag=TAG20210723T002915
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00009 to /u01/app/oracle/oradata/CDB/pdb01/system01.dbf
channel ORA_DISK_1: restoring datafile 00010 to /u01/app/oracle/oradata/CDB/pdb01/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00011 to /u01/app/oracle/oradata/CDB/pdb01/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00012 to /u01/app/oracle/oradata/CDB/pdb01/users01.dbf
channel ORA_DISK_1: reading from backup piece /u01/bak/1104kr72_33_1_1
channel ORA_DISK_1: piece handle=/u01/bak/1104kr72_33_1_1 tag=TAG20210723T002915
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/CDB/pdbseed/system01.dbf
channel ORA_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/CDB/pdbseed/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00008 to /u01/app/oracle/oradata/CDB/pdbseed/undotbs01.dbf
channel ORA_DISK_1: reading from backup piece /u01/bak/1204kr79_34_1_1
channel ORA_DISK_1: piece handle=/u01/bak/1204kr79_34_1_1 tag=TAG20210723T002915
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:03
Finished restore at 23-JUL-21

Starting recover at 23-JUL-21
using channel ORA_DISK_1

starting media recovery

archived log for thread 1 with sequence 3 is already on disk as file /u01/arc/1_3_1078619131.dbf
archived log for thread 1 with sequence 4 is already on disk as file /u01/arc/1_4_1078619131.dbf
archived log for thread 1 with sequence 5 is already on disk as file /u01/arc/1_5_1078619131.dbf
archived log file name=/u01/arc/1_3_1078619131.dbf thread=1 sequence=3
archived log file name=/u01/arc/1_4_1078619131.dbf thread=1 sequence=4
archived log file name=/u01/arc/1_5_1078619131.dbf thread=1 sequence=5
media recovery complete, elapsed time: 00:00:00
Finished recover at 23-JUL-21

RMAN>



Statement processed

RMAN>


RMAN> alter pluggable database pdb01 close;

Statement processed

RMAN>

RMAN>

RMAN>

RMAN>

RMAN> run{
SET UNTIL SCN 2769894;
        restore database pdb01;
        recover database pdb01;
}
2> 3> 4> 5>
executing command: SET until clause

Starting restore at 23-JUL-21
using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00009 to /u01/app/oracle/oradata/CDB/pdb01/system01.dbf
channel ORA_DISK_1: restoring datafile 00010 to /u01/app/oracle/oradata/CDB/pdb01/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00011 to /u01/app/oracle/oradata/CDB/pdb01/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00012 to /u01/app/oracle/oradata/CDB/pdb01/users01.dbf
channel ORA_DISK_1: reading from backup piece /u01/bak/pb010u04kr2t_30_1_1

channel ORA_DISK_1: piece handle=/u01/bak/pb010u04kr2t_30_1_1 tag=TAG20210723T002709
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:07
Finished restore at 23-JUL-21

Starting recover at 23-JUL-21
using channel ORA_DISK_1


starting media recovery

archived log for thread 1 with sequence 1 is already on disk as file /u01/arc/1_1_1078619131.dbf
media recovery complete, elapsed time: 00:00:00
Finished recover at 23-JUL-21

RMAN>
RMAN> alter pluggable database pdb01 open resetlogs;

Statement processed

【绽放吧!数据库】有奖征文火热进行中:https://bbs.huaweicloud.com/blogs/285617

【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。