Heim  >  Artikel  >  Datenbank  >  Oracle Rman跨resetlogs版本恢复

Oracle Rman跨resetlogs版本恢复

WBOY
WBOYOriginal
2016-06-07 17:04:51960Durchsuche

20207错误:默认的认为until time或RECOVERY WINDOW的时间不能早于resetlogs的时间. 既然resetlogs了,就不认识之前的归档日志信

RMAN> startup nomount;

RMAN> sql 'alter session set nls_date_format=''yyyy-mm-dd hh24:mi:ss''";
--因为rman默认以环境变量来读取时间格式,与sqlplus的固定格式不同,所以,此处要设定时间格式变量。
RMAN> restore controlfile from autobackup until time '2009-03-10 18:15:00';
注意,仍然需要适当的还原控制文件。
RMAN> alter database mount;
RMAN> restore database;
RMAN> sql "alter session set nls_date_format=''yyyy-mm-dd hh24:mi:ss''";
RMAN> recover database until time '2009-03-10 18:15:00';

 

此时,出现以下错误:

RMAN-03002: recover 命令 (在 03/10/2009 19:21:19 上) 失败
RMAN-20207: UNTIL TIME 或 RECOVERY WINDOW 在 RESETLOGS 时间之前

 

20207错误:默认的认为until time或RECOVERY WINDOW的时间不能早于resetlogs的时间. 既然resetlogs了,就不认识之前的归档日志信息了。把之前的归档日志排除在可供恢复的选择之外了。这只是默认的行为,可能处于节省系统资源的考虑,毕竟resetlogs之前的数据再利用可能很小。

 

其解决可按以下方法处理:

1.找到数据库的当前incarnation号:

RMAN> list incarnation of database "test";

数据库原型列表
DB 关键字  Inc 关键字 DB 名  DB ID            STATUS  重置 SCN  重置时间
------- ------- -------- ---------------- --- ---------- ----------
1       1       TEST     1978860036       PARENT  1          30-8月 -05
2       2       TEST     1978860036       PARENT  534907     05-3月 -09
3       3       TEST     1978860036       PARENT  762990     10-3月 -09
4       4       TEST     1978860036       PARENT  764885     10-3月 -09
5       5       TEST     1978860036       PARENT  765443     10-3月 -09
6       6       TEST     1978860036       PARENT  767488     10-3月 -09
7       7       TEST     1978860036       PARENT  771807     10-3月 -09
8       8       TEST     1978860036       PARENT  774320     10-3月 -09
9       9       TEST     1978860036       PARENT  779541     10-3月 -09
10      10      TEST     1978860036       PARENT  782000     10-3月 -09
11      11      TEST     1978860036       PARENT  783792     10-3月 -09
12      12      TEST     1978860036       CURRENT 801599     10-3月 -09  --此行原型(incarnation)号状态为current,即当前

 
所以,数据库的前一个(resetlogs之前)原型号为11.

我们重新启动数据库到mount状态(因为需要知道是重置哪个库,所以要挂载)

 

2.重置数据库到前一个原型(注意:此时的控制文件已经在前面的步骤中,还原到了适当的时间点。实际上,我们应该在nomount前还原控制文件)

RMAN> reset database to incarnation 11;

将数据库重置为原型 11

RMAN> sql "alter session set nls_date_format=''yyyy-mm-dd hh24:mi:ss''";
RMAN> restore database;
RMAN> recover database until time '2009-03-10 18:15:00';
RMAN> alter database open resetlogs;  (此时,,数据库的incarnation编号将再次上涨)

数据库正常打开

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn