一,备份前提描述

SQL> show con_name

CON_NAME
------------------------------
CDB$ROOT
SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /orcl/app/oracle/oradata/orcl/archivelog
Oldest online log sequence 280
Next log sequence to archive 282
Current log sequence 282
SQL> show parameter recover NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest string /orcl/app/oracle/fast_recovery_area/orcl --恢复区地址
db_recovery_file_dest_size big integer 1G
db_unrecoverable_scn_tracking boolean TRUE
recovery_parallelism integer 0
remote_recovery_file_dest string
SQL> 可能用到的配置:
alter database archielog --开启归档日志
alter database open 开启数据库
alter system set db_recovery_file_dest_size=20G; 闪回恢复区大小
alter system set db_recovery_file_dest='/orcl/app/oracle/fast_recovery_area/orcl';

二,生成备份

[oracle@node12c01 ~]$ rman  target /

Recovery Manager: Release 12.2.0.1.0 - Production on Fri Apr 12 05:29:33 2019

Copyright (c) 1982, 2017, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ORCL (DBID=1532278336)

RMAN> report schema   --以列出数据库中的表空间和文件信息等,在12c的输出中,临时表空间作为一个独立的信息部分被显示出来:
2> ; using target database control file instead of recovery catalog
Report of database schema for database with db_unique_name NODE12C01 List of Permanent Datafiles
===========================
File Size(MB) Tablespace RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1 830 SYSTEM YES /orcl/app/oracle/oradata/orcl/system01.dbf
3 970 SYSAUX NO /orcl/app/oracle/oradata/orcl/sysaux01.dbf
4 70 UNDOTBS1 YES /orcl/app/oracle/oradata/orcl/undotbs01.dbf
5 250 PDB$SEED:SYSTEM NO /orcl/app/oracle/oradata/orcl/pdbseed/system01.dbf
6 330 PDB$SEED:SYSAUX NO /orcl/app/oracle/oradata/orcl/pdbseed/sysaux01.dbf
7 5 USERS NO /orcl/app/oracle/oradata/orcl/users01.dbf
8 100 PDB$SEED:UNDOTBS1 NO /orcl/app/oracle/oradata/orcl/pdbseed/undotbs01.dbf
9 260 ORCLPDB:SYSTEM YES /orcl/app/oracle/oradata/orcl/orclpdb/system01.dbf
10 430 ORCLPDB:SYSAUX NO /orcl/app/oracle/oradata/orcl/orclpdb/sysaux01.dbf
11 100 ORCLPDB:UNDOTBS1 YES /orcl/app/oracle/oradata/orcl/orclpdb/undotbs01.dbf
12 5 ORCLPDB:USERS NO /orcl/app/oracle/oradata/orcl/orclpdb/users01.dbf
13 250 HRPDB:SYSTEM YES /orcl/app/oracle/oradata/orcl/hrpdb/system01.dbf
14 350 HRPDB:SYSAUX NO /orcl/app/oracle/oradata/orcl/hrpdb/sysaux01.dbf
15 100 HRPDB:UNDOTBS1 YES /orcl/app/oracle/oradata/orcl/hrpdb/undotbs01.dbf
16 250 SALESPDB:SYSTEM YES /orcl/app/oracle/oradata/orcl/salespdb/system01.dbf
17 350 SALESPDB:SYSAUX NO /orcl/app/oracle/oradata/orcl/salespdb/sysaux01.dbf
18 100 SALESPDB:UNDOTBS1 YES /orcl/app/oracle/oradata/orcl/salespdb/undotbs01.dbf List of Temporary Files
=======================
File Size(MB) Tablespace Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1 131 TEMP 32767 /orcl/app/oracle/oradata/orcl/temp01.dbf
2 64 PDB$SEED:TEMP 32767 /orcl/app/oracle/oradata/orcl/pdbseed/temp012019-04-02_03-07-18-378-AM.dbf
3 129 ORCLPDB:TEMP 32767 /orcl/app/oracle/oradata/orcl/orclpdb/temp01.dbf
4 64 HRPDB:TEMP 32767 /orcl/app/oracle/oradata/orcl/hrpdb/temp012019-04-02_03-07-18-378-AM.dbf
5 64 SALESPDB:TEMP 32767 /orcl/app/oracle/oradata/orcl/salespdb/temp012019-04-02_03-07-18-378-AM.dbf RMAN> backup pluggable database orclpdb,salespdb; --支持对单个或者多个PDB文件的备份 Starting backup at 12-APR-19
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=271 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=00010 name=/orcl/app/oracle/oradata/orcl/orclpdb/sysaux01.dbf
input datafile file number=00009 name=/orcl/app/oracle/oradata/orcl/orclpdb/system01.dbf
input datafile file number=00011 name=/orcl/app/oracle/oradata/orcl/orclpdb/undotbs01.dbf
input datafile file number=00012 name=/orcl/app/oracle/oradata/orcl/orclpdb/users01.dbf
channel ORA_DISK_1: starting piece 1 at 12-APR-19
channel ORA_DISK_1: finished piece 1 at 12-APR-19
piece handle=/home/oracle/dgback/ORCL_1532278336_69_1.bkp tag=TAG20190412T053110 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00017 name=/orcl/app/oracle/oradata/orcl/salespdb/sysaux01.dbf
input datafile file number=00016 name=/orcl/app/oracle/oradata/orcl/salespdb/system01.dbf
input datafile file number=00018 name=/orcl/app/oracle/oradata/orcl/salespdb/undotbs01.dbf
channel ORA_DISK_1: starting piece 1 at 12-APR-19
channel ORA_DISK_1: finished piece 1 at 12-APR-19
piece handle=/home/oracle/dgback/ORCL_1532278336_70_1.bkp tag=TAG20190412T053110 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15
Finished backup at 12-APR-19 Starting Control File and SPFILE Autobackup at 12-APR-19
piece handle=/orcl/app/oracle/fast_recovery_area/orcl/NODE12C01/autobackup/2019_04_12/o1_mf_s_1005370293_gc0pqo9m_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 12-APR-19 RMAN> backup pluggable database "CDB$ROOT"; --备份CDB根即下面所有的PDB Starting backup at 12-APR-19
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=00003 name=/orcl/app/oracle/oradata/orcl/sysaux01.dbf
input datafile file number=00001 name=/orcl/app/oracle/oradata/orcl/system01.dbf
input datafile file number=00004 name=/orcl/app/oracle/oradata/orcl/undotbs01.dbf
input datafile file number=00007 name=/orcl/app/oracle/oradata/orcl/users01.dbf
channel ORA_DISK_1: starting piece 1 at 12-APR-19
channel ORA_DISK_1: finished piece 1 at 12-APR-19
piece handle=/home/oracle/dgback/ORCL_1532278336_72_1.bkp tag=TAG20190412T053207 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07
Finished backup at 12-APR-19 Starting Control File and SPFILE Autobackup at 12-APR-19
piece handle=/orcl/app/oracle/fast_recovery_area/orcl/NODE12C01/autobackup/2019_04_12/o1_mf_s_1005370334_gc0prz1p_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 12-APR-19
RMAN> backup database root;   --  只备份CDB数据库需要具有SYSDBA或SYSBACKUP权限用户连接到CDB的root环境下,执行backupdatabase root命令即可完成对CDB的备份

