oracle12c之表级别恢复

表/表分区级别的恢复存在如下限制:
1.SYS用户下的表/表分区无法进行恢复。
2.SYSTEM/SYSAUX表空间中的表/表分区无法进行恢复。
有的文章说带有非空约束的表在用remap参数时无法恢复,12.2亲测是可以的。最后有测试结果。

创建表
SQL> sho user con_name
USER is "MING"

CON_NAME
------------------------------
MINGPDB1

SQL> create table ming as select * from BD_CIC_TRANS_TRACE;

Table created.

SQL> select count(*) from ming;

COUNT(*)
----------
   1694383

SQL> select index_name from user_indexes where table_name='MING';

INDEX_NAME
--------------------------------------------------------------------------------
SYS_IL0000027600C00010$$
该表具有lob字段。

创建索引
SQL> create index ming_idx_01 on ming(oid);

Index created.

RMAN> backup format '/opt/backup/fulldb_%d_%U' database;

Starting backup at 10-AUG-18
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=00014 name=/opt/mingdbdata/data/MINGPDB1/soe01.dbf
input datafile file number=00008 name=/opt/mingdbdata/data/MINGPDB1/system01.dbf
input datafile file number=00009 name=/opt/mingdbdata/data/MINGPDB1/sysaux01.dbf
input datafile file number=00015 name=/opt/mingdbdata/data/MINGPDB1/tbs_ming01.dbf
input datafile file number=00016 name=/opt/mingdbdata/data/MINGPDB1/tbs_ming02.dbf
input datafile file number=00010 name=/opt/mingdbdata/data/MINGPDB1/undotbs01.dbf
input datafile file number=00011 name=/opt/mingdbdata/data/MINGPDB1/tbs_pdbadmin01.dbf
channel ORA_DISK_1: starting piece 1 at 10-AUG-18
channel ORA_DISK_1: finished piece 1 at 10-AUG-18
piece handle=/opt/backup/fulldb_MINGDB_3jta78f7_1_1 tag=TAG20180810T142543 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:05
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=/opt/mingdbdata/data/MINGDB/datafile/o1_mf_system_fn8w9k88_.dbf
input datafile file number=00003 name=/opt/mingdbdata/data/MINGDB/datafile/o1_mf_sysaux_fn8w9tvc_.dbf
input datafile file number=00005 name=/opt/mingdbdata/data/MINGDB/datafile/o1_mf_undotbs1_fn8wb0wo_.dbf
input datafile file number=00007 name=/opt/mingdbdata/data/MINGDB/datafile/o1_mf_users_fn8wbl6h_.dbf
channel ORA_DISK_1: starting piece 1 at 10-AUG-18
channel ORA_DISK_1: finished piece 1 at 10-AUG-18
piece handle=/opt/backup/fulldb_MINGDB_3kta78h9_1_1 tag=TAG20180810T142543 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00002 name=/opt/mingdbdata/data/MINGDB/70A2182C94E1412DE053B7D91FAC647A/datafile/o1_mf_system_fn8w9pls_.dbf
input datafile file number=00004 name=/opt/mingdbdata/data/MINGDB/70A2182C94E1412DE053B7D91FAC647A/datafile/o1_mf_sysaux_fn8w9yob_.dbf
input datafile file number=00006 name=/opt/mingdbdata/data/MINGDB/70A2182C94E1412DE053B7D91FAC647A/datafile/o1_mf_undotbs1_fn8wb2lm_.dbf
channel ORA_DISK_1: starting piece 1 at 10-AUG-18
channel ORA_DISK_1: finished piece 1 at 10-AUG-18
piece handle=/opt/backup/fulldb_MINGDB_3lta78ho_1_1 tag=TAG20180810T142543 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 10-AUG-18

Starting Control File and SPFILE Autobackup at 10-AUG-18
piece handle=/opt/app/oracle/product/12.2.0/db_1/dbs/c-2547745710-20180810-03 comment=NONE
Finished Control File and SPFILE Autobackup at 10-AUG-18

当前scn
SQL> select current_scn from v$database;

