RMAN可以通过创建auxiliary database使用备份对表进行时间点恢复而不影响其它对象

RMAN enables you to recover one or more tables or table partitions to a specified point in time without affecting the remaining database objects.

You can use previously-created RMAN backups to recover tables and table partitions to a specified point in time. RMAN creates an auxiliary database that is used to recover tables or table partitions to the specified point in time.

Recovering tables and table partitions from RMAN backups is useful in the following scenarios:

  1. You need to recover a very small number of tables to a particular point in time.
  2. You need to recover tables that have been logically corrupted or have been dropped and purged.
  3. Flashback Table is not possible because the desired point-in-time is older than available undo.
  4. You want to recover data that is lost after a DDL operation modified the structure of tables. Using Flashback Table is not possible because a DDL was run on the tables between the desired point in time and the current time. Flashback Table cannot rewind tables through structural changes such as a truncate table operation.

(一)Limitations of Recovering Tables and Table Partitions

To recover table or table partitions, you need a full backup of undo, SYSTEM, SYSAUX, and the tablespace that contains the table or table partition.

To recover a table, all partitions that contain the dependent objects of the table must be included in the recovery set. If the indexes or partitions for a table in tablespace tbs1 are contained in tablespace tbs2, then you can recover the table only if tablepsace tbs2 is also included in the recovery set.

To recover tables in a PDB, you need backups of the following:

SYSTEM, SYSAUX, and undo tablespace of the root, CDB seed, and the PDB containing the tables

Tablespace containing the tables or partitions

When you use the RECOVER command to recover tables or table partitions contained in an RMAN backup, the following limitations exist.

  1. Tables and table partitions belonging to SYS schema cannot be recovered.
  2. Tables and table partitions from SYSTEM and SYSAUX tablespaces cannot be recovered.
  3. Tables and table partitions on standby databases cannot be recovered.
  4. Tables with named NOT NULL constraints cannot be recovered with the REMAP option.

Steps By RMAN to Recover Tables and Table Partitions

RMAN performs the following steps while automating the process of recovering tables or table partitions from an RMAN backup:

  1. Determines which backup contains the tables or table partitions that need to be recovered, based on the point in time specified for the recovery.
  2. Determines if there is sufficient space on the target host to create the auxiliary instance that will be used during the table or partition recovery process.
  3. Creates an auxiliary database on the target host and recovers the specified tables or table partitions, until the specified point in time, into this auxiliary database.
  4. Creates a Data Pumpexport dump file that contains the recovered tables or table partitions.
  5. (Optional) Imports the Data Pump export dump file into the target instance.

You can choose not to import the export dump file that contains the recovered tables or table partitions into the target database. If you do not import the export dump file as part of the recovery process, you must manually import it later using the Data Pump Import utility.

  1. (Optional) Renames the recovered tables or table partitions in the target database.

You can also import recovered objects into a tablespace or schema that is different from the one in which they originally existed.

Settings of Data Pump Export Dump Files

1. Data Pump Export Dump File Used During RMAN Table Recovery

使用datadump destination选项设置导出文件位置,dump file指定文件名。如果未指定则使用AUXILIARY DESTINATION 设置路径

You can either specify a name and location for this dump file or allow RMAN to use a default name and location.

Use the DATAPUMP DESTINATION clause ofthe RECOVER command to specify the location in which the Data Pump export dump file is created. The location is typically the path of the operating-system directory that stores the dump file. If you omit this clause, the dump file is stored in the location specified by the AUXILIARY DESTINATION parameter. If you do not specify an auxiliary destination, the dump file is stored in a default operating system-specific location. On Linux, this default location is $ORACLE_HOME/dbs. On Windows, the default location is %ORACLE_HOME\database.

Use the DUMP FILE clause of the RECOVER command to specify the name of the Data Pump export dump file. If you omit this clause, RMAN uses a default operating system-specific name for the dump file. On Linux and Windows, the default dump file name is tspitr_SID-of-clone_n.dmp, where SID-of-clone is the Oracle SID of the auxiliary database created by RMAN to perform the recovery and n is any randomly-generated number. If a file with the name specified by DUMP FILE exists in the location in which the dump file must be created, then the recover operation fails.

  1. Importing Recovered Tables and Table Partitions into the Target Database

默认会把dump file导入到target database,使用NOTABLEIMPORT选项不导入

By default, RMAN imports the recovered tables or table partitions, which are stored in the export dump file, into the target database. However, you can choose not to import the recovered tables or table partitions by using the NOTABLEIMPORT clause of the RESTORE command.

When NOTABLEIMPORT is used, You must manually import this dump file into your target database, when required, by using the Data Pump Import utility.

If an error occurs during the import operation, RMAN does not delete the export dump file at the end of the table recovery. This enables you to manually import the dump file.

  1. Renaming Recovered Tables and Table Partitions During RMAN Recovery

在导入时还可以使用REMAP TABLE子句重命名导入表名

