笔者在一台生产用测试库上SELECT一个表时出现ORA-01578,一个块损坏,以前学习过块损坏怎么处理,到还真没遇到过,今天总算让我遇到了,还是一台生产用测试库,就不用很紧张了。
数据库版本是9.2.0.4,Oracle9i的RMAN有一个blockrecover命令,可以在线修复坏块,以下就是使用RMAN修复坏块的过程。
|
报ORA-01578数据块损坏,以下使用RMAN命令查询是否可以使用blockrecover命令恢复以及怎样恢复
使用rman登录catalog数据库
|
查找最近datafile 15的全备份,今天下午刚做了一次RMAN的全备份
RMAN> list backup of datafile 15;
List of Backup Sets
===================BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
643 Full 64K DISK 00:00:27 16-MAR-09
BP Key: 650 Status: AVAILABLE Tag: TAG20090316T154352
Piece Name: /d02/fullbackup/20090316_data_24_1
List of Datafiles in backup set 643
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
15 Full 11856250905 16-MAR-09 /d01/app/oracle/oradata/dpa/dpa01.dbf
查找SCN 11856250905 以后的archivelog是否有备份
|
查找sequence 110 以后的archivelog是否有备份
|
从以上查询中可以看出datafile 15有一次最近的全备份,有全备份以来的所有archivelog,online redo log
下面开始blockreocver,其实命令很简单
RMAN> blockrecover datafile 15 block 18;
Starting blockrecover at 16-MAR-09
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=16 devtype=DISK
channel ORA_DISK_1: restoring block(s)
channel ORA_DISK_1: specifying block(s) to restore from backup set
restoring blocks of datafile 00015
channel ORA_DISK_1: restored block(s) from backup piece 1
piece handle=/d02/fullbackup/20090316_data_24_1 tag=TAG20090316T154352 params=NULL
channel ORA_DISK_1: block restore completestarting media recovery
archive log thread 1 sequence 111 is already on disk as file /d02/arch/1_111.dbf
archive log thread 1 sequence 112 is already on disk as file /d02/arch/1_112.dbf
channel ORA_DISK_1: starting archive log restore to default destination
channel ORA_DISK_1: restoring archive log
archive log thread=1 sequence=109
channel ORA_DISK_1: restoring archive log
archive log thread=1 sequence=110
channel ORA_DISK_1: restored backup piece 1
piece handle=/d02/fullbackup/20090316_arch_28 tag=TAG20090316T154731 params=NULL
channel ORA_DISK_1: restore complete
media recovery complete
Finished blockrecover at 16-MAR-09
SQL> select * from dpa_history;
PRODLINEID BARCODE PA
---------- ------------------------------ --
7 S*33040-D8311050149512B 03
7 S*33040-D8311050143512B 03
7 S*33040-D8311050140512B 03
7 S*33040-D8311050144512B 03
7 S*33040-D8311050151512B 03
7 S*33040-D8311050262512B 03
7 S*33040-D8311050552512B 03
7 S*33040-D8311050345512B 03
7 S*33040-D8311050170512B 03
【编辑推荐】