Starting backup at 12-APR-19
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=00003 name=/orcl/app/oracle/oradata/orcl/sysaux01.dbf
input datafile file number=00001 name=/orcl/app/oracle/oradata/orcl/system01.dbf
input datafile file number=00004 name=/orcl/app/oracle/oradata/orcl/undotbs01.dbf
input datafile file number=00007 name=/orcl/app/oracle/oradata/orcl/users01.dbf
channel ORA_DISK_1: starting piece 1 at 12-APR-19
channel ORA_DISK_1: finished piece 1 at 12-APR-19
piece handle=/home/oracle/dgback/ORCL_1532278336_74_1.bkp tag=TAG20190412T053852 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07
Finished backup at 12-APR-19 Starting Control File and SPFILE Autobackup at 12-APR-19
piece handle=/orcl/app/oracle/fast_recovery_area/orcl/NODE12C01/autobackup/2019_04_12/o1_mf_s_1005370739_gc0q5nhk_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 12-APR-19 RMAN> backup database; -- 备份所有 Starting backup at 12-APR-19
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=00003 name=/orcl/app/oracle/oradata/orcl/sysaux01.dbf
input datafile file number=00001 name=/orcl/app/oracle/oradata/orcl/system01.dbf
input datafile file number=00004 name=/orcl/app/oracle/oradata/orcl/undotbs01.dbf
input datafile file number=00007 name=/orcl/app/oracle/oradata/orcl/users01.dbf
channel ORA_DISK_1: starting piece 1 at 12-APR-19
channel ORA_DISK_1: finished piece 1 at 12-APR-19
piece handle=/home/oracle/dgback/ORCL_1532278336_76_1.bkp tag=TAG20190412T054009 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00010 name=/orcl/app/oracle/oradata/orcl/orclpdb/sysaux01.dbf
input datafile file number=00009 name=/orcl/app/oracle/oradata/orcl/orclpdb/system01.dbf
input datafile file number=00011 name=/orcl/app/oracle/oradata/orcl/orclpdb/undotbs01.dbf
input datafile file number=00012 name=/orcl/app/oracle/oradata/orcl/orclpdb/users01.dbf
channel ORA_DISK_1: starting piece 1 at 12-APR-19
channel ORA_DISK_1: finished piece 1 at 12-APR-19
piece handle=/home/oracle/dgback/ORCL_1532278336_77_1.bkp tag=TAG20190412T054009 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00014 name=/orcl/app/oracle/oradata/orcl/hrpdb/sysaux01.dbf
input datafile file number=00013 name=/orcl/app/oracle/oradata/orcl/hrpdb/system01.dbf
input datafile file number=00015 name=/orcl/app/oracle/oradata/orcl/hrpdb/undotbs01.dbf
channel ORA_DISK_1: starting piece 1 at 12-APR-19
channel ORA_DISK_1: finished piece 1 at 12-APR-19
piece handle=/home/oracle/dgback/ORCL_1532278336_78_1.bkp tag=TAG20190412T054009 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00017 name=/orcl/app/oracle/oradata/orcl/salespdb/sysaux01.dbf
input datafile file number=00016 name=/orcl/app/oracle/oradata/orcl/salespdb/system01.dbf
input datafile file number=00018 name=/orcl/app/oracle/oradata/orcl/salespdb/undotbs01.dbf
channel ORA_DISK_1: starting piece 1 at 12-APR-19
channel ORA_DISK_1: finished piece 1 at 12-APR-19
piece handle=/home/oracle/dgback/ORCL_1532278336_79_1.bkp tag=TAG20190412T054009 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
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=/orcl/app/oracle/oradata/orcl/pdbseed/sysaux01.dbf
input datafile file number=00005 name=/orcl/app/oracle/oradata/orcl/pdbseed/system01.dbf
input datafile file number=00008 name=/orcl/app/oracle/oradata/orcl/pdbseed/undotbs01.dbf
channel ORA_DISK_1: starting piece 1 at 12-APR-19
channel ORA_DISK_1: finished piece 1 at 12-APR-19
piece handle=/home/oracle/dgback/ORCL_1532278336_80_1.bkp tag=TAG20190412T054009 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 12-APR-19 Starting Control File and SPFILE Autobackup at 12-APR-19
piece handle=/orcl/app/oracle/fast_recovery_area/orcl/NODE12C01/autobackup/2019_04_12/o1_mf_s_1005370833_gc0q8log_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 12-APR-19 RMAN> report schema; using target database control file instead of recovery catalog
Report of database schema for database with db_unique_name NODE12C01 List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    830      SYSTEM               YES     /orcl/app/oracle/oradata/orcl/system01.dbf
3    1070     SYSAUX               NO      /orcl/app/oracle/oradata/orcl/sysaux01.dbf
4    70       UNDOTBS1             YES     /orcl/app/oracle/oradata/orcl/undotbs01.dbf
5    250      PDB$SEED:SYSTEM      NO      /orcl/app/oracle/oradata/orcl/pdbseed/system01.dbf
6    330      PDB$SEED:SYSAUX      NO      /orcl/app/oracle/oradata/orcl/pdbseed/sysaux01.dbf
7    5        USERS                NO      /orcl/app/oracle/oradata/orcl/users01.dbf
8    100      PDB$SEED:UNDOTBS1    NO      /orcl/app/oracle/oradata/orcl/pdbseed/undotbs01.dbf
9    260      ORCLPDB:SYSTEM       YES     /orcl/app/oracle/oradata/orcl/orclpdb/system01.dbf
10   470      ORCLPDB:SYSAUX       NO      /orcl/app/oracle/oradata/orcl/orclpdb/sysaux01.dbf
11   100      ORCLPDB:UNDOTBS1     YES     /orcl/app/oracle/oradata/orcl/orclpdb/undotbs01.dbf
12   5        ORCLPDB:USERS        NO      /orcl/app/oracle/oradata/orcl/orclpdb/users01.dbf
13   250      HRPDB:SYSTEM         YES     /orcl/app/oracle/oradata/orcl/hrpdb/system01.dbf
14   350      HRPDB:SYSAUX         NO      /orcl/app/oracle/oradata/orcl/hrpdb/sysaux01.dbf
15   100      HRPDB:UNDOTBS1       YES     /orcl/app/oracle/oradata/orcl/hrpdb/undotbs01.dbf
16   250      SALESPDB:SYSTEM      YES     /orcl/app/oracle/oradata/orcl/salespdb/system01.dbf
17   350      SALESPDB:SYSAUX      NO      /orcl/app/oracle/oradata/orcl/salespdb/sysaux01.dbf
18   100      SALESPDB:UNDOTBS1    YES     /orcl/app/oracle/oradata/orcl/salespdb/undotbs01.dbf List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    131      TEMP                 32767       /orcl/app/oracle/oradata/orcl/temp01.dbf
2    64       PDB$SEED:TEMP        32767       /orcl/app/oracle/oradata/orcl/pdbseed/temp012019-04-02_03-07-18-378-AM.dbf
3    129      ORCLPDB:TEMP         32767       /orcl/app/oracle/oradata/orcl/orclpdb/temp01.dbf
4    64       HRPDB:TEMP           32767       /orcl/app/oracle/oradata/orcl/hrpdb/temp012019-04-02_03-07-18-378-AM.dbf
5    64       SALESPDB:TEMP        32767       /orcl/app/oracle/oradata/orcl/salespdb/temp012019-04-02_03-07-18-378-AM.dbf RMAN> backup tablespace HRPDB:SYSTEM; 单独备份表空间 Starting backup at 15-APR-19
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=276 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=00013 name=/orcl/app/oracle/oradata/orcl/hrpdb/system01.dbf
channel ORA_DISK_1: starting piece 1 at 15-APR-19
channel ORA_DISK_1: finished piece 1 at 15-APR-19
piece handle=/home/oracle/dgback/ORCL_1532278336_82_1.bkp tag=TAG20190415T050535 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 15-APR-19 Starting Control File and SPFILE Autobackup at 15-APR-19
piece handle=/orcl/app/oracle/fast_recovery_area/orcl/NODE12C01/autobackup/2019_04_15/o1_mf_s_1005627936_gc8lc1of_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 15-APR-19