CURRENT_SCN
-----------
    9561483

彻底删除表
SQL> drop table ming purge;

Table dropped.

SQL> select current_scn from v$database;

CURRENT_SCN
-----------
    9561633

创建测试数据查看的影响
SQL> create table tag_9561633 as select * from user_objects;

Table created.

SQL> select count(*) from tag_9561633;

COUNT(*)
----------
        36

RMAN> recover table ming.ming OF PLUGGABLE DATABASE MINGPDB1 until scn 9561483 auxiliary destination '/tmp';

Removing automatic instance
shutting down automatic instance
Oracle instance shut down
Automatic instance removed
auxiliary instance file /tmp/MINGDB/70B59C073DE92098E053B7D91FACCD7E/datafile/o1_mf_system_fptd9z7b_.dbf deleted
auxiliary instance file /tmp/MINGDB/controlfile/o1_mf_fptd9s43_.ctl deleted
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 08/10/2018 14:31:51
RMAN-03015: error occurred in stored script Memory Script
ORA-19625: error identifying file /opt/app/oracle/product/12.2.0/db_1/dbs/3eta77vr_1_1
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 7
RMAN-05122: there is insufficient disk space to perform this table recovery
第一次尝试恢复报错,磁盘空间不够,观察恢复过程,貌似在做全库resotre,剩余空间还剩5G,所以空间不够了。重新挂块100G的盘,换一个空间。

RMAN> recover table ming.ming OF PLUGGABLE DATABASE MINGPDB1 until scn 9561483 auxiliary destination '/u01';

Starting recover at 10-AUG-18
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=41 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 MINGPDB1:SYSTEM
Tablespace UNDOTBS1
Tablespace MINGPDB1:UNDOTBS1
############################################################################################
可以看到创建了一个辅助实例,实例名tiEu,跟ps -ef看到的一致
############################################################################################
Creating automatic instance, with SID='tiEu'

initialization parameters used for automatic instance:
db_name=MINGDB
db_unique_name=tiEu_pitr_MINGPDB1_MINGDB
compatible=12.2.0
db_block_size=8192
db_files=8192
diagnostic_dest=/opt/app/oracle
_system_trig_enabled=FALSE
sga_target=3248M
processes=200
db_create_file_dest=/u01
log_archive_dest_1='location=/u01'
enable_pluggable_database=true
_clone_one_pdb_recovery=true
#No auxiliary parameter file used

starting up automatic instance MINGDB

Oracle instance started

Total System Global Area    3405774848 bytes

Fixed Size                     8798456 bytes
Variable Size                687869704 bytes
Database Buffers            2701131776 bytes
Redo Buffers                   7974912 bytes
Automatic instance created

