1. 程式人生 > >Oracle 12c系列(十) | 12c中的Recovering Tables and Table Partitions

Oracle 12c系列(十) | 12c中的Recovering Tables and Table Partitions

在Oracle 12c之前的版本中,rman進行資料恢復時只能進行database/tablespace/datafile/block四種級別的恢復,如果誤操作刪除某張表或表中資料,無法通過閃回進行資料還原時,且有完整備份以及歸檔,該種情況下可以進行表空間時間點恢復,但恢復方式較麻煩,在Oracle12c中,Oracle對rman功能進行了增強,除了之前的四種級別的恢復,rman也提供了表/表分割槽級別的恢復,該特性可以直接從現有的rman備份中來恢復表/表分割槽,且恢復的過程不影響資料庫中的其他的物件。

表級別的恢復流程與表空間時間點恢復流程相似,只是Oracle對手工的表空間時間點恢復進行了一層封裝,恢復時整個流程如下:

1.建立一個輔助例項。

2.在輔助例項中通過備份集對需要恢復的表/表分割槽所在的資料檔案進行restore。

3.recover until scn/timestamp/sequence number。

4.通過資料泵功能將需要恢復的表在輔助資料庫中匯出到指定目錄下。

5.將需要恢復的表匯入到生產庫中。

6.清理輔助資料庫。

指定恢復時間點時可以有以下3種級別:

1.SCN

2.TIME

3.SEQUENCE NUMBER

表/表分割槽級別的恢復有如下前提:

1.資料庫必須處於讀寫模式。

2.資料庫必須處於歸檔模式。

3.必須存在表/表分割槽的RMAN備份。

4.當要恢復單個表分割槽時,COMPATIBLE引數需要設定為11.1.0或更高。

表/表分割槽級別的恢復存在如下限制:

1.SYS使用者下的表/表分割槽無法進行恢復。

2.SYSTEM/SYSAUX表空間中的表/表分割槽無法進行恢復。

3.無法恢復備庫中的表/表分割槽。

4.當使用REMAP選項時無法恢復具有NOT NULL約束的表。 

關於表/表分割槽恢復詳細資訊請參考官方文件,連線如下:

https://docs.oracle.com/en/database/oracle/oracle-database/12.2/bradv/rman-recovering-tables-partitions.html#GUID-87B7F772-335F-4179-81C9-91678D026D01

下面演示表級別的恢復,實驗使用如下步驟:

1.建立表t,及相應索引idx_t_name。

2.做RMAN全備。

3.檢視當前scn。

4.刪除表。

5.在rman中恢復表t。

6.檢查表中資料是否恢復。 

實驗過程:

1.建立表t,及相應索引idx_t_name

07:55:36 yyh. pdb18c>create table t(id number, name varchar2(20));

Table created.

Elapsed: 00:00:00.12
07:55:49 yyh. pdb18c>insert into t values(0,'QData');

1 row created.

Elapsed: 00:00:00.07
07:55:59 yyh. pdb18c>insert into t values(1,'QData Cloud');

1 row created.

Elapsed: 00:00:00.00
07:56:04 yyh. pdb18c>commit;

Commit complete.

Elapsed: 00:00:00.01
07:56:05 yyh. pdb18c>create index idx_t_name t(name);
create index idx_t_name t(name)
                    *
ERROR at line 1:
ORA-00969: missing ON keyword


Elapsed: 00:00:00.00
07:56:23 yyh. pdb18c>create index idx_t_name on t(name);

Index created.

Elapsed: 00:00:00.10
07:56:26 yyh. pdb18c>select * from t;

    ID NAME
---------- ------------------------------
     0 QData
     1 QData Cloud

Elapsed: 00:00:00.03
07:56:33 yyh. pdb18c>

2.做RMAN全備

RMAN> backup database;

