一、  CDB 备份

1.1  只备份CDB

只备份CDB数据库需要具有SYSDBA或SYSBACKUP权限用户连接到CDB的root环境下,执行backupdatabase root命令即可完成对CDB的备份,方法如下:
[oracle@12c01 ~]$ rman target / 
[oracle@12c01 ~]$ mkdir /home/oracle/rmanback/
RMAN> backup database root format='/home/oracle/rmanback/db_%d_%U'; 
RMAN-03002: failure of backup command at 05/10/2017 23:14:58
RMAN-06817: Pluggable Database CDB$ROOT cannot be backed up in NOARCHIVELOG mode.
说明: 只备份 CDB 需要数据库在归档环境下,自行把数据设置为归档模式。
RMAN> select name,log_mode from v$database;
NAME      LOG_MODE    
--------- ------------
ANDYCDB   ARCHIVELOG  
RMAN> backup database root format='/home/oracle/rmanback/db_%d_%U';

Starting backup at 10-MAY-17
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=00001 name=/home/oracle/app/oracle/oradata/ANDYCDB/datafile/o1_mf_system_djsytx31_.dbf
input datafile file number=00003 name=/home/oracle/app/oracle/oradata/ANDYCDB/datafile/o1_mf_sysaux_djsyx1t8_.dbf
input datafile file number=00004 name=/home/oracle/app/oracle/oradata/ANDYCDB/datafile/o1_mf_undotbs1_djsyyjlk_.dbf
input datafile file number=00007 name=/home/oracle/app/oracle/oradata/ANDYCDB/datafile/o1_mf_users_djsyykpc_.dbf
channel ORA_DISK_1: starting piece 1 at 10-MAY-17
channel ORA_DISK_1: finished piece 1 at 10-MAY-17
piece handle=/home/oracle/rmanback/db_ANDYCDB_07s3u63n_1_1 tag=TAG20170510T233207 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:05
Finished backup at 10-MAY-17

Starting Control File and SPFILE Autobackup at 10-MAY-17
piece handle=/home/oracle/fast_recovery_area/ANDYCDB/autobackup/2017_05_10/o1_mf_s_943659193_dk6dosvv_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 10-MAY-17

1.2.  备份整个CDB及其下面的所有PDB
备份整个CDB数据库及其下面的所有PDB类似于非CDB数据库方法相同,使用具有SYSDBA或SYSBACKUP权限用户连接到CDB的root环境下面,然后执行backupdatabase命令即可完成整个CDB的备份,方法如下: 
RMAN> backup database format='/home/oracle/rmanback/db_%d_%U';

Starting backup at 10-MAY-17
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=00001 name=/home/oracle/app/oracle/oradata/ANDYCDB/datafile/o1_mf_system_djsytx31_.dbf
input datafile file number=00003 name=/home/oracle/app/oracle/oradata/ANDYCDB/datafile/o1_mf_sysaux_djsyx1t8_.dbf
input datafile file number=00004 name=/home/oracle/app/oracle/oradata/ANDYCDB/datafile/o1_mf_undotbs1_djsyyjlk_.dbf
input datafile file number=00007 name=/home/oracle/app/oracle/oradata/ANDYCDB/datafile/o1_mf_users_djsyykpc_.dbf
channel ORA_DISK_1: starting piece 1 at 10-MAY-17
channel ORA_DISK_1: finished piece 1 at 10-MAY-17
piece handle=/home/oracle/rmanback/db_ANDYCDB_09s3u69m_1_1 tag=TAG20170510T233517 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:17
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00022 name=/home/oracle/app/oracle/oradata/ANDYCDB/4ECF8621E3DA38EEE0531019640AA598/datafile/o1_mf_sysaux_dk5wmv11_.dbf
input datafile file number=00021 name=/home/oracle/app/oracle/oradata/ANDYCDB/4ECF8621E3DA38EEE0531019640AA598/datafile/o1_mf_system_dk5wmv0s_.dbf
input datafile file number=00024 name=/home/oracle/app/oracle/oradata/ANDYCDB/4ECF8621E3DA38EEE0531019640AA598/datafile/o1_mf_undo_1_dk5wmv13_.dbf
input datafile file number=00023 name=/home/oracle/app/oracle/oradata/ANDYCDB/4ECF8621E3DA38EEE0531019640AA598/datafile/o1_mf_users_dk5wmv12_.dbf
channel ORA_DISK_1: starting piece 1 at 10-MAY-17
channel ORA_DISK_1: finished piece 1 at 10-MAY-17
piece handle=/home/oracle/rmanback/db_ANDYCDB_0as3u6c3_1_1 tag=TAG20170510T233517 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:39
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00006 name=/home/oracle/app/oracle/oradata/ANDYCDB/datafile/o1_mf_sysaux_djsz1z2x_.dbf
input datafile file number=00005 name=/home/oracle/app/oracle/oradata/ANDYCDB/datafile/o1_mf_system_djsz1z31_.dbf
input datafile file number=00008 name=/home/oracle/app/oracle/oradata/ANDYCDB/datafile/o1_mf_undotbs1_djsz1z34_.dbf
channel ORA_DISK_1: starting piece 1 at 10-MAY-17
channel ORA_DISK_1: finished piece 1 at 10-MAY-17
piece handle=/home/oracle/rmanback/db_ANDYCDB_0bs3u6da_1_1 tag=TAG20170510T233517 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:46
Finished backup at 10-MAY-17

