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.
复制代码

 

posted @   slnngk  阅读(84)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
历史上的今天:
2021-04-12 linux下安装多路径multipath(centos7)
点击右上角即可分享
微信分享提示