Oracle 12c Recovering tables and table partitions 表或分区级别的恢复

    在12c之前,如果我们想将某些表单独恢复至之前的时间点(不考虑Flashback特性),通常都是利用RMAN的不一致性恢复功能,将必须的表空间或整个数据库恢复至另一单独的实例,实例恢复成功后再将表导出,然后再将表进行导入。这个过程还是很麻烦的,而且手工进行容易出错,恢复时间比较长。

    从Oracle 12c开始,可以使用RMAN的RECOVER TABLE命令来现实表或表分区级别的不完全恢复。
    Recover Table在下面的场景中可能被用到:
    1.你只想恢复数据库中的某几张表,但发现使用Restore Database或Tablespace的代价很高而且效率很低。
    2.对于用户误删除等逻辑方面的错误(drop or truncate),可以使用Recover Table进行恢复。
    3.对于undo内容已被覆盖Flashback Table无法完成恢复的情况下,可以使用Recover Table进行恢复。

    Oracle 12c的Recover Tables特性实际上我认为就是将本文开始提到的步骤全部自动化了,我们只需简单使用几条命令,剩下全部交由Oracle自动完成。这个新特性是利用创建辅助临时实例+数据泵工具实现的,通常在进行Recover Table之前我们应该准备好两个目录(AUXILIARY DESTINATION和DATAPUMP DESTINATION),一个用来临时存放辅助实例的数据文件,另一个用来临时存放数据泵导出的文件。想要使用Recover Tables,我们至少还得有system,sysaux,sysaux和包含了要恢复的表的表空间的备份。如果是PDB,那么我们必须得拥有ROOT container的undo,system,sysaux的备份和PDB的system,sysaux和包含了要恢复的表的表空间的备份。

    从本文下面的实验日志中我们可以看出,Recover Table的过程大致如下:
    1.在当前的环境中新建一个临时的辅助实例,辅助实例的数据文件存放在AUXILIARY DESTINATION指定的位置,这个辅助实例只包括了恢复所必须的system,sysaux,undo和表所在表空间对应的数据文件。
    2.对辅助实例进行不一致性恢复,可基于SCN,Timestamp,Log sequence。
    3.使用数据泵工具导出辅助实例中指定表或分区的数据,导出的文件存放在DATAPUMP DESTINATION指定位置。
    4.使用数据泵工具导入之前导出的表(可选),可对表进行重命名或指定表空间名称,也可以利用db link导入至其他数据库实例。
    5.清除上述过程产生的临时文件。

    使用Recover Table特性的几种限制:
    1.SYS用户下的表无法被recovered.
    2.SYSTEM和SYSAUX表空间下的表无法被recovered.
    3.standby端的表无法被recovered.
    4.带有NOT NULL约束的表无法被用于REMAP选项.

示例1:在PDB中恢复表HR.PDB_EMP,恢复后的表命名为EMP_RECVR
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';

示例2:从RMAN备份中恢复表SCOTT.EMP,SCOTT.DEPT,并以数据泵格式导出emp_dept_exp_dump.dat,并不进行表的导入
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;

示例3:恢复表的两个分区,恢复后表分区重新命名并且放置于SALES_PRE_2000_TS表空间
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';

下面是我在测试环境中进行的实验:将PDB中的一张表进行不完全恢复,恢复后导入并重命名。
SQL> conn pbadm/pbadm@xxxxxx:11521/ora12cpd
Connected.

SQL>  select sys_context('userenv','con_name') from dual;

SYS_CONTEXT('USERENV','CON_NAME')
-----------------------------------------------------------
ORA12CPD

SQL> create table tt as select * from dba_objects;

Table created.

SQL> alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';
Session altered.

SQL> select sysdate from dual;       --====>>>我们恢复的时间点
SYSDATE
-------------------
2016-05-27 11:09:04


SQL> select count(1) from tt;       --===>>>>>表中的原始记录数

  COUNT(1)
----------
     90936


SQL> delete from tt;                    ---=====>>>>模拟用户误删除

90936 rows deleted.


SQL> commit;
Commit complete.


SQL> select count(1) from tt;

  COUNT(1)
----------
         0

oracle@lzstix0itest12:~> rman target / 
Recovery Manager: Release 12.1.0.2.0 - Production on Fri May 27 11:33:00 2016
Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.
connected to target database: ORA12C (DBID=290586312)

RMAN> alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';
using target database control file instead of recovery catalog
Statement processed

