recover through resetlogs

转载 2006年06月08日 15:53:00

拷贝CP 的全文

1.时间点A,我做了一个全备份,

[ora9i@database rmanarch]$ rman target / nocatalog

Recovery Manager: Release 9.2.0.1.0 - Production

Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.

connected to target database (not started)

RMAN> startup mount

Oracle instance started
database mounted

Total System Global Area 353440004 bytes

Fixed Size 450820 bytes
Variable Size 150994944 bytes
Database Buffers 201326592 bytes
Redo Buffers 667648 bytes

RMAN> run{allocate channel c3 type disk; backup database format '/backup/oracle/rmanarch/ora9i%t%s.rman';}

allocated channel: c3
channel c3: sid=13 devtype=DISK

Starting backup at 20021130 21:48:59
channel c3: starting full datafile backupset
channel c3: specifying datafile(s) in backupset
including current controlfile in backupset
input datafile fno=00001 name=/backup/oracle/oradata/system.dbf
input datafile fno=00002 name=/backup/oracle/oradata/undo1.dbf
input datafile fno=00003 name=/backup/oracle/oradata/data.dbf
channel c3: starting piece 1 at 20021130 21:49:00
channel c3: finished piece 1 at 20021130 21:49:45
piece handle=/backup/oracle/rmanarch/ora9i4793393402.rman comment=NONE
channel c3: backup set complete, elapsed time: 00:00:45
Finished backup at 20021130 21:49:45
released channel: c3

RMAN> exit

Recovery Manager complete.

由于我没有备份的recovery catalog,我单独备份了这个时候的控制文件,通过OS的拷贝命令。

2。时间点B,我做了一些transaction,
21:50:05 SQL> create table tt tablespace data as select * from dba_objects;

Table created.

Elapsed: 00:00:00.51
21:50:19 SQL> select count(*) from tt;

COUNT(*)
----------
5782

Elapsed: 00:00:00.01
21:50:23 SQL> alter system switch logfile;

System altered.

Elapsed: 00:00:00.04
21:50:27 SQL> /

System altered.

Elapsed: 00:00:02.54
21:50:30 SQL> /

System altered.

Elapsed: 00:00:05.13
这个时候磁盘崩溃,数据库崩溃。
21:50:37 SQL> shutdown abort

我restore database,recover database, resetlogs到时间点B之前的B':
[ora9i@database rmanarch]$ rman target / nocatalog

Recovery Manager: Release 9.2.0.1.0 - Production

Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.

connected to target database: ORACLE9I (DBID=3143519835)
using target database controlfile instead of recovery catalog

RMAN> run{allocate channel c3 type disk;restore database;recover database until time '20021130 21:50:05';}

allocated channel: c3
channel c3: sid=14 devtype=DISK

Starting restore at 20021130 21:54:34

channel c3: starting datafile backupset restore
channel c3: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /backup/oracle/oradata/system.dbf
restoring datafile 00002 to /backup/oracle/oradata/undo1.dbf
restoring datafile 00003 to /backup/oracle/oradata/data.dbf
channel c3: restored backup piece 1
piece handle=/backup/oracle/rmanarch/ora9i4793393402.rman tag=TAG20021130T214859 params=NULL
channel c3: restore complete
Finished restore at 20021130 21:55:11

Starting recover at 20021130 21:55:11

starting media recovery

archive log thread 1 sequence 22 is already on disk as file /backup/oracle/product/9.2.0/dbs/arch1_22.dbf
archive log filename=/backup/oracle/product/9.2.0/dbs/arch1_22.dbf thread=1 sequence=22
media recovery complete
Finished recover at 20021130 21:55:12
released channel: c3

RMAN> alter database open resetlogs;

database opened

RMAN> exit

我检查在时间点B的事务:表TT,已经看不到了:
21:53:32 SQL> select status from v$instance;

STATUS
------------------------
OPEN

Elapsed: 00:00:00.04
21:55:41 SQL> select count(*) from tt;
select count(*) from tt
*
ERROR at line 1:
ORA-00942: table or view does not exist

Elapsed: 00:00:00.06
21:55:47 SQL> create table ttt tablespace data as select * from dba_objects;

Table created.

Elapsed: 00:00:00.44
21:56:05 SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /backup/oracle/product/9.2.0/dbs/arch
Oldest online log sequence 1
Next log sequence to archive 1
Current log sequence 1
我做了一些事务,比如创建表TTT,
这个时候,我还在做online备份没有完成,或者没有做备份,但是磁盘再次崩溃,丢失了一些数据文件:

我修改initsid.ora文件,把controlfile重新指到A时间点的时候备份的控制文件。
然后我restore database, recover database到B'时间点(就是上次B崩溃的时候,我恢复到的时间点)

RMAN> run{allocate channel c3 type disk;restore database;recover database until time '20021130 21:50:05';}

allocated channel: c3
channel c3: sid=13 devtype=DISK

Starting restore at 20021130 21:57:38

channel c3: starting datafile backupset restore
channel c3: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /backup/oracle/oradata/system.dbf
restoring datafile 00002 to /backup/oracle/oradata/undo1.dbf
restoring datafile 00003 to /backup/oracle/oradata/data.dbf
channel c3: restored backup piece 1
piece handle=/backup/oracle/rmanarch/ora9i4793393402.rman tag=TAG20021130T214859 params=NULL
channel c3: restore complete
Finished restore at 20021130 21:58:15

Starting recover at 20021130 21:58:15

starting media recovery

archive log thread 1 sequence 22 is already on disk as file /backup/oracle/product/9.2.0/dbs/arch1_22.dbf
archive log filename=/backup/oracle/product/9.2.0/dbs/arch1_22.dbf thread=1 sequence=22
media recovery complete
Finished recover at 20021130 21:58:16
released channel: c3

RMAN> shutdown

database dismounted
Oracle instance shut down
这个时候,我再次修改initsid.ora文件里面的controlfile,重新指回到C时间点的控制文件,
我企图打开数据库:
[ora9i@database oradata]$ sql

SQL*Plus: Release 9.2.0.1.0 - Production on Sat Nov 30 21:58:58 2002

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

Connected to an idle instance.

21:58:58 SQL> startup
ORACLE instance started.

Total System Global Area 353440004 bytes
Fixed Size 450820 bytes
Variable Size 150994944 bytes
Database Buffers 201326592 bytes
Redo Buffers 667648 bytes
Database mounted.
ORA-01190: controlfile or data file 1 is from before the last RESETLOGS
ORA-01110: data file 1: '/backup/oracle/oradata/system.dbf'

但是报错。
我恢复数据库:

21:59:17 SQL> recover database;
Media recovery complete.
22:00:42 SQL> alter database open;

Database altered.

OK,数据库打开。我检查我在时间点C的做的事务:

Elapsed: 00:00:01.64

22:00:52 SQL> select count(*) from ttt;

COUNT(*)
----------
5782

Elapsed: 00:00:00.03
我们可以看到,C时间点我创建的表TTT现在还在。

recover through resetlogs 的关键,在于把数据库先恢复到B'的时间点的状态,然后再根据当前的控制文件的状态来进行恢复。

虽然这样还是再某些条件下可以恢复数据库,但是我们一般都建议,再做了resetlogs之后,马上对数据库做一个全备份。因为recover through resetlogs 还是需要一定的条件和技巧的。不是推荐的标准的备份恢复手段。

______________________________________

from : http://www.itpub.net/110555,2.html

相关文章推荐

Recover through incarnations: RMAN-20208

之前用RMAN做过一个数据库的全备,后来发现数据库mess up了,想要恢复到之前做备份的那个状态,这个用RMAN很好办,RMAN> run{2> set until scn 44712912;3> ...

open resetlogs 做了什么

先摘一段document原文,稍后再对照来检查。 OPEN RESETLOGS Operations When you open the database with the RESETLOGS opt...

resetlogs选项

使用resetlogs的情况: 1)不完全介质恢复之后。 2)使用备份的控制文件进行恢复之后。 resetlogs作用: 1)归档当前重做日志,并清除联机重做日志的内容,重置日志序列号为1。 2)如果...

关于重建控制文件的两种方式以及区别(resetlogs ,noresetlogs)

Version:1.0StartHTML:0000000167EndHTML:0000017312StartFragment:0000000484EndFragment:0000017296 ...

alter database open resetlogs

问题解决: 先要弄清楚alter database open resetlogs是什么意思,为什么要用resetlogs打开数据库,这个命令发出后oracle都做了什么? alte...
  • liqfyiyi
  • liqfyiyi
  • 2012年10月07日 23:30
  • 11120

TECH: Summary For Forcing The Database Open With `_ALLOW_RESETLOGS_CORRUPTION`[ID 283945.1]

TECH: Summary For Forcing The Database Open With `_ALLOW_RESETLOGS_CORRUPTION` with Automatic Undo M...

Oracle RESETLOGS 和 NORESETLOGS 区别说明

一.创建控制文件时:Resetlogs和Noresetlogs当我们将控制文件备份到trace 文件时,可以看到里面包含了2部分的重建语句,一个是使用resetlogs,另一个是使用noresetlo...

控制文件resetlogs方式创建,有活动在线日志,当前在线日志损坏,并异常关闭(实验系列)

实验步骤: 1.        SQL> truncate table t1; Table truncated. 2.        SQL> select group#,sequence#,b...

关于resetlogs和incanation的理解

转自:http://book.51cto.com/art/200912/170082.htm 执行了不完全恢复操作,或者使用了备份的控制文件进行恢复,或者执行Flashback Database操作...

resetlogs & noresetlogs 探究

resetlogs & noresetlogs 探究 最近做试验求证出这两个选项到底是什么作用: 很多人说,resetlogs就是不完全恢复,这是不对的,做不完全恢复必须使用resetlo...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:recover through resetlogs
举报原因:
原因补充:

(最多只允许输入30个字)