pdb备份和恢复
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;
}
3.完全恢复某个pdb
模拟删除pdb1下的数据文件
先关闭pdb1
SQL> alter pluggable database pdb1 close;
Pluggable database altered.
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB READ WRITE NO
4 PDB1 MOUNTED
5 PDB2 READ WRITE NO
删除pdb1目录下的数据文件
[oracle@localhost pdb1]$ pwd
/u01/app/oracle/oradata/ORA19C/pdb1
[oracle@localhost pdb1]$ rm *.dbf
[oracle@localhost pdb1]$ ls
[oracle@localhost pdb1]$
进行恢复
[oracle@localhost ~]$ rman target /
restore pluggable database pdb1;
recover pluggable database pdb1;
打开pdb1
SQL> alter pluggable database pdb1 open;
Pluggable database altered.
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
2021-04-12 linux下安装多路径multipath(centos7)