RMAN> recover table pbadm.tt of pluggable database ora12cpd
2> until time "to_date('2016-05-27 11:09:04', 'yyyy-mm-dd hh24:mi:ss')"
3> auxiliary destination '/tmp/oracle' 
4> remap table 'PBADM'.'TT':'TT_RECVR';

Starting recover at 27-MAY-16
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=302 device type=DISK
RMAN-05026: WARNING: presuming following set of tablespaces applies to specified Point-in-Time

List of tablespaces expected to have UNDO segments
Tablespace SYSTEM
Tablespace UNDOTBS1

Creating automatic instance, with SID='DErk'

initialization parameters used for automatic instance:
db_name=ORA12C
db_unique_name=DErk_pitr_ora12cpd_ORA12C
compatible=12.1.0.2.0
db_block_size=8192
db_files=200
diagnostic_dest=/u01/app/oracle
_system_trig_enabled=FALSE
sga_target=2560M
processes=200
db_create_file_dest=/tmp/oracle
log_archive_dest_1='location=/tmp/oracle'
enable_pluggable_database=true
_clone_one_pdb_recovery=true
#No auxiliary parameter file used

starting up automatic instance ORA12C         --=======>>>>自助创建的辅助实例
Oracle instance started

Total System Global Area    2684354560 bytes
Fixed Size                     3714440 bytes
Variable Size                654312056 bytes
Database Buffers            2013265920 bytes
Redo Buffers                  13062144 bytes
Automatic instance created

contents of Memory Script:
{
# set requested point in time
set until  time "to_date('2016-05-27 11:09:04', 'yyyy-mm-dd hh24:mi:ss')";
# restore the controlfile
restore clone controlfile;
 
# mount the controlfile
sql clone 'alter database mount clone database';
 
# archive current online log 
sql 'alter system archive log current';
}
executing Memory Script

executing command: SET until clause

Starting restore at 27-MAY-16
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=191 device type=DISK


channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: reading from backup piece /u01/app/oracle/fast_recovery_area/ORA12C/autobackup/2016_05_27/o1_mf_s_912936317_cnh8hx2x_.bkp
channel ORA_AUX_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/ORA12C/autobackup/2016_05_27/o1_mf_s_912936317_cnh8hx2x_.bkp tag=TAG20160527T092517
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/tmp/oracle/ORA12C/controlfile/o1_mf_cnhhf5xf_.ctl
Finished restore at 27-MAY-16

sql statement: alter database mount clone database
sql statement: alter system archive log current

contents of Memory Script:
{
# set requested point in time
set until  time "to_date('2016-05-27 11:09:04', 'yyyy-mm-dd hh24:mi:ss')";
# set destinations for recovery set and auxiliary set datafiles
set newname for clone datafile  1 to new;
set newname for clone datafile  4 to new;
set newname for clone datafile  3 to new;
set newname for clone datafile  17 to new;
set newname for clone datafile  18 to new;
set newname for clone tempfile  1 to new;
set newname for clone tempfile  4 to new;
# switch all tempfiles
switch clone tempfile all;
# restore the tablespaces in the recovery set and the auxiliary set
restore clone datafile  1, 4, 3, 17, 18;                    --====>>>>>>1,3,4,17,18号数据文件为ROOT的system,sysaux,undo和ora12cpd的system, sysaux
 
switch clone datafile all;
}
executing Memory Script

executing command: SET until clause
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME

renamed tempfile 1 to /tmp/oracle/ORA12C/datafile/o1_mf_temp_%u_.tmp in control file
renamed tempfile 4 to /tmp/oracle/ORA12C/datafile/o1_mf_temp_%u_.tmp in control file

Starting restore at 27-MAY-16
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00001 to /tmp/oracle/ORA12C/datafile/o1_mf_system_%u_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00004 to /tmp/oracle/ORA12C/datafile/o1_mf_undotbs1_%u_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00003 to /tmp/oracle/ORA12C/datafile/o1_mf_sysaux_%u_.dbf
channel ORA_AUX_DISK_1: reading from backup piece /u01/app/oracle/fast_recovery_area/ORA12C/backupset/2016_05_27/o1_mf_nnndf_TAG20160527T091026_cnh7n323_.bkp
channel ORA_AUX_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/ORA12C/backupset/2016_05_27/o1_mf_nnndf_TAG20160527T091026_cnh7n323_.bkp tag=TAG20160527T091026
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:15
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00017 to /tmp/oracle/ORA12C/datafile/o1_mf_system_%u_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00018 to /tmp/oracle/ORA12C/datafile/o1_mf_sysaux_%u_.dbf
channel ORA_AUX_DISK_1: reading from backup piece /u01/app/oracle/fast_recovery_area/ORA12C/33ABAC8133770B4DE0530A562EA0BF77/backupset/2016_05_27/o1_mf_nnndf_TAG20160527T092513_cnh8hsyp_.bkp
channel ORA_AUX_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/ORA12C/33ABAC8133770B4DE0530A562EA0BF77/backupset/2016_05_27/o1_mf_nnndf_TAG20160527T092513_cnh8hsyp_.bkp tag=TAG20160527T092513
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:07
Finished restore at 27-MAY-16

