全部博文(389)
分类: Oracle
2014-12-02 19:40:16
RMAN PDB完全恢复
ORACLE 12C中,RMAN可以执行对单个pdb进行完全恢复.可以在root contrainer中进行
restore/recover操作,或是通过rman以service连接到pdb,再进行恢复操作.。
备份单个pdb
RMAN> backup pluggable database pdb1;
Starting backup at 02-JUN-14
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00009 name=/usr/oracle/oradata/t2/pdb1/sysaux01.dbf
input datafile file number=00008 name=/usr/oracle/oradata/t2/pdb1/system01.dbf
input datafile file number=00010 name=/usr/oracle/oradata/t2/pdb1/pdb1_users01.dbf
channel ORA_DISK_1: starting piece 1 at 02-JUN-14
channel ORA_DISK_1: finished piece 1 at 02-JUN-14
piece handle=/usr/tmp/T2/FEEDF83885BB3140E0430100007F2F93/backupset/2014_06_02/o1_mf_nnndf_TAG20141202T112457_b7v8db4l_.bkp tag=TAG20141202T112457 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:25
channel ORA_DISK_1: throttle time: 0:01:06
Finished backup at 02-JUN-14
备份完成,检查一下备份情况.
RMAN> list backup of pluggable database pdb1;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
108 Full 688.65M DISK 00:01:23 02-JUN-14
BP Key: 290 Status: AVAILABLE Compressed: NO Tag: TAG20141202T112457
Piece Name: /usr/tmp/T2/FEEDF83885BB3140E0430100007F2F93/backupset/2014_06_02/o1_mf_nnndf_TAG20141202T112457_b7v8db4l_.bkp
List of Datafiles in backup set 108
Container ID: 3, PDB Name: PDB1
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
8 Full 9318242 02-JUN-14 /usr/oracle/oradata/t2/pdb1/system01.dbf
9 Full 9318242 02-JUN-14 /usr/oracle/oradata/t2/pdb1/sysaux01.dbf
10 Full 9318242 02-JUN-14 /usr/oracle/oradata/t2/pdb1/pdb1_users01.dbf
手动删除pdb1数据库的所有数据文件,摸拟文件损坏,再次打开pdb1,出现报错.
SQL> alter pluggable database pdb1 open;
alter pluggable database pdb1 open
*
ERROR at line 1:
ORA-01157: cannot identify/lock data file 10 - see DBWR trace file
ORA-01110: data file 10: '/usr/oracle/oradata/t2/pdb1/pdb1_users01.dbf'
使用rman进行restore和recover操作.
RMAN> restore pluggable database pdb1;
Starting restore at 02-JUN-14
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=11 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 00008 to /usr/oracle/oradata/t2/pdb1/system01.dbf
channel ORA_DISK_1: restoring datafile 00009 to /usr/oracle/oradata/t2/pdb1/sysaux01.dbf
.......................
RMAN> recover pluggable database pdb1;
Starting recover at 02-JUN-14
using channel ORA_DISK_1
...............
starting media recovery
media recovery complete, elapsed time: 00:01:23
Finished recover at 02-JUN-14
再次打开pluggable database。
SQL> alter pluggable database pdb1 open;
Pluggable database altered.
恢复完成
总结:rman对于大部分的pdb的操作,可以在以前的database名词前加pluggable得到一样的功能;pdb的完全恢复操作,不影响整个CDB和
其他的pdb.