Starting Control File and SPFILE Autobackup at 10-MAY-17
piece handle=/home/oracle/fast_recovery_area/ANDYCDB/autobackup/2017_05_10/o1_mf_s_943659480_dk6dyrlw_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 10-MAY-17

二、 备份 PDB

1.1.  备份单个和多个PDB
在CDB中允许备份一个或多少PDB数据库(如果要备份多个pdb,只需在备份命令后面跟上多个你想备份的pdb实例的名称,如下backup pluggable database pdb1,pdb2; ),备份一个PDB数据库可以通过以下两个方式备份:
注意:如果没有开启归档模式,单独备份 CDB 或者是 PDB 都会报ORA-19602: cannot backup or copy active file in NOARCHIVELOG mode
方式一:在CDB根(root)使用BACKUP PLUGGABLE DATABASE命令备份一个或多个PDB数据库。 
[oracle@localhost ~]$ rman target / 
RMAN>  backup pluggable database pdb01;

Starting backup at 10-MAY-17
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=00022 name=/home/oracle/app/oracle/oradata/ANDYCDB/4ECF8621E3DA38EEE0531019640AA598/datafile/o1_mf_sysaux_dk5wmv11_.dbf
input datafile file number=00021 name=/home/oracle/app/oracle/oradata/ANDYCDB/4ECF8621E3DA38EEE0531019640AA598/datafile/o1_mf_system_dk5wmv0s_.dbf
input datafile file number=00024 name=/home/oracle/app/oracle/oradata/ANDYCDB/4ECF8621E3DA38EEE0531019640AA598/datafile/o1_mf_undo_1_dk5wmv13_.dbf
input datafile file number=00023 name=/home/oracle/app/oracle/oradata/ANDYCDB/4ECF8621E3DA38EEE0531019640AA598/datafile/o1_mf_users_dk5wmv12_.dbf
channel ORA_DISK_1: starting piece 1 at 10-MAY-17
channel ORA_DISK_1: finished piece 1 at 10-MAY-17
piece handle=/home/oracle/fast_recovery_area/ANDYCDB/4ECF8621E3DA38EEE0531019640AA598/backupset/2017_05_10/o1_mf_nnndf_TAG20170510T234055_dk6f47wq_.bkp tag=TAG20170510T234055 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:36
Finished backup at 10-MAY-17

Starting Control File and SPFILE Autobackup at 10-MAY-17
piece handle=/home/oracle/fast_recovery_area/ANDYCDB/autobackup/2017_05_10/o1_mf_s_943659691_dk6f5cpf_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 10-MAY-17
备份默认在 闪回恢复区里。

方式二:在PDB中使用BACKUP DATABASE备份当前连接的PDB数据库,前提条件是需要配置好TNSNAMES.ORA文件。 
[oracle@12c01 ~]$ rman target sys/oracle@10.100.25.16:1521/pdb01
connected to target database: ANDYCDB:PDB01 (DBID=2550500229) 
RMAN> backup database format='/home/oracle/rmanback/db_%d_%U';

Starting backup at 10-MAY-17
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=60 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00022 name=/home/oracle/app/oracle/oradata/ANDYCDB/4ECF8621E3DA38EEE0531019640AA598/datafile/o1_mf_sysaux_dk5wmv11_.dbf
input datafile file number=00021 name=/home/oracle/app/oracle/oradata/ANDYCDB/4ECF8621E3DA38EEE0531019640AA598/datafile/o1_mf_system_dk5wmv0s_.dbf
input datafile file number=00024 name=/home/oracle/app/oracle/oradata/ANDYCDB/4ECF8621E3DA38EEE0531019640AA598/datafile/o1_mf_undo_1_dk5wmv13_.dbf
input datafile file number=00023 name=/home/oracle/app/oracle/oradata/ANDYCDB/4ECF8621E3DA38EEE0531019640AA598/datafile/o1_mf_users_dk5wmv12_.dbf
channel ORA_DISK_1: starting piece 1 at 10-MAY-17
channel ORA_DISK_1: finished piece 1 at 10-MAY-17
piece handle=/home/oracle/rmanback/db_ANDYCDB_0fs3u6tn_1_1 tag=TAG20170510T234559 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:45
Finished backup at 10-MAY-17