Starting backup at 07-AUG-18
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=80 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=00001 name=/ssd2/ora18c/system01.dbf
input datafile file number=00003 name=/ssd2/ora18c/sysaux01.dbf
input datafile file number=00004 name=/ssd2/ora18c/undotbs01.dbf
input datafile file number=00007 name=/ssd2/ora18c/users01.dbf
channel ORA_DISK_1: starting piece 1 at 07-AUG-18
channel ORA_DISK_1: finished piece 1 at 07-AUG-18
piece handle=/ssd2/backup/20180807_full_09t9ukmd_1_1.bak tag=TAG20180807T075908 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:35
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=/ssd2/ora18c/pdb18c/sysaux01.dbf
input datafile file number=00009 name=/ssd2/ora18c/pdb18c/system01.dbf
input datafile file number=00011 name=/ssd2/ora18c/pdb18c/undotbs01.dbf
input datafile file number=00012 name=/ssd2/ora18c/pdb18c/users01.dbf
channel ORA_DISK_1: starting piece 1 at 07-AUG-18
channel ORA_DISK_1: finished piece 1 at 07-AUG-18
piece handle=/ssd2/backup/20180807_full_0at9ukng_1_1.bak tag=TAG20180807T075908 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=00006 name=/ssd2/ora18c/pdbseed/sysaux01.dbf
input datafile file number=00005 name=/ssd2/ora18c/pdbseed/system01.dbf
input datafile file number=00008 name=/ssd2/ora18c/pdbseed/undotbs01.dbf
channel ORA_DISK_1: starting piece 1 at 07-AUG-18
channel ORA_DISK_1: finished piece 1 at 07-AUG-18
piece handle=/ssd2/backup/20180807_full_0bt9uknv_1_1.bak tag=TAG20180807T075908 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25
Finished backup at 07-AUG-18

Starting Control File and SPFILE Autobackup at 07-AUG-18
piece handle=/ssd2/software/dbs/c-604968197-20180807-02 comment=NONE
Finished Control File and SPFILE Autobackup at 07-AUG-18

RMAN>

3.檢視當前scn

08:04:30 yyh. pdb18c>select * from t;

    ID NAME
---------- ------------------------------
     0 QData
     1 QData Cloud

Elapsed: 00:00:00.03
08:04:36 yyh. pdb18c>select current_scn from v$database;

CURRENT_SCN
-----------
1856675

Elapsed: 00:00:00.03
08:04:43 yyh. pdb18c>

4.刪除表

08:04:43 yyh. pdb18c>drop table t purge;

Table dropped.

Elapsed: 00:00:00.50
08:04:49 yyh. pdb18c>select * from t;
select * from t
          *
ERROR at line 1:
ORA-00942: table or view does not exist


Elapsed: 00:00:00.00
08:04:53 yyh. pdb18c>select current_scn from v$database;

CURRENT_SCN
-----------
1856698

Elapsed: 00:00:00.00
08:04:55 yyh. pdb18c>

5.在rman中恢復表t

[[email protected] ~]$ rman target /

Recovery Manager: Release 18.0.0.0.0 - Production on Tue Aug 7 08:05:12 2018
Version 18.3.0.0.0

Copyright (c) 1982, 2018, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ORA18C (DBID=604968197)

RMAN> recover table yyh.t OF PLUGGABLE DATABASE pdb18c until scn 1856675 auxiliary destination '/home/oracle/tmp' REMAP TABLE yyh.t:t_new;

Starting recover at 07-AUG-18
using target database control file instead of recovery catalog
current log archived
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=81 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 PDB18C:SYSTEM
Tablespace UNDOTBS1
Tablespace PDB18C:UNDOTBS1

Creating automatic instance, with SID='EyDp'

initialization parameters used for automatic instance:
db_name=ORA18C
db_unique_name=EyDp_pitr_pdb18c_ORA18C
compatible=18.0.0
db_block_size=8192
db_files=200
diagnostic_dest=/u01/app/oracle
_system_trig_enabled=FALSE
db_domain=example.com
sga_target=1216M
processes=200
db_create_file_dest=/home/oracle/tmp
log_archive_dest_1='location=/home/oracle/tmp'
enable_pluggable_database=true
_clone_one_pdb_recovery=true
#No auxiliary parameter file used


starting up automatic instance ORA18C

Oracle instance started

Total System Global Area    1275067224 bytes

Fixed Size                     8895320 bytes
Variable Size                335544320 bytes
Database Buffers             922746880 bytes
Redo Buffers                   7880704 bytes
Automatic instance created

