pdb做不完全恢复

发布时间 2023-04-13 14:41:39作者: slnngk

1.数据库全备份

run
{
allocate channel ch1 device type disk;
allocate channel ch2 device type disk;
allocate channel ch3 device type disk;
backup as compressed backupset full filesperset 10 database format '/u01/rmanbak/fullbk_%d_%s_%u_%T.bak';
sql 'alter system archive log current';
backup as compressed backupset archivelog all format '/u01/rmanbak/daily_arch_%d_%s_%u_%T.bak' delete input;
backup current controlfile format '/u01/rmanbak/daily_ctl_%d_%s_%u_%T.bak';
backup spfile format '/u01/rmanbak/daily_spfile_%d_%s_%u_%T.bak';
release channel ch1;
release channel ch2;
release channel ch3;
crosscheck backup;
crosscheck archivelog all;
delete noprompt expired backup;
delete noprompt obsolete;
}

或者是单个pdb备份

run
{
allocate channel ch1 device type disk;
allocate channel ch2 device type disk;
allocate channel ch3 device type disk;
backup as compressed backupset full filesperset 10 pluggable database pdb format '/u01/rmanbak/pdbbak/pdb_fullbk_%d_%s_%u_%T.bak';
sql 'alter system archive log current';
backup as compressed backupset archivelog all format '/u01/rmanbak/pdbbak/daily_arch_%d_%s_%u_%T.bak' delete input;
backup current controlfile format '/u01/rmanbak/pdbbak/daily_ctl_%d_%s_%u_%T.bak';
backup spfile format '/u01/rmanbak/pdbbak/daily_spfile_%d_%s_%u_%T.bak';
release channel ch1;
release channel ch2;
release channel ch3;
crosscheck backup;
crosscheck archivelog all;
delete noprompt expired backup;
delete noprompt obsolete;
}

 

2.执行不完全恢复


关闭pdb
alter pluggable database pdb close immediate;

 

删除该pdb的数据文件
[oracle@19c pdbbak]$ cd /u01/app/oracle/oradata/ora19c/pdb
[oracle@19c pdb]$ rm *.dbf

 

创建辅佐目录
mkdir -p /u01/recover

执行不完全恢复
基于scn(可行)
run{
set until scn 1498061;
restore pluggable database pdb;
recover pluggable database pdb auxiliary destination '/u01/recover';
}

基于时间点(可行)
RMAN>
run{
set until time "TO_DATE('2023-04-12 22:11:00','YYYY-MM-DD HH24:MI:SS')";
restore pluggable database pdb;
recover pluggable database pdb auxiliary destination '/u01/recover';
}

基于sequence(执行报错)
RMAN>
run{
set until sequence 24 thread 1;
restore pluggable database pdb;
recover pluggable database pdb auxiliary destination '/u01/recover';
}

报错信息如下:
Starting recover at 12-APR-23
Segmentation fault (core dumped)