contents of Memory Script:
{
# set requested point in time
set until  scn 9561483;
# 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 10-AUG-18
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=4 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 /opt/app/oracle/product/12.2.0/db_1/dbs/c-2547745710-20180810-03
channel ORA_AUX_DISK_1: piece handle=/opt/app/oracle/product/12.2.0/db_1/dbs/c-2547745710-20180810-03 tag=TAG20180810T142707
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/u01/MINGDB/controlfile/o1_mf_fptg8kpo_.ctl
Finished restore at 10-AUG-18

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  scn 9561483;
# set destinations for recovery set and auxiliary set datafiles
set newname for clone datafile  1 to new;
set newname for clone datafile  8 to new;
set newname for clone datafile  5 to new;
set newname for clone datafile  10 to new;
set newname for clone datafile  3 to new;
set newname for clone datafile  9 to new;
set newname for clone tempfile  1 to new;
set newname for clone tempfile  3 to new;
# switch all tempfiles
switch clone tempfile all;
# restore the tablespaces in the recovery set and the auxiliary set
restore clone datafile  1, 8, 5, 10, 3, 9;
 
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

executing command: SET NEWNAME

renamed tempfile 1 to /u01/MINGDB/datafile/o1_mf_temp_%u_.tmp in control file
renamed tempfile 3 to /u01/MINGDB/70B59C073DE92098E053B7D91FACCD7E/datafile/o1_mf_temp_%u_.tmp in control file

Starting restore at 10-AUG-18
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 00008 to /u01/MINGDB/70B59C073DE92098E053B7D91FACCD7E/datafile/o1_mf_system_%u_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00010 to /u01/MINGDB/70B59C073DE92098E053B7D91FACCD7E/datafile/o1_mf_undotbs1_%u_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00009 to /u01/MINGDB/70B59C073DE92098E053B7D91FACCD7E/datafile/o1_mf_sysaux_%u_.dbf
channel ORA_AUX_DISK_1: reading from backup piece /opt/backup/fulldb_MINGDB_3jta78f7_1_1
channel ORA_AUX_DISK_1: piece handle=/opt/backup/fulldb_MINGDB_3jta78f7_1_1 tag=TAG20180810T142543
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:25
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 /u01/MINGDB/datafile/o1_mf_system_%u_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00005 to /u01/MINGDB/datafile/o1_mf_undotbs1_%u_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00003 to /u01/MINGDB/datafile/o1_mf_sysaux_%u_.dbf
channel ORA_AUX_DISK_1: reading from backup piece /opt/backup/fulldb_MINGDB_3kta78h9_1_1
channel ORA_AUX_DISK_1: piece handle=/opt/backup/fulldb_MINGDB_3kta78h9_1_1 tag=TAG20180810T142543
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:25
Finished restore at 10-AUG-18

datafile 1 switched to datafile copy
input datafile copy RECID=7 STAMP=983804746 file name=/u01/MINGDB/datafile/o1_mf_system_fptg9k72_.dbf
datafile 8 switched to datafile copy
input datafile copy RECID=8 STAMP=983804746 file name=/u01/MINGDB/70B59C073DE92098E053B7D91FACCD7E/datafile/o1_mf_system_fptg8qsw_.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=9 STAMP=983804746 file name=/u01/MINGDB/datafile/o1_mf_undotbs1_fptg9k7h_.dbf
datafile 10 switched to datafile copy
input datafile copy RECID=10 STAMP=983804746 file name=/u01/MINGDB/70B59C073DE92098E053B7D91FACCD7E/datafile/o1_mf_undotbs1_fptg8qt7_.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=11 STAMP=983804746 file name=/u01/MINGDB/datafile/o1_mf_sysaux_fptg9k7d_.dbf
datafile 9 switched to datafile copy
input datafile copy RECID=12 STAMP=983804746 file name=/u01/MINGDB/70B59C073DE92098E053B7D91FACCD7E/datafile/o1_mf_sysaux_fptg8qt2_.dbf

contents of Memory Script:
{
# set requested point in time
set until  scn 9561483;
# online the datafiles restored or switched
sql clone "alter database datafile  1 online";
sql clone 'MINGPDB1' "alter database datafile
 8 online";
sql clone "alter database datafile  5 online";
sql clone 'MINGPDB1' "alter database datafile
 10 online";
sql clone "alter database datafile  3 online";
sql clone 'MINGPDB1' "alter database datafile
 9 online";
# recover and open database read only
recover clone database tablespace  "SYSTEM", "MINGPDB1":"SYSTEM", "UNDOTBS1", "MINGPDB1":"UNDOTBS1", "SYSAUX", "MINGPDB1":"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  8 online

sql statement: alter database datafile  5 online

sql statement: alter database datafile  10 online

sql statement: alter database datafile  3 online

sql statement: alter database datafile  9 online

Starting recover at 10-AUG-18
using channel ORA_AUX_DISK_1

starting media recovery

archived log for thread 1 with sequence 596 is already on disk as file /opt/mingdbdata/archive/1_596_981132078.arc
archived log file name=/opt/mingdbdata/archive/1_596_981132078.arc thread=1 sequence=596
media recovery complete, elapsed time: 00:00:01
Finished recover at 10-AUG-18

sql statement: alter database open read only

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

sql statement: alter pluggable database  MINGPDB1 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 =
  ''/u01/MINGDB/controlfile/o1_mf_fptg8kpo_.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    3405774848 bytes

Fixed Size                     8798456 bytes
Variable Size                687869704 bytes
Database Buffers            2701131776 bytes
Redo Buffers                   7974912 bytes

sql statement: alter system set  control_files =   ''/u01/MINGDB/controlfile/o1_mf_fptg8kpo_.ctl'' comment= ''RMAN set'' scope=spfile

Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area    3405774848 bytes

Fixed Size                     8798456 bytes
Variable Size                687869704 bytes
Database Buffers            2701131776 bytes
Redo Buffers                   7974912 bytes

sql statement: alter database mount clone database

contents of Memory Script:
{
# set requested point in time
set until  scn 9561483;
# set destinations for recovery set and auxiliary set datafiles
set newname for datafile  15 to new;
set newname for datafile  16 to new;
# restore the tablespaces in the recovery set and the auxiliary set
restore clone datafile  15, 16;
 
switch clone datafile all;
}
executing Memory Script

executing command: SET until clause

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 10-AUG-18
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=180 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 00015 to /u01/TIEU_PITR_MINGPDB1_MINGDB/70B59C073DE92098E053B7D91FACCD7E/datafile/o1_mf_tbs_ming_%u_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00016 to /u01/TIEU_PITR_MINGPDB1_MINGDB/70B59C073DE92098E053B7D91FACCD7E/datafile/o1_mf_tbs_ming_%u_.dbf
channel ORA_AUX_DISK_1: reading from backup piece /opt/backup/fulldb_MINGDB_3jta78f7_1_1
channel ORA_AUX_DISK_1: piece handle=/opt/backup/fulldb_MINGDB_3jta78f7_1_1 tag=TAG20180810T142543
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:35
Finished restore at 10-AUG-18

datafile 15 switched to datafile copy
input datafile copy RECID=15 STAMP=983804838 file name=/u01/TIEU_PITR_MINGPDB1_MINGDB/70B59C073DE92098E053B7D91FACCD7E/datafile/o1_mf_tbs_ming_fptgd389_.dbf
datafile 16 switched to datafile copy
input datafile copy RECID=16 STAMP=983804838 file name=/u01/TIEU_PITR_MINGPDB1_MINGDB/70B59C073DE92098E053B7D91FACCD7E/datafile/o1_mf_tbs_ming_fptgd38x_.dbf

contents of Memory Script:
{
# set requested point in time
set until  scn 9561483;
# online the datafiles restored or switched
sql clone 'MINGPDB1' "alter database datafile
 15 online";
sql clone 'MINGPDB1' "alter database datafile
 16 online";
# recover and open resetlogs
recover clone database tablespace  "MINGPDB1":"TBS_MING", "SYSTEM", "MINGPDB1":"SYSTEM", "UNDOTBS1", "MINGPDB1":"UNDOTBS1", "SYSAUX", "MINGPDB1":"SYSAUX" delete archivelog;
alter clone database open resetlogs;
}
executing Memory Script

executing command: SET until clause

sql statement: alter database datafile  15 online

sql statement: alter database datafile  16 online

Starting recover at 10-AUG-18
using channel ORA_AUX_DISK_1

starting media recovery

archived log for thread 1 with sequence 596 is already on disk as file /opt/mingdbdata/archive/1_596_981132078.arc
archived log file name=/opt/mingdbdata/archive/1_596_981132078.arc thread=1 sequence=596
media recovery complete, elapsed time: 00:00:00
Finished recover at 10-AUG-18

database opened

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

sql statement: alter pluggable database  MINGPDB1 open

contents of Memory Script:
{
# create directory for datapump import
sql 'MINGPDB1' "create or replace directory
TSPITR_DIROBJ_DPDIR as ''
/u01''";
# create directory for datapump export
sql clone 'MINGPDB1' "create or replace directory
TSPITR_DIROBJ_DPDIR as ''
/u01''";
}
executing Memory Script

sql statement: create or replace directory TSPITR_DIROBJ_DPDIR as ''/u01''

sql statement: create or replace directory TSPITR_DIROBJ_DPDIR as ''/u01''

Performing export of tables...
   EXPDP> Starting "SYS"."TSPITR_EXP_tiEu_fDbD":  
   EXPDP> Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
   EXPDP> Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
   EXPDP> Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
   EXPDP> Processing object type TABLE_EXPORT/TABLE/STATISTICS/MARKER
   EXPDP> Processing object type TABLE_EXPORT/TABLE/TABLE
   EXPDP> Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX
   EXPDP> . . exported "MING"."MING"                               886.8 MB 1694383 rows
   EXPDP> Master table "SYS"."TSPITR_EXP_tiEu_fDbD" successfully loaded/unloaded
   EXPDP> ******************************************************************************
   EXPDP> Dump file set for SYS.TSPITR_EXP_tiEu_fDbD is:
   EXPDP>   /u01/tspitr_tiEu_89141.dmp
   EXPDP> Job "SYS"."TSPITR_EXP_tiEu_fDbD" successfully completed at Fri Aug 10 15:08:25 2018 elapsed 0 00:00:41
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_tiEu_oCco" successfully loaded/unloaded
   IMPDP> Starting "SYS"."TSPITR_IMP_tiEu_oCco":  
   IMPDP> Processing object type TABLE_EXPORT/TABLE/TABLE
   IMPDP> Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
   IMPDP> . . imported "MING"."MING"                               886.8 MB 1694383 rows
   IMPDP> Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX
   IMPDP> Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
   IMPDP> Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
   IMPDP> Processing object type TABLE_EXPORT/TABLE/STATISTICS/MARKER
   IMPDP> Job "SYS"."TSPITR_IMP_tiEu_oCco" successfully completed at Fri Aug 10 15:09:18 2018 elapsed 0 00:00:47
Import completed

Removing automatic instance
Automatic instance removed
auxiliary instance file /u01/MINGDB/70B59C073DE92098E053B7D91FACCD7E/datafile/o1_mf_temp_fptgbjwj_.tmp deleted
auxiliary instance file /u01/MINGDB/datafile/o1_mf_temp_fptgbgmc_.tmp deleted
auxiliary instance file /u01/TIEU_PITR_MINGPDB1_MINGDB/onlinelog/o1_mf_6_fptgf8nf_.log deleted
auxiliary instance file /u01/TIEU_PITR_MINGPDB1_MINGDB/onlinelog/o1_mf_5_fptgf8mr_.log deleted
auxiliary instance file /u01/TIEU_PITR_MINGPDB1_MINGDB/onlinelog/o1_mf_4_fptgf8mc_.log deleted
auxiliary instance file /u01/TIEU_PITR_MINGPDB1_MINGDB/70B59C073DE92098E053B7D91FACCD7E/datafile/o1_mf_tbs_ming_fptgd38x_.dbf deleted
auxiliary instance file /u01/TIEU_PITR_MINGPDB1_MINGDB/70B59C073DE92098E053B7D91FACCD7E/datafile/o1_mf_tbs_ming_fptgd389_.dbf deleted
auxiliary instance file /u01/MINGDB/70B59C073DE92098E053B7D91FACCD7E/datafile/o1_mf_sysaux_fptg8qt2_.dbf deleted
auxiliary instance file /u01/MINGDB/datafile/o1_mf_sysaux_fptg9k7d_.dbf deleted
auxiliary instance file /u01/MINGDB/70B59C073DE92098E053B7D91FACCD7E/datafile/o1_mf_undotbs1_fptg8qt7_.dbf deleted
auxiliary instance file /u01/MINGDB/datafile/o1_mf_undotbs1_fptg9k7h_.dbf deleted
auxiliary instance file /u01/MINGDB/70B59C073DE92098E053B7D91FACCD7E/datafile/o1_mf_system_fptg8qsw_.dbf deleted
auxiliary instance file /u01/MINGDB/datafile/o1_mf_system_fptg9k72_.dbf deleted
auxiliary instance file /u01/MINGDB/controlfile/o1_mf_fptg8kpo_.ctl deleted
auxiliary instance file tspitr_tiEu_89141.dmp deleted
Finished recover at 10-AUG-18

恢复过程一目了然:
首先创建一个辅助实例,然后将利用备份文件创建另一个克隆PDB出来,然后利用数据泵将目标表从克隆pdb中导出,再将其导入到原库中。当然这里也不是完全一致的克隆。executing command: SET NEWNAME出现了8次,也就是说从备份集中restore了8个数据文件,分别是CDB和PDB的system,sysaux,undo表空间,PDB的TEMP表空间,目标表所在表空间TBS_MING。此外还会恢复参数文件,控制文件以及redo log。

根据这个过程需要注意的点如下
1.文件系统空间
2.因为新创建辅助实例,而且内存与原实例一致,所以操作系统可用内存要注意。
3.注意数据泵的缺点。比如故障点和恢复时间点之间的权限赋予。

恢复前:
root@bd-dev-mingshuo-183:~#free -m
             total       used       free     shared    buffers     cached
Mem:          7870       7712        157       4302         84       6656
-/+ buffers/cache:        972       6898
Swap:         7999          0       7999
恢复过程:
root@bd-dev-mingshuo-183:/u01#free -m
             total       used       free     shared    buffers     cached
Mem:          7870       2305       5564       1119          7       1497
-/+ buffers/cache:        800       7069
Swap:         7999        144       7855

恢复后u01目录:
root@bd-dev-mingshuo-183:/u01#ll
total 24
drwx------ 2 root   root     16384 Aug 10 15:00 lost+found
drwxr-x--- 6 oracle oinstall  4096 Aug 10 15:04 MINGDB
drwxr-x--- 4 oracle oinstall  4096 Aug 10 15:07 TIEU_PITR_MINGPDB1_MINGDB

恢复过程中实例:
root@bd-dev-mingshuo-183:~#ps -ef|grep smon
oracle    1878     1  0 15:02 ?        00:00:00 ora_smon_mingdb
oracle    2308     1  0 15:04 ?        00:00:00 ora_smon_tiEu
root      2352  2241  0 15:04 pts/5    00:00:00 grep smon

检查数据,已恢复:
SQL> select count(*) from ming;

COUNT(*)
----------
   1694383
   
索引也恢复了
SQL> select index_name from user_indexes where table_name='MING';

INDEX_NAME
--------------------------------------------------------------------------------
SYS_IL0000027637C00010$$
MING_IDX_01

查询故障点之后的其他表,没有受到影响。
SQL> select count(*) from tag_9561633;

COUNT(*)
----------
        36
检查datagurad也没有影响。

恢复的时候也可以指定表的名字,REMAP TABLE schema.table_name_old:table_name_new
recover table ming.ming OF PLUGGABLE DATABASE MINGPDB1 until scn 9561483 auxiliary destination '/u01' remap table ming.ming:ming_new;

主库:
SQL> select count(*) from ming_new;

COUNT(*)
----------
   1694383

备库:
SQL>  select count(*) from ming.ming_new;

COUNT(*)
----------
         0
主库切一下归档,备库也与主库一致。

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

转载于:http://blog.itpub.net/31480688/viewspace-2199796/

oracle12c之表级别恢复相关推荐

  1. 19.Oracle10g服务器管理恢复--RMAN表空间恢复(练习33)

    在练习12-14中我们学习了如何将数据库中删除的表恢复到错误发生之前,而不需要恢复整个数据库.Oracle可以恢复数据库的一个表空间,此时还原表空间数据文件,然后应用归档日志文件直到失效前或错误发生处 ...

  2. [20170623]利用传输表空间恢复数据库2.txt

    [20170623]利用传输表空间恢复数据库2.txt --//继续上午的测试,测试truncate,是否可行,理论讲应该没有问题.我主要的目的测试是否要切换日志. --//参考链接 : http:/ ...

  3. oracle误删了表怎么恢复数据,oracle误删除表或者表数据的恢复方法总结

    --一.误删除表的恢复方法 --查询这个"回收站"或者查询user_table视图来查找已被删除的表: select table_name,dropped from user_ta ...

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

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

  5. 数仓基于表级别的数据血缘分析

    1.背景:数据血缘分析在日常的处理过程中非常重要,其分为应用级别.表级别和字段级别三种.在数据处理过程中,需要知道目标表的字段是来源于哪张原始表.对于简单的hsql来说我们很容易可以知道目标表的来源, ...

  6. win10误删的注册表能还原吗_win10系统误删注册表怎么办|win10系统误删注册表的恢复方法...

    注册表是win10系统中一个很重要的部件,如果不小心修改或误删注册表会导致系统崩溃,有什么办法可以修复?这时候大家就可以使用CMD对注册表进行修复,以下便是win10系统误删注册表的恢复方法.小编建议 ...

  7. truncate表后恢复方法总结

    truncate表后恢复方法总结 1.1  BLOG文档结构图 1.2  前言部分 1.2.1  导读和注意事项 各位技术爱好者,看完本文后,你可以掌握如下的技能,也可以学到一些其它你所不知道的知识, ...

  8. mysql replicate-rewrite-db_replicate-rewrite-db和Replicate_Wild_Do_Table实现表级别映射复制

    将3306 实例下sakila 的两张表actor 同步到5725 实例下的ming 数据库中. 初始化数据 mysqldump -uroot -poracle -q --single-transac ...

  9. oracle误删数据和误删表的恢复方法

    之前在操作数据的时候,我在思考如何编写SQL,但是不小心按下了F8执行了drop语句,不小心删除了表,不过之后被我恢复了,但是之后我又不小心删错了表数据,虽然很快恢复了,但是我也找了几篇博客对比,虽然 ...

  10. oracle通过表空间文件进行数据库恢复,Oracle数据库表空间恢复方案_oracle

    一. 用户表空间 错误: 在启动数据库时出现ORA-01157,ORA-01110或操作系统级错误例如ORA-07360,在关闭数据库(使用shutdown normal或shutdown immed ...

最新文章

  1. springboot_4 spring boot 使用servlet,filter,listener和interceptor
  2. 终于等到你!GitHub 终于支持 multi-line comments!
  3. 手动实现SPring中的AOP(2)
  4. windows mysql kip grant tables_数据库mysql数据库mysql: [ERROR] unknown option '--skip-grant-tables'...
  5. php 小知识随手记 new self() 和new static()作用和区别
  6. java数据结构 -链表 -获取有效节点个数,单链表中倒数k个节点
  7. vector深拷贝与浅拷贝使用总结
  8. erlang安装_RabbitMQ的使用(一)- RabbitMQ服务安装
  9. java应用程序利用Exe4j打包exe文件
  10. 《Installing the XDK and the dev kit OS》
  11. 图层重命名快捷键_实际操作,在PS中如何批量给图层重命名并导出
  12. 盲盒识别装置-2022TI杯10月联赛D题
  13. jzoj5424【NOIP2017提高A组集训10.25】凤凰院凶真
  14. 转: 系统问题排查思路
  15. 趣学python编程下载_父与子的程序编写之旅:与小卡特一起学PythonPDF高清完整版一键下载|百度云盘...
  16. idb 怎么回复mysql_MySQL删除idb文件引发的思考
  17. 思科路由器无法访问互联网怎么操作?
  18. 程序设计与算法二郭炜枚举002拨钟问题及解题思路
  19. css-doodle插件初体验
  20. JAVA美食预定推荐系统

热门文章

  1. 于永正《杨氏之子》第二课时课堂实录
  2. 新增利息宝-京东淘宝唯品会自动抢单系统源码搭建过程
  3. 向上管理中的沟通技巧
  4. 药品包装上的OTC是什么东西
  5. 支持M1芯片AI2022更新了,illustrator 2022 for MAC中文安装教程,解决Monterey上ai闪退卡问题
  6. html 邮件 附件,HTML电子邮件缺少附件
  7. jmeter的教学视频
  8. 九州云入选创业邦2019企业数字化/智能化创新榜单
  9. 初学javaSE练手项目——飞机大战
  10. 那些大厂的全栈工程师有用武之地吗?