pdb备份和恢复

发布时间 2023-04-12 09:56:13作者: slnngk

 

1.备份单个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 pdb1 format '/u01/rmanbak/pdbbak/pdb1_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

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 pdb1,pdb2 format '/u01/rmanbak/pdbbak/pdb1_pdb2_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;
}