一,备份前提描述

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. Codeforces Round #272 (Div. 1) A. Dreamoon and Sums(数论)

    题目链接 Dreamoon loves summing up something for no reason. One day he obtains two integers a and b occa ...

  2. Ubuntu普通用户使用串口设备

    将普通用户加入dialout组,然后重启或注销登录 sudo gpasswd --add username dialout

  3. 编写高质量代码改善C#程序的157个建议——建议43:让接口中的泛型参数支持协变

    建议43:让接口中的泛型参数支持协变 除了上一建议中提到的使用泛型参数兼容接口不可变性外,还有一种办法是为接口中的泛型声明加上out关键字来支持协变,如下所示: interface ISalary&l ...

  4. OM—>AR相关会计科目

    业务会计核算 挑库:           借:发出商品 (递延销货成本) 贷:发出商品 (递延销货成本)   发运:           借:发出商品 (递延销货成本) 贷:库存商品/原材料 (库存估 ...

  5. C# -- 泛型(3)

    简介: 前两篇文章讲了关于泛型的一些基础,下面笔者通过这篇文章来给刚刚接触泛型的朋友介绍一下 <1>.原理性的东西----” 泛型的协变和逆变 “ <2>.以及常用的接口--- ...

  6. DB2触发器简单例子

    db2使用版本9.7 创建A .B两个表,A表数据有更新.删除.插入时,将A表ID记录放入B表 1.create table A (id varchar(5),name varchar(30)); c ...

  7. 分享我的第一个asp.net core开发过程

    .net core 这个东西感觉还是很不错的,学习了一下,并且做了一个微服务(IP地址查询服务) http://vju.cc/ip/ipquery 看上他的跨平台功能,所以就研究一下,中间有不少坑,有 ...

  8. Python编程笔记二进制、字符编码、数据类型

    Python编程笔记二进制.字符编码.数据类型 一.二进制 bin() 在python中可以用bin()内置函数获取一个十进制的数的二进制 计算机容量单位 8bit = 1 bytes 字节,最小的存 ...

  9. CentOS7.4关闭防火墙

    //临时关闭 systemctl stop firewalld //禁止开机启动 systemctl disable firewalld Removed symlink /etc/systemd/sy ...

  10. leetcode-229.求众数(二)

     题目: 给定一个大小为 n 的数组,找出其中所有出现超过 ⌊ n/3 ⌋ 次的元素. 说明: 要求算法的时间复杂度为O(n),空间复杂度为O(1). 示例 1: 输入: [3,2,3] 输出: [3 ...