contents of Memory Script:
{
# set requested point in time
set until  scn 1856675;
# 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 07-AUG-18
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=38 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 /ssd2/software/dbs/c-604968197-20180807-02
channel ORA_AUX_DISK_1: piece handle=/ssd2/software/dbs/c-604968197-20180807-02 tag=TAG20180807T080024
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/home/oracle/tmp/ORA18C/controlfile/o1_mf_fpm2t8n9_.ctl
Finished restore at 07-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 1856675;
# set destinations for recovery set and auxiliary set datafiles
set newname for clone datafile  1 to new;
set newname for clone datafile  9 to new;
set newname for clone datafile  4 to new;
set newname for clone datafile  11 to new;
set newname for clone datafile  3 to new;
set newname for clone datafile  10 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, 9, 4, 11, 3, 10;

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 /home/oracle/tmp/ORA18C/datafile/o1_mf_temp_%u_.tmp in control file
renamed tempfile 3 to /home/oracle/tmp/ORA18C/725FE29D8B2648D6E0535138A8C01199/datafile/o1_mf_temp_%u_.tmp in control file

Starting restore at 07-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 00001 to /home/oracle/tmp/ORA18C/datafile/o1_mf_system_%u_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00004 to /home/oracle/tmp/ORA18C/datafile/o1_mf_undotbs1_%u_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00003 to /home/oracle/tmp/ORA18C/datafile/o1_mf_sysaux_%u_.dbf
channel ORA_AUX_DISK_1: reading from backup piece /ssd2/backup/20180807_full_09t9ukmd_1_1.bak
channel ORA_AUX_DISK_1: piece handle=/ssd2/backup/20180807_full_09t9ukmd_1_1.bak tag=TAG20180807T075908
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 00009 to /home/oracle/tmp/ORA18C/725FE29D8B2648D6E0535138A8C01199/datafile/o1_mf_system_%u_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00011 to /home/oracle/tmp/ORA18C/725FE29D8B2648D6E0535138A8C01199/datafile/o1_mf_undotbs1_%u_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00010 to /home/oracle/tmp/ORA18C/725FE29D8B2648D6E0535138A8C01199/datafile/o1_mf_sysaux_%u_.dbf
channel ORA_AUX_DISK_1: reading from backup piece /ssd2/backup/20180807_full_0at9ukng_1_1.bak
channel ORA_AUX_DISK_1: piece handle=/ssd2/backup/20180807_full_0at9ukng_1_1.bak tag=TAG20180807T075908
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:07
Finished restore at 07-AUG-18

datafile 1 switched to datafile copy
input datafile copy RECID=10 STAMP=983520431 file name=/home/oracle/tmp/ORA18C/datafile/o1_mf_system_fpm2thc6_.dbf
datafile 9 switched to datafile copy
input datafile copy RECID=11 STAMP=983520431 file name=/home/oracle/tmp/ORA18C/725FE29D8B2648D6E0535138A8C01199/datafile/o1_mf_system_fpm2v8mx_.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=12 STAMP=983520431 file name=/home/oracle/tmp/ORA18C/datafile/o1_mf_undotbs1_fpm2thco_.dbf
datafile 11 switched to datafile copy
input datafile copy RECID=13 STAMP=983520431 file name=/home/oracle/tmp/ORA18C/725FE29D8B2648D6E0535138A8C01199/datafile/o1_mf_undotbs1_fpm2v8nd_.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=14 STAMP=983520431 file name=/home/oracle/tmp/ORA18C/datafile/o1_mf_sysaux_fpm2thcg_.dbf
datafile 10 switched to datafile copy
input datafile copy RECID=15 STAMP=983520431 file name=/home/oracle/tmp/ORA18C/725FE29D8B2648D6E0535138A8C01199/datafile/o1_mf_sysaux_fpm2v8mo_.dbf

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

sql statement: alter database datafile  4 online

sql statement: alter database datafile  11 online

sql statement: alter database datafile  3 online

sql statement: alter database datafile  10 online

Starting recover at 07-AUG-18
using channel ORA_AUX_DISK_1

starting media recovery

archived log for thread 1 with sequence 36 is already on disk as file /ssd2/ora18c/arch/1_36_983002568.dbf
archived log for thread 1 with sequence 37 is already on disk as file /ssd2/ora18c/arch/1_37_983002568.dbf
archived log for thread 1 with sequence 38 is already on disk as file /ssd2/ora18c/arch/1_38_983002568.dbf
archived log file name=/ssd2/ora18c/arch/1_36_983002568.dbf thread=1 sequence=36
archived log file name=/ssd2/ora18c/arch/1_37_983002568.dbf thread=1 sequence=37
archived log file name=/ssd2/ora18c/arch/1_38_983002568.dbf thread=1 sequence=38
media recovery complete, elapsed time: 00:00:01
Finished recover at 07-AUG-18

sql statement: alter database open read only

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

sql statement: alter pluggable database  PDB18C 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 = 
''/home/oracle/tmp/ORA18C/controlfile/o1_mf_fpm2t8n9_.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    1275067224 bytes

Fixed Size                     8895320 bytes
Variable Size                335544320 bytes
Database Buffers             922746880 bytes
Redo Buffers                   7880704 bytes

sql statement: alter system set  control_files = ''/home/oracle/tmp/ORA18C/controlfile/o1_mf_fpm2t8n9_.ctl'' comment= ''RMAN set'' scope=spfile

Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area    1275067224 bytes

Fixed Size                     8895320 bytes
Variable Size                335544320 bytes
Database Buffers             922746880 bytes
Redo Buffers                   7880704 bytes

sql statement: alter database mount clone database

contents of Memory Script:
{
# set requested point in time
set until  scn 1856675;
# set destinations for recovery set and auxiliary set datafiles
set newname for datafile  12 to new;
# restore the tablespaces in the recovery set and the auxiliary set
restore clone datafile  12;

switch clone datafile all;
}
executing Memory Script

executing command: SET until clause

executing command: SET NEWNAME

Starting restore at 07-AUG-18
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=34 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 00012 to /home/oracle/tmp/EYDP_PITR_PDB18C_ORA18C/725FE29D8B2648D6E0535138A8C01199/datafile/o1_mf_users_%u_.dbf
channel ORA_AUX_DISK_1: reading from backup piece /ssd2/backup/20180807_full_0at9ukng_1_1.bak
channel ORA_AUX_DISK_1: piece handle=/ssd2/backup/20180807_full_0at9ukng_1_1.bak tag=TAG20180807T075908
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:02
Finished restore at 07-AUG-18

datafile 12 switched to datafile copy
input datafile copy RECID=17 STAMP=983520502 file name=/home/oracle/tmp/EYDP_PITR_PDB18C_ORA18C/725FE29D8B2648D6E0535138A8C01199/datafile/o1_mf_users_fpm2xo0z_.dbf

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

executing command: SET until clause

sql statement: alter database datafile  12 online

Starting recover at 07-AUG-18
using channel ORA_AUX_DISK_1

starting media recovery

archived log for thread 1 with sequence 36 is already on disk as file /ssd2/ora18c/arch/1_36_983002568.dbf
archived log for thread 1 with sequence 37 is already on disk as file /ssd2/ora18c/arch/1_37_983002568.dbf
archived log for thread 1 with sequence 38 is already on disk as file /ssd2/ora18c/arch/1_38_983002568.dbf
archived log file name=/ssd2/ora18c/arch/1_36_983002568.dbf thread=1 sequence=36
archived log file name=/ssd2/ora18c/arch/1_37_983002568.dbf thread=1 sequence=37
archived log file name=/ssd2/ora18c/arch/1_38_983002568.dbf thread=1 sequence=38
media recovery complete, elapsed time: 00:00:00
Finished recover at 07-AUG-18

database opened

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

sql statement: alter pluggable database  PDB18C open

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

sql statement: create or replace directory TSPITR_DIROBJ_DPDIR as ''/home/oracle/tmp''

sql statement: create or replace directory TSPITR_DIROBJ_DPDIR as ''/home/oracle/tmp''

Performing export of tables...
EXPDP> Starting "SYS"."TSPITR_EXP_EyDp_laDE":  
EXPDP> Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
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> . . exported "YYH"."T"                                   5.492 KB       2 rows
EXPDP> Master table "SYS"."TSPITR_EXP_EyDp_laDE" successfully loaded/unloaded
EXPDP> ******************************************************************************
EXPDP> Dump file set for SYS.TSPITR_EXP_EyDp_laDE is:
EXPDP>   /home/oracle/tmp/tspitr_EyDp_57472.dmp
EXPDP> Job "SYS"."TSPITR_EXP_EyDp_laDE" successfully completed at Tue Aug 7 08:09:23 2018 elapsed 0 00:00:28
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_EyDp_Fvoy" successfully loaded/unloaded
IMPDP> Starting "SYS"."TSPITR_IMP_EyDp_Fvoy":  
IMPDP> Processing object type TABLE_EXPORT/TABLE/TABLE
IMPDP> Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
IMPDP> . . imported "YYH"."T_NEW"                               5.492 KB       2 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_EyDp_Fvoy" successfully completed at Tue Aug 7 08:10:37 2018 elapsed 0 00:01:01
Import completed


Removing automatic instance
Automatic instance removed
auxiliary instance file /home/oracle/tmp/ORA18C/725FE29D8B2648D6E0535138A8C01199/datafile/o1_mf_temp_fpm2vo5f_.tmp deleted
auxiliary instance file /home/oracle/tmp/ORA18C/datafile/o1_mf_temp_fpm2vlrn_.tmp deleted
auxiliary instance file /home/oracle/tmp/EYDP_PITR_PDB18C_ORA18C/onlinelog/o1_mf_3_fpm2xsz2_.log deleted
auxiliary instance file /home/oracle/tmp/EYDP_PITR_PDB18C_ORA18C/onlinelog/o1_mf_2_fpm2xqk6_.log deleted
auxiliary instance file /home/oracle/tmp/EYDP_PITR_PDB18C_ORA18C/onlinelog/o1_mf_1_fpm2xqjq_.log deleted
auxiliary instance file /home/oracle/tmp/EYDP_PITR_PDB18C_ORA18C/725FE29D8B2648D6E0535138A8C01199/datafile/o1_mf_users_fpm2xo0z_.dbf deleted
auxiliary instance file /home/oracle/tmp/ORA18C/725FE29D8B2648D6E0535138A8C01199/datafile/o1_mf_sysaux_fpm2v8mo_.dbf deleted
auxiliary instance file /home/oracle/tmp/ORA18C/datafile/o1_mf_sysaux_fpm2thcg_.dbf deleted
auxiliary instance file /home/oracle/tmp/ORA18C/725FE29D8B2648D6E0535138A8C01199/datafile/o1_mf_undotbs1_fpm2v8nd_.dbf deleted
auxiliary instance file /home/oracle/tmp/ORA18C/datafile/o1_mf_undotbs1_fpm2thco_.dbf deleted
auxiliary instance file /home/oracle/tmp/ORA18C/725FE29D8B2648D6E0535138A8C01199/datafile/o1_mf_system_fpm2v8mx_.dbf deleted
auxiliary instance file /home/oracle/tmp/ORA18C/datafile/o1_mf_system_fpm2thc6_.dbf deleted
auxiliary instance file /home/oracle/tmp/ORA18C/controlfile/o1_mf_fpm2t8n9_.ctl deleted
auxiliary instance file tspitr_EyDp_57472.dmp deleted
Finished recover at 07-AUG-18

RMAN>

6.檢查表中資料是否恢復

08:20:08 yyh. pdb18c>select * from t_new;

    ID NAME
---------- ------------------------------
     0 QData
     1 QData Cloud

Elapsed: 00:00:00.05
08:21:22 yyh. pdb18c>select index_name, table_name from user_indexes;

no rows selected

Elapsed: 00:00:00.18
08:21:33 yyh. pdb18c>

表資料已經被恢復。

在恢復表的過程中觀察伺服器中的後臺例項情況,可以發現為EyDp的SID的輔助資料庫,該庫即為恢復表時自動建立的輔助資料庫,如下:

[[email protected] ssd2]$ ps -ef | grep pmon
oracle   11536     1  0 08:06 ?        00:00:00 ora_pmon_EyDp
oracle   11911 15784  0 08:07 pts/1    00:00:00 grep pmon
oracle   16207     1  0 06:33 ?        00:00:00 ora_pmon_ora18c
[[email protected] ssd2]$

| 作者簡介

楊禹航·沃趣科技高階資料庫技術專家

熟悉Oracle資料庫內部機制,豐富的資料庫及RAC叢集層故障診斷、效能調優、OWI、資料庫備份恢復及遷移經驗。