一个resetlogs恢复表的场景:
场景描述:
数据正常运行,由于表B丢失,此时进行一次不完全恢复,不完全恢复至scn1067392,然后进行open resetlogs打开,此时开启了一个新的化身线,在刚打开后,又误删除了表A,此时想要恢复表A,将表A再次恢复至scn1067392,将表A进行恢复。
进行一次全备:
[oracle@server1 ~]$ rman target /
RMAN> backup as compressed backupset database;
查看数据库当前化身线:
RMAN> list incarnation
using target database control file instead of recovery catalog
List of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1 1 PROD 457994418 PARENT 1 24-AUG-13
2 2 PROD 457994418 CURRENT 925702 19-JUL-20
创建两张表(A和B):
SQL> create table A as select * from dba_objects;
Table created.
SQL> insert into A select * from A;
86958 rows created.
SQL> create table B as select * from dba_objects;
Table created.
SQL> insert into B select * from B;
86958 rows created.
**进行几次日志切换:**
SQL> alter system switch logfile;
查看当前SCN:
SQL> select current_scn from v$database;
CURRENT_SCN
1067392
清空表B数据:
SQL> truncate table B;
Table truncated.
使用RMAN进行不完全恢复至1067392,将表B恢复:
启动到mount状态进行恢复
RMAN> restore database;
RMAN> recover database until scn 1067392;
SQL> alter database open resetlogs;
Database altered.
SQL> select count(*) from B;
COUNT(*)
173914
查看当前化身:
RMAN> list incarnation;
using target database control file instead of recovery catalog
List of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1 1 PROD 457994418 PARENT 1 24-AUG-13
2 2 PROD 457994418 PARENT 925702 19-JUL-20
3 3 PROD 457994418 CURRENT 1067393 21-AUG-20
**记录一下Open resetlogs后的当前SCN:**
SQL> select current_scn from v$database;
CURRENT_SCN
1067920(和上面化身线的点还是很大距离的)
**此时刚进行不完全恢复open resetlogs打开后,我又把表A删了:**
SQL> truncate table A;
Table truncated.
此时可以不完全恢复至 1067920,恢复表A
但是我尝试再次恢复至SCN1067392,出现ORA-600错误:
(多次测试,恢复至与上一样不完全恢复相同的SCN是必报的错误)
指定化身线2:
RMAN> reset database to incarnation 2;
RMAN> restore database;
RMAN> recover database until scn 1067392;
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-00600: internal error code, arguments: [2898], [5], [12], [], [], [], [],
[], [], [], [], []
Process ID: 3633
Session ID: 191 Serial number: 13
后台警告日志:
Checker run found 2 new persistent data failures
ARC3: Archival started
ARC0: STARTING ARCH PROCESSES COMPLETE
error 25319 happened during Queue table repartitioning
Starting background process QMNC
Fri Aug 21 07:23:45 2020
QMNC started with pid=27, OS id=3364
LOGSTDBY: Validating controlfile with logical metadata
LOGSTDBY: Validation complete
Fri Aug 21 07:23:45 2020
error 376 happened for queue:IX.STREAMS_QUEUE_TABLE during timed act
Completed: alter database open
Fri Aug 21 07:23:45 2020
Dumping diagnostic data in directory=[cdmp_20200821072345], requested by (instance=1, osid=3342), summary=[incident=12166].
Errors in file /oracle/app/diag/rdbms/prod/prod/trace/prod_mmon_3322.trc (incident=12134):
ORA-25319: Queue table repartitioning aborted
Incident details in: /oracle/app/diag/rdbms/prod/prod/incident/incdir_12134/prod_mmon_3322_i12134.trc
error 25319 happened during Queue table repartitioning
error 376 happened for queue:IX.STREAMS_QUEUE_TABLE during timed act
Errors in file /oracle/app/diag/rdbms/prod/prod/trace/prod_mmon_3322.trc (incident=12135):
ORA-25319: Queue table repartitioning aborted
Incident details in: /oracle/app/diag/rdbms/prod/prod/incident/incdir_12135/prod_mmon_3322_i12135.trc
Dumping diagnostic data in directory=[cdmp_20200821072347], requested by (instance=1, osid=3322 (MMON)), summary=[incident=12134].
error 25319 happened during Queue table repartitioning
error 376 happened for queue:IX.STREAMS_QUEUE_TABLE during timed act
Errors in file /oracle/app/diag/rdbms/prod/prod/trace/prod_mmon_3322.trc (incident=12136):
ORA-25319: Queue table repartitioning aborted
Incident details in: /oracle/app/diag/rdbms/prod/prod/incident/incdir_12136/prod_mmon_3322_i12136.trc
Dumping diagnostic data in directory=[cdmp_20200821072348], requested by (instance=1, osid=3322 (MMON)), summary=[incident=12135].
error 25319 happened during Queue table repartitioning
使用RMAN启动到mount状态,查看一下当前化身
[oracle@server1 ~]$ rman target /
Recovery Manager: Release 11.2.0.4.0 - Production on Fri Aug 21 02:08:55 2020
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database (not started)
RMAN> startup mount;
Oracle instance started
database mounted
Total System Global Area 830930944 bytes
Fixed Size 2257800 bytes
Variable Size 541068408 bytes
Database Buffers 281018368 bytes
Redo Buffers 6586368 bytes
RMAN> list incarnation;
using target database control file instead of recovery catalog
List of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1 1 PROD 457994418 PARENT 1 24-AUG-13
2 2 PROD 457994418 PARENT 925702 19-JUL-20
3 3 PROD 457994418 ORPHAN 1067393 21-AUG-20
4 4 PROD 457994418 CURRENT 1067393 21-AUG-20
**显示当前已经出现一个分支。**
尝试直接Open
[oracle@server1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Fri Aug 21 02:11:03 2020
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> alter database open;
Database altered.
SQL> select count(*) from A;
COUNT(*)
173914
可以打开,数据存在