Oracle 12c 多租户 CDB 与 PDB 备份的更多相关文章

  1. Oracle 12c 多租户 CDB 与 PDB 级别 expdb 与 impdb(表、用户、全库)

    Oracle 数据库 12 c 多租户下,如何在容器数据库 (CDB) 和可插拔数据库 (PDB) 中使用 expdb 与 impdp (数据泵) 呢? 我们一起探讨下PDB 下进行表级,用户级别,全 ...

  2. Oracle 12c 多租户 CDB 与 PDB之 shared undo 与 Local undo 切换

    undo 在12C R1版本中只支持Global Shared Undo模式, 所有container共享一个UNDO表空间, 目前保留这种模式只是为了升级过渡, 在12C R2引入了PDB Loca ...

  3. ORACLE 12C新特性——CDB与PDB

    Oracle 12C引入了CDB与PDB的新特性,在ORACLE 12C数据库引入的多租用户环境(Multitenant Environment)中,允许一个数据库容器(CDB)承载多个可插拔数据库( ...

  4. Oracle 12c 多租户 手工创建 pdb 与 手工删除 pdb

    实验环境: SQL> select * from v$version;BANNER                                                         ...

  5. Oracle 12c 多租户家族(12c 18c 19c)如何在 PDB 中添加 HR 模式

    Oracle 12c 多租户家族(12c [12.2.0.1].18c [12.2.0.2].19c [12.2.0.3])如何在 PDB 中添加模式:19c (19.3) 手工添加示例 HR 用户 ...

  6. Oracle12c多租户CDB 与 PDB 参数文件位置探讨、查询 CDB 与 PDB 不同值的参数

    一. Oracle12c多租户CDB 与 PDB 参数文件位置CDB的参数文件依然使用12c以前的SPIFLE,pdb的参数文件不会出现在SPFILE中,而是直接从CDB中继承,如果PDB中有priv ...

  7. Oracle 12c多租户架构浅析

    Oracle数据库12c的一大创新即是其采用的多租户架构.对于多租户这项新功能,业内的评价褒贬不一.有的声音认为,这项功能的用处不是特别大,但在某些场景或特定的环境下,多租户依然有它的用处.其最大的用 ...

  8. oracle 12c 多租户 pdb 恢复(单个pdb数据文件、非系统pdb表空间、整个pdb数据库)

    环境:数据库版本 Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production 实验准备:1.-- 数据库归 ...

  9. [转]Oracle 12c多租户特性详解:PDB 的创建、克隆与维护

    转自:http://chuansong.me/n/443660447865 PDB 的创建和访问 在使用 dbca 建库时,创建数据库之前,可以保存一下创建脚本,分析其具体执行过程.以自定义方式创建名 ...

随机推荐

  1. full stack on the road

    Full Stack, I'm coming. 有人说全栈只是个理想情况,但我不这么认为,因为好多思想是想通的, 比如 OO.函数式编程.设计模式... 也有人说搞全栈的人样样普通,可是为嘛我在学习j ...

  2. element-ui table 点击分页table滚动到顶部

    在做项目中,碰到一个问题,table加了固定头,内容可滚动,当滚到table底边时,点击分页后还在底边 解决方法:设置table的 ref='multipleTable' //切换分页的方法加上下面这 ...

  3. 【题解】P2161[SHOI2009]会场预约(set)

    [题解][P2161 SHOI2009]会场预约 题目很像[[题解]APIO2009]会议中心 \(set\)大法好啊! 然后我们有个小\(trick\)(炒鸡帅),就是如何优雅地判断线段交? str ...

  4. SAP 定价

    近几天做门店团购销售订单上传SAP接口程序,SO创建测试过程中, 遇到定价问题,同事在定价过程的增强过不了. VOFM 了解到定价过程是个非常复杂的环节,此处出现程序处理过程中ZMP0定价条件下的价格 ...

  5. python2 生成验证码图片

    使用pillow或者pil库编写 #coding:utf-8 #use pillow or pil try: from PIL import Image, ImageDraw, ImageFont, ...

  6. 导入android sdk samples工程报错"did you mean to use @+id instead of @+android:id?"

    导入“D:\adt-bundle-windows-x86_64-20140702\sdk\samples\android-15”中的工程报错 did you mean to use @+id inst ...

  7. 查看mysql支持的存储引擎

    查看mysql支持的存储引擎 show engines\G;

  8. 深入理解利用new创建对象的执行过程以Person p=new Person("张三",20);为例

    代码如下: class Person { private String name="haha"; private int age; private static String co ...

  9. Java -- 国际化 多语化

    1. 以中英两种语言做示例,显示 "hello" 2. 建立英文语言文件 "mess_en_US.properties ", 输入内容 "hello= ...

  10. wget下载文件

    http://blog.sina.com.cn/s/blog_4af3f0d20100n1k0.html 一.下载目录 #wget -r -np -nd http://example.com/pack ...