oracle12c之表级别恢复

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/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值