Oracle数据库数据恢复、性能优化

找回密码
注册
搜索
热搜: 活动 交友 discuz
发新帖

0

积分

1

好友

48

主题
1#
发表于 2012-12-24 15:06:41 | 查看: 3904| 回复: 3
DB:10.2.0.5
OS:linux redhat 4.0

在做不完全恢复的时候指定scn,但是却不能恢复到这个点

我指定的是scn 747775 但是最后从v$datafile_header上的checkpoint_change#看到的是 747780

使用rman全备数据库后恢复
RMAN> restore database;
Starting restore at 2012-12-24 14:41:15
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=157 devtype=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: sid=155 devtype=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: sid=154 devtype=DISK
allocated channel: ORA_DISK_4
channel ORA_DISK_4: sid=153 devtype=DISK
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00002 to /u01/app/oracle/oradata/RAC1/undotbs01.dbf
restoring datafile 00005 to /u01/app/oracle/oradata/RAC1/test01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/oradata/RAC1/db_0_RAC1_68_1.bak
channel ORA_DISK_2: starting datafile backupset restore
channel ORA_DISK_2: specifying datafile(s) to restore from backup set
restoring datafile 00003 to /u01/app/oracle/oradata/RAC1/sysaux01.dbf
restoring datafile 00004 to /u01/app/oracle/oradata/RAC1/users01.dbf
channel ORA_DISK_2: reading from backup piece /u01/app/oracle/oradata/RAC1/db_0_RAC1_67_1.bak
channel ORA_DISK_3: starting datafile backupset restore
channel ORA_DISK_3: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /u01/app/oracle/oradata/RAC1/system01.dbf
channel ORA_DISK_3: reading from backup piece /u01/app/oracle/oradata/RAC1/db_0_RAC1_66_1.bak
channel ORA_DISK_1: restored backup piece 1
piece handle=/u01/app/oracle/oradata/RAC1/db_0_RAC1_68_1.bak tag=TAG20121224T143416
channel ORA_DISK_1: restore complete, elapsed time: 00:00:05
channel ORA_DISK_2: restored backup piece 1
piece handle=/u01/app/oracle/oradata/RAC1/db_0_RAC1_67_1.bak tag=TAG20121224T143416
channel ORA_DISK_2: restore complete, elapsed time: 00:00:40
channel ORA_DISK_3: restored backup piece 1
piece handle=/u01/app/oracle/oradata/RAC1/db_0_RAC1_66_1.bak tag=TAG20121224T143416
channel ORA_DISK_3: restore complete, elapsed time: 00:00:47
Finished restore at 2012-12-24 14:42:03
RMAN> recover database until scn 747775
2> ;
Starting recover at 2012-12-24 14:43:07
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
using channel ORA_DISK_4
starting media recovery
archive log thread 1 sequence 1 is already on disk as file /u01/app/oracle/product/10.2/db_1/dbs/arch1_1_802879164.dbf
archive log thread 1 sequence 2 is already on disk as file /u01/app/oracle/product/10.2/db_1/dbs/arch1_2_802879164.dbf
archive log thread 1 sequence 3 is already on disk as file /u01/app/oracle/product/10.2/db_1/dbs/arch1_3_802879164.dbf
archive log filename=/u01/app/oracle/product/10.2/db_1/dbs/arch1_1_802879164.dbf thread=1 sequence=1
media recovery complete, elapsed time: 00:00:02
Finished recover at 2012-12-24 14:43:10




4#
发表于 2012-12-26 13:11:44
就此问题,我反复做了好几次。
最后想到用logmnr看一下里里面的记录情况
比如其中一个log的scn情况如下:
SQL> select scn,cscn from v$logmnr_contents;

       SCN       CSCN
---------- ----------
    778812
    778812
    778812
    778813
    778817
    778817
    778817
    778822
    778822
    778822
    778823

       SCN       CSCN
---------- ----------
    778827
    778827
    778827
    778829     778829

15 rows selected.
如果指定任意一个记录面有的scn,都可以准确的恢复到。
如果不是在记录里面就不一定恢复到指定的点,比如:
指定到778830,就会恢复到778831,但是对数据库来讲到778830和778831的状态是一样的。

回复 只看该作者 道具 举报

3#
发表于 2012-12-24 15:49:03
按照你给的脚本恢复,出来时如下结果
SQL> select current_scn from V$DATABASE;

CURRENT_SCN
-----------
          0

SQL> select checkpoint_change# from v$datafile_header;

CHECKPOINT_CHANGE#
------------------
            747780
            747780
            747780
            747780
            747780

SQL>

回复 只看该作者 道具 举报

2#
发表于 2012-12-24 15:31:27
run
{
set until scn  747775;
restore database;
recover database;
}

alter database mount;

select current_scn from V$DATABASE;
select checkpoint_change# from v$datafile_header;

回复 只看该作者 道具 举报

您需要登录后才可以回帖 登录 | 注册

QQ|手机版|Archiver|Oracle数据库数据恢复、性能优化

GMT+8, 2024-11-16 04:44 , Processed in 0.047389 second(s), 22 queries .

Powered by Discuz! X2.5

© 2001-2012 Comsenz Inc.

回顶部
TEL/電話+86 13764045638
Email service@parnassusdata.com
QQ 47079569