三,恢复

recover pluggable database SALESPDB;  恢复单个PDB
restore database; --全备恢复
recover database;
 
 
 
 
 
 

oracle 备份恢复篇(六)---基于12c的pdb备份与恢复的更多相关文章

  1. oracle 备份恢复篇(二)---rman 增备恢复--不完全恢复

    一,环境准备 全备脚本: export TMP=/tmp export TMPDIR=$TMP export ORACLE_BASE=/u01 export ORACLE_SID=prod expor ...

  2. oracle 备份恢复篇(三)---rman spfile的丢失

    一,环境准备 1, 拥有全备 数据 2, 查看spfile文件位置 SQL> SQL> SELECT NAME, VALUE, DISPLAY_VALUE FROM V$PARAMETER ...

  3. oracle 备份恢复篇(一)---rman

    一,rman介绍 RMAN(Recovery Manager)是随Oracle服务器软件一同安装的工具软件,它可以用来备份和恢复数据库文件.归档日志和控制文件,用来执行完全或不完全的数据库恢复.与传统 ...

  4. oracle 备份恢复篇(五)---rman 剩下控制文件和spfile

    一,环境准备 ❤ 拥有全量备份文件

  5. oracle 备份恢复篇(四)---rman 单个数据文件

    一,环境背景

  6. Oracle 备份恢复实例

    Oracle 备份恢复实例:三思笔记 1 shutdown abort 系统归档模式,有备份 create table xx as select * from emp; update xx set e ...

  7. Oracle备份恢复简单过程以及中间的坑.

    Oracle 冷备: 貌似需要dbca创建一致的oracle instance 服务器配置版本尽量相同,安装路径相同. 关闭Oracle服务 将oracle app 目录下的oradata以及有快速闪 ...

  8. oracle备份恢复

    1.oracle文件备份恢复 /etc/oraInst.loc /etc/oratab /home/oracle 家目录 /oracle 安装目录 /usr/local/bin/dbhome /usr ...

  9. Actifio中如何分析Oracle备份恢复的报错

    场景不同,可以分析的日志不同. 有关oracle备份 (L0/L1) 或者Oracle Log smart backups的日志:UDSAgent.log (on target host locate ...

随机推荐

  1. 通达OA整合教程

      资源下载地址: 通达OA 2015:http://pan.baidu.com/s/1qYMxsZU mysql下载:http://pan.baidu.com/s/1c2oVI5y 整合文件:htt ...

  2. Graphics 小记

    1.切图 drowg.DrawImage(productImg1, new System.Drawing.Rectangle(30, 30, 300, 300), new System.Drawing ...

  3. windows phone 换肤(2)

    //这里有篇参考文章 http://www.cnblogs.com/tianhonghui/p/3373276.html#commentform 以下思路是来自徐老师,昨晚看了一个晚上球赛,睡了不到6 ...

  4. Qt绘制简单的风向玫瑰图代码

    1.绘制简单的风向玫瑰图代码2.主要使用QPainter3.在子widget上绘制需要使用widget监视事件 eventfilter update();//更新界面 //镜头12 QPainter ...

  5. CPU 和 GPU 的区别

    作者:知乎用户链接:https://www.zhihu.com/question/19903344/answer/96081382来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注 ...

  6. 引用面试官文章 :如何准备Java初级和高级的技术面试

    本人最近几年一直在做java后端方面的技术面试官,而在最近两周,又密集了面试了一些java初级和高级开发的候选人,在面试过程中,我自认为比较慎重,遇到问题回答不好的候选人,我总会再三从不同方面提问,只 ...

  7. 深度学习之 TensorFlow(一):基础库包的安装

    1.TensorFlow 简介:TensorFlow 是谷歌公司开发的深度学习框架,也是目前深度学习的主流框架之一. 2.TensorFlow 环境的准备: 本人使用 macOS,Python 版本直 ...

  8. luoguP4782 [模板]2-SAT问题

    https://www.luogu.org/problemnew/show/P4782 2-SAT模板,输出方案只需判断 \(a\) 和 \(a + n\) 两个点所在的 scc 编号大小就可以了 # ...

  9. iis 重启命令

    打开IIS配置窗口的CMD命令:开始---运行---CMD----输入inetmgr  直接使用CMD我们可以操作很多事情,比如启动IIS,重启IIS,停止IIS 重启IIS服务器,开始->运行 ...

  10. select和epoll的实现

    select:fd_set是输入结果参数,每次select之后,还得重置fd_set (1)使用copy_from_user从用户空间拷贝fd_set到内核空间,第一步需要复制所有感兴趣的文件描述符到 ...