When you recover tables or table partitions, you can rename the recovered objects after they are imported into the target database. TheREMAP TABLE clause enables you to rename recovered tables or table partitions in your target database.

使用REMAP TABLESPACE来转化使用表空间

To import the recovered tables or table partitions into a tablespace that is different from the one in which these objects originally existed, use the REMAP TABLESPACE clause of the RECOVER command. Only the tables or table partitions that are being recovered are remapped, the existing objects are not changed.

如果恢复分区表会导入为单个表

When you recover table partitions,each table partition is recovered into a separate table. Use the REMAP TABLE clause to specify the table names into which each recovered partition must be imported. If you do not explicitly specify table names, RMAN generates table names by concatenating the recovered table name and partition name. The generated names are in the format tablename_partitionname. If a table with this name exists in the target database, then RMAN appends _1 to the name. If this name too exists, then RMAN appends _2 to the name and so on.

在使用REMAP选项时不会再导入约束与索引

Note: When you use theREMAPoption, any named constraints and indexes are not imported. This is to avoid name conflicts with existing tables.

  1.  Recovering Tables and Partitions Into a New Schema

Starting with Oracle Database 12c Release 2 (12.2), you can recover tables or table partitions into a schema that is different from the source schema (the schema in which they originally existed). While recovering objects into a different schema, you can either retain their original names or rename them. You can rename tables and remap the schema in a single recovery operation.

同样使用REMAP TABLE来转化schema

During table recovery, use the REMAP TABLE clause of the RECOVER TABLE command to map the source schema to a new schema. The new schema must exist in the target database before you perform the recovery.

Note: Table recovery is not supported on physical standby databases. For logical standby databases, objects that are recovered on the primary database are propagated to the logical standby.

(四)Preparing to Recover Tables and Table Partitions

  1. Prerequisites for Recovering Tables and Table Partitions
  1. The target database must be in read-write mode.
  2. The target database must be in ARCHIVELOG mode.
  3. You must have RMAN backups of the tables or table partitions as they existed at the point in time to which you want recover these objects.
  4. To recover single table partitions, the COMPATIBLE initialization parameter for target database must be set to 11.1.0 or higher.
  1. Determining the Point-in-time Must be Recovered

RMAN enables you to specify the required point in time using one of the following:

SCN/TIME/SEQUENCE NUMBER

(五)Recovering Tables and Table Partitions

This section describes the steps required to recover tables or table partitions in a non-CDB to a specified point in time.

To recover tables or table partitions to a specified point in time:

  1. Perform the planning tasks described in "Preparing to Recover Tables and Table Partitions".
  2. Start RMAN and connect as TARGET to the target database. You must connect as a user with the SYSBACKUP or SYSDBA privilege.
  3. Recover the selected tables or table partitions to the specified point in time by using the RECOVER TABLE command. You must use the AUXILIARY DESTINATION clause and one of the following clauses to specify the point in time for recovery: UNTIL TIME, UNTIL SCN, or UNTIL SEQUENCE.

You can use the following additional clauses in the RECOVER command:

DUMP FILE and DATAPUMP DESTINATION

NOTABLEIMPORT

REMAP TABLE

REMAP TABLESPACE

Example: Recovering Tables to a Specified Point in Time

RECOVER TABLE SCOTT.EMP, SCOTT.DEPT

UNTIL TIME 'SYSDATE-1'

AUXILIARY DESTINATION '/tmp/oracle/recover'

DATAPUMP DESTINATION '/tmp/recover/dumpfiles'

DUMP FILE 'emp_dept_exp_dump.dat'

NOTABLEIMPORT;

Example: Recovering Table Partitions to a Specified Log Sequence Number(分区表)

RECOVER TABLE SH.SALES:SALES_1998, SH.SALES:SALES_1999

UNTIL SEQUENCE 354

AUXILIARY DESTINATION '/tmp/oracle/recover'

REMAP TABLE 'SH'.'SALES':'SALES_1998':'HISTORIC_SALES_1998',

'SH'.'SALES':'SALES_1999':'HISTORIC_SALES_1999'

REMAP TABLESPACE 'SALES_TS':'SALES_PRE_2000_TS';

Example: Recovering a Table into a New Schema

RECOVER TABLE HR.DEPARTMENTS, SH.CHANNELS

UNTIL TIME 'SYSDATE – 1'

AUXILIARY DESTINATION '/tmp/auxdest'

REMAP TABLE hr.departments:example.new_departments, sh.channels:example.new_channels;

(六)Recovering Tables and Table Partitions in PDBs

RMAN enables you to recover one or more tables or table partitions in a pluggable database (PDB) to a specified point-in-time without impacting other objects in the PDB. The steps used to recover tables or table partitions in a PDB are similar to the ones used for non-CDBs, with the differences described in this section.

To recover tables or table partitions in a PDB:

  1. Perform the planning tasks described in "Preparing to Recover Tables and Table Partitions".
  2. Start RMAN and connect to the root as a user with the SYSDBA or SYSBACKUP privilege.
  3. Recover the tables or table partitions to the specified point in time by using theRECOVER TABLE ... OF PLUGGABLE DATABASEcommand.

You must use the AUXILIARY DESTINATION clause and one of the following clauses: UNITL TIME, UNTIL SCN, or UNTIL SEQUENCE.

Depending on your requirements, you may also need to use the one or more of the following clauses: DUMP FILE, DATAPUMP DESTINATION, NOTABLEIMPORT, REMAP TABLE, or REMAP TABLESPACE.

RECOVER TABLE HR.PDB_EMP OF PLUGGABLE DATABASE HR_PDB

UNTIL TIME 'SYSDATE-4'

AUXILIARY DESTINATION '/tmp/backups'

REMAP TABLE 'HR'.'PDB_EMP':'EMP_RECVR';

Recovering Tables and Table Partitions相关推荐

  1. 2 Tables and Table Clusters读书笔记

    文章出处 Home / Database / Oracle Database Online Documentation 11g Release 2 (11.2) / Database Administ ...

  2. mysql 命令desc tables_oracle中与mysql中的命令 show databases, show tables, desc table类似的命令集...

    mysql> show tables -> ; +----------------+ | Tables_in_test | +----------------+ | sale_report ...

  3. oracle exp 00006,Oracle 12.1新特性----使用RMAN从备份中实现recover table

    Oracle 12.1新特性----使用RMAN从备份中实现recover table 发布时间:2020-06-26 19:41:44 来源:51CTO 阅读:4750 作者:hbxztc 在Ora ...

  4. OCP12C题库,63数据库管理( Administration Workshop- 63)(新增)

    题数:13+12 8 月 新增63题库: 01 which thre statements are true about unlugging a pluggable database(PDB)? 关于 ...

  5. 【原创】大叔经验分享(33)hive select count为0

    hive建表后直接将数据文件拷贝到table目录下,select * 可以查到数据,但是select count(1) 一直返回0,这个是因为hive中有个配置 hive.stats.autogath ...

  6. linux导出表数据dmp,导出表的部分数据到dmp文件中

    例子: exp buffer=4096 log=e:\ic10.log file=e:\ic10.dmp query='where aab001=''13040100706''' tables=(ic ...

  7. Oracle ILM相关(Information lifecycle management)

    一. 信息生命周期管理简介 1. 概念 ILM(Information lifecycle management)这个概念诞生于上世纪60-70年代,由StorageTek(2010年被Oracle收 ...

  8. 逻辑备份和物理备份表级恢复

    一.逻辑备份(schema级备份,表级,分区级恢复) 1. 建表 create table test.test_partition(id number) partition by range(id) ...

  9. clickhouse-backup 备份恢复测试

    一.安装配置 1. 下载 https://github.com/AlexAkulov/clickhouse-backup/releases 2. 安装 [root@backup-db ~]# rpm ...

最新文章

  1. 逃离无声的世界,跟AI一起听叶落的声音
  2. Python Numpy介绍
  3. Winpcap 中sockaddr_storage问题收藏
  4. 更新版-梳理前端开发使用eslint和prettier来检查和格式化代码问题
  5. 9月13日学习内容整理:异常处理
  6. 标准化工作导则2020_最新版 GB/T 1.12020 标准化工作导则 第 1 部分:标准化文件的结构和起草规则标准解读...
  7. ssm idea后端接收数据输出在控制台时出现中文乱码
  8. 小白的算法初识课堂(part9)--SHA及Simhash算法
  9. 聊聊如何构建一支自驱团队(一)
  10. leetcode 74. 搜索二维矩阵(二分)
  11. (2) 第二章 WCF服务与数据契约 服务契约详解(三)- [ServiceContract]特性
  12. Oracle数据库的三种标准的备份方法
  13. 25+ 个单色背景的网页设计实例
  14. python层次聚类法画图_原理+代码|详解层次聚类及Python实现
  15. 陈玉琴老师的中医理学
  16. matlab世界坐标系转化,坐标变换_世界坐标系与用户坐标系之间的转换
  17. 易地图google版,可精确经纬度查询定位
  18. 本地系统盘放到服务器上,如何将本地盘映射在云服务器上
  19. vue cli关闭eslint语法检查
  20. Photoshop基础教程一:界面及新建

热门文章

  1. 如何实现session共享的几种解决方案?
  2. xampp安装与配置、PHP环境配置
  3. C语言——结构体(全)
  4. 《支付系统-收银台设计》
  5. 邮件发送--局域网中配置James邮件服务器(二)
  6. [附源码]计算机毕业设计Python创意摄影交流平台(程序+源码+LW文档)
  7. Android APP间跳转
  8. c语言程序菜鸟教程,菜鸟教程C语言-4
  9. 基于python实现FPS(最远距离采样)
  10. 2016年猴年春联节选