datafile 1 switched to datafile copy
input datafile copy RECID=8 STAMP=912943425 file name=/tmp/oracle/ORA12C/datafile/o1_mf_system_cnhhfcqv_.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=9 STAMP=912943425 file name=/tmp/oracle/ORA12C/datafile/o1_mf_undotbs1_cnhhfcr1_.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=10 STAMP=912943425 file name=/tmp/oracle/ORA12C/datafile/o1_mf_sysaux_cnhhfcqy_.dbf
datafile 17 switched to datafile copy
input datafile copy RECID=11 STAMP=912943425 file name=/tmp/oracle/ORA12C/datafile/o1_mf_system_cnhhfttp_.dbf
datafile 18 switched to datafile copy
input datafile copy RECID=12 STAMP=912943425 file name=/tmp/oracle/ORA12C/datafile/o1_mf_sysaux_cnhhfttm_.dbf

contents of Memory Script:
{
# set requested point in time
set until  time "to_date('2016-05-27 11:09:04', 'yyyy-mm-dd hh24:mi:ss')";
# online the datafiles restored or switched
sql clone "alter database datafile  1 online";
sql clone "alter database datafile  4 online";
sql clone "alter database datafile  3 online";
sql clone 'ORA12CPD' "alter database datafile 
 17 online";
sql clone 'ORA12CPD' "alter database datafile 
 18 online";
# recover and open database read only
recover clone database tablespace  "SYSTEM", "UNDOTBS1", "SYSAUX", "ORA12CPD":"SYSTEM", "ORA12CPD":"SYSAUX";
sql clone 'alter database open read only';
}
executing Memory Script

executing command: SET until clause
sql statement: alter database datafile  1 online
sql statement: alter database datafile  4 online
sql statement: alter database datafile  3 online
sql statement: alter database datafile  17 online
sql statement: alter database datafile  18 online

Starting recover at 27-MAY-16
using channel ORA_AUX_DISK_1

starting media recovery
archived log for thread 1 with sequence 42 is already on disk as file /u01/app/oracle/fast_recovery_area/ORA12C/archivelog/2016_05_27/o1_mf_1_42_cnhgksrf_.arc
archived log for thread 1 with sequence 43 is already on disk as file /u01/app/oracle/fast_recovery_area/ORA12C/archivelog/2016_05_27/o1_mf_1_43_cnhgnpph_.arc
archived log file name=/u01/app/oracle/fast_recovery_area/ORA12C/archivelog/2016_05_27/o1_mf_1_42_cnhgksrf_.arc thread=1 sequence=42
archived log file name=/u01/app/oracle/fast_recovery_area/ORA12C/archivelog/2016_05_27/o1_mf_1_43_cnhgnpph_.arc thread=1 sequence=43
media recovery complete, elapsed time: 00:00:01
Finished recover at 27-MAY-16

sql statement: alter database open read only

contents of Memory Script:
{
sql clone 'alter pluggable database  ORA12CPD open read only';
}
executing Memory Script

sql statement: alter pluggable database  ORA12CPD open read only

contents of Memory Script:
{
   sql clone "create spfile from memory";
   shutdown clone immediate;
   startup clone nomount;
   sql clone "alter system set  control_files = 
  ''/tmp/oracle/ORA12C/controlfile/o1_mf_cnhhf5xf_.ctl'' comment=
 ''RMAN set'' scope=spfile";
   shutdown clone immediate;
   startup clone nomount;
# mount database
sql clone 'alter database mount clone database';
}
executing Memory Script

sql statement: create spfile from memory

database closed
database dismounted
Oracle instance shut down
connected to auxiliary database (not started)
Oracle instance started

Total System Global Area    2684354560 bytes
Fixed Size                     3714440 bytes
Variable Size                671089272 bytes
Database Buffers            1996488704 bytes
Redo Buffers                  13062144 bytes

sql statement: alter system set  control_files =   ''/tmp/oracle/ORA12C/controlfile/o1_mf_cnhhf5xf_.ctl'' comment= ''RMAN set'' scope=spfile
Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area    2684354560 bytes

Fixed Size                     3714440 bytes
Variable Size                671089272 bytes
Database Buffers            1996488704 bytes
Redo Buffers                  13062144 bytes
sql statement: alter database mount clone database

contents of Memory Script:
{
# set requested point in time
set until  time "to_date('2016-05-27 11:09:04', 'yyyy-mm-dd hh24:mi:ss')";
# set destinations for recovery set and auxiliary set datafiles
set newname for datafile  19 to new;
# restore the tablespaces in the recovery set and the auxiliary set
restore clone datafile  19;                     --=====>>>>>我ora12cpd中是存在19号文件的,这里从归档日志里 新建了19号文件,是与我创建的表 在归档日志中的原因。
 
switch clone datafile all;
}
executing Memory Script

executing command: SET until clause
executing command: SET NEWNAME
Starting restore at 27-MAY-16
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=191 device type=DISK
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00019 to /tmp/oracle/DERK_PITR_ORA12CPD_ORA12C/datafile/o1_mf_sales_%u_.dbf
channel ORA_AUX_DISK_1: reading from backup piece /u01/app/oracle/fast_recovery_area/ORA12C/33ABAC8133770B4DE0530A562EA0BF77/backupset/2016_05_27/o1_mf_nnndf_TAG20160527T092513_cnh8hsyp_.bkp
channel ORA_AUX_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/ORA12C/33ABAC8133770B4DE0530A562EA0BF77/backupset/2016_05_27/o1_mf_nnndf_TAG20160527T092513_cnh8hsyp_.bkp tag=TAG20160527T092513
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 27-MAY-16

datafile 19 switched to datafile copy
input datafile copy RECID=14 STAMP=912943475 file name=/tmp/oracle/DERK_PITR_ORA12CPD_ORA12C/datafile/o1_mf_sales_cnhhhkyz_.dbf
contents of Memory Script:
{
# set requested point in time
set until  time "to_date('2016-05-27 11:09:04', 'yyyy-mm-dd hh24:mi:ss')";
# online the datafiles restored or switched
sql clone 'ORA12CPD' "alter database datafile 
 19 online";
# recover and open resetlogs
recover clone database tablespace  "ORA12CPD":"SALES", "SYSTEM", "UNDOTBS1", "SYSAUX", "ORA12CPD":"SYSTEM", "ORA12CPD":"SYSAUX" delete archivelog;
alter clone database open resetlogs;
}
executing Memory Script

executing command: SET until clause

sql statement: alter database datafile  19 online

Starting recover at 27-MAY-16
using channel ORA_AUX_DISK_1
starting media recovery
archived log for thread 1 with sequence 42 is already on disk as file /u01/app/oracle/fast_recovery_area/ORA12C/archivelog/2016_05_27/o1_mf_1_42_cnhgksrf_.arc
archived log for thread 1 with sequence 43 is already on disk as file /u01/app/oracle/fast_recovery_area/ORA12C/archivelog/2016_05_27/o1_mf_1_43_cnhgnpph_.arc
archived log file name=/u01/app/oracle/fast_recovery_area/ORA12C/archivelog/2016_05_27/o1_mf_1_42_cnhgksrf_.arc thread=1 sequence=42
archived log file name=/u01/app/oracle/fast_recovery_area/ORA12C/archivelog/2016_05_27/o1_mf_1_43_cnhgnpph_.arc thread=1 sequence=43
media recovery complete, elapsed time: 00:00:00
Finished recover at 27-MAY-16

database opened
contents of Memory Script:
{
sql clone 'alter pluggable database  ORA12CPD open';
}
executing Memory Script

sql statement: alter pluggable database  ORA12CPD open
contents of Memory Script:
{
# create directory for datapump import           ---====>>>>创建导入导出所需的目录
sql 'ORA12CPD' "create or replace directory 
TSPITR_DIROBJ_DPDIR as ''
/tmp/oracle''";
# create directory for datapump export
sql clone 'ORA12CPD' "create or replace directory 
TSPITR_DIROBJ_DPDIR as ''
/tmp/oracle''";
}
executing Memory Script

sql statement: create or replace directory TSPITR_DIROBJ_DPDIR as ''/tmp/oracle''
sql statement: create or replace directory TSPITR_DIROBJ_DPDIR as ''/tmp/oracle''
Performing export of tables...
   EXPDP> Starting "SYS"."TSPITR_EXP_DErk_gqEy":  
   EXPDP> Estimate in progress using BLOCKS method...
   EXPDP> Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
   EXPDP> Total estimation using BLOCKS method: 13 MB
   EXPDP> Processing object type TABLE_EXPORT/TABLE/TABLE
   EXPDP> Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
   EXPDP> Processing object type TABLE_EXPORT/TABLE/STATISTICS/MARKER
   EXPDP> . . exported "PBADM"."TT"                                10.36 MB   90936 rows             ---=====>>>执行表的导出
   EXPDP> Master table "SYS"."TSPITR_EXP_DErk_gqEy" successfully loaded/unloaded
   EXPDP> ******************************************************************************
   EXPDP> Dump file set for SYS.TSPITR_EXP_DErk_gqEy is:
   EXPDP>   /tmp/oracle/tspitr_DErk_61246.dmp
   EXPDP> Job "SYS"."TSPITR_EXP_DErk_gqEy" successfully completed at Fri May 27 11:24:57 2016 elapsed 0 00:00:15
Export completed
contents of Memory Script:
{
# shutdown clone before import
shutdown clone abort
}
executing Memory Script
Oracle instance shut down

Performing import of tables...
   IMPDP> Master table "SYS"."TSPITR_IMP_DErk_bgri" successfully loaded/unloaded
   IMPDP> Starting "SYS"."TSPITR_IMP_DErk_bgri":  
   IMPDP> Processing object type TABLE_EXPORT/TABLE/TABLE
   IMPDP> Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
   IMPDP> . . imported "PBADM"."TT_RECVR"                          10.36 MB   90936 rows             ---=====>>>>执行表的导入和重命名
   IMPDP> Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
   IMPDP> Processing object type TABLE_EXPORT/TABLE/STATISTICS/MARKER
   IMPDP> Job "SYS"."TSPITR_IMP_DErk_bgri" successfully completed at Fri May 27 11:25:20 2016 elapsed 0 00:00:17
Import completed


Removing automatic instance            --====>>>>>自动清理生成的临时文件
Automatic instance removed
auxiliary instance file /tmp/oracle/ORA12C/datafile/o1_mf_temp_cnhhg50w_.tmp deleted
auxiliary instance file /tmp/oracle/ORA12C/datafile/o1_mf_temp_cnhhg48y_.tmp deleted
auxiliary instance file /tmp/oracle/DERK_PITR_ORA12CPD_ORA12C/onlinelog/o1_mf_3_cnhhhnyk_.log deleted
auxiliary instance file /tmp/oracle/DERK_PITR_ORA12CPD_ORA12C/onlinelog/o1_mf_2_cnhhhntg_.log deleted
auxiliary instance file /tmp/oracle/DERK_PITR_ORA12CPD_ORA12C/onlinelog/o1_mf_1_cnhhhnpv_.log deleted
auxiliary instance file /tmp/oracle/DERK_PITR_ORA12CPD_ORA12C/datafile/o1_mf_sales_cnhhhkyz_.dbf deleted
auxiliary instance file /tmp/oracle/ORA12C/datafile/o1_mf_sysaux_cnhhfttm_.dbf deleted
auxiliary instance file /tmp/oracle/ORA12C/datafile/o1_mf_system_cnhhfttp_.dbf deleted
auxiliary instance file /tmp/oracle/ORA12C/datafile/o1_mf_sysaux_cnhhfcqy_.dbf deleted
auxiliary instance file /tmp/oracle/ORA12C/datafile/o1_mf_undotbs1_cnhhfcr1_.dbf deleted
auxiliary instance file /tmp/oracle/ORA12C/datafile/o1_mf_system_cnhhfcqv_.dbf deleted
auxiliary instance file /tmp/oracle/ORA12C/controlfile/o1_mf_cnhhf5xf_.ctl deleted
auxiliary instance file tspitr_DErk_61246.dmp deleted
Finished recover at 27-MAY-16
RMAN> 
--验证数据
SQL> select count(1) from pbadm.tt_recvr;
  COUNT(1)
----------
     90936

如此全自动的Recover Table特性,我们是否再也不怕用户级的误删除了呢?了解了恢复过程就可以知道,这个过程我们在12c之前也可以手动完成,只不过现在变成自动化了,另外恢复的过程对当前的主机资源要有一定的消耗,是否采用这种恢复方式还得根据现场情况而定。

尽管oracle 12c提供了表或分区级别的恢复能力,在实际环境中如果有人误删了表,第一选择仍然是通过回收站或者闪回特性来进行恢复,如果两种方法均无法恢复,最后才是采用RMAN的Recover Table特性。

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26753337/viewspace-2107978/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/26753337/viewspace-2107978/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值