我们的一套老系统,数据文件放在USERS表空间中,偶然的情况下发现user01.dbf数据文件中有坏块了,备份数据正常,但是SQL查询时会报错,报错信息如下:

ORA-01110: data file 5: '/oradata/bloodora/users01.dbf'
; nested exception is java.sql.SQLException: ORA-01578: ORACLE data block corrupted (file # 5, block # 266819)
ORA-01110: data file 5: '/oradata/bloodora/users01.dbf'
查看oracle的log信息,发现以下错误内容:

Corrupt block relative dba: 0x01441243 (file 5, block 266819)
Bad check value found during buffer read
Data in bad block -
 type: 6 format: 2 rdba: 0x01441243
 last change scn: 0x0000.00181579 seq: 0x2 flg: 0x04
 consistency value in tail: 0x15790602
 check value in block header: 0x4384, computed block checksum: 0x800
 spare1: 0x0, spare2: 0x0, spare3: 0x0
***

本来以为要将红旗的双机热备停止下来再操作,结果误打误撞,红旗Linux的工程师没来得及停掉双机我就操作了,直接DROP掉USERS表空间,再新建一个USERS空间,导入数据后正常。

语句如下:

sqlplus /nolog

connect ​​xxx/password@sid​​ as sysdba

DROP TABLESPACE USERS INCLUDING CONTENTS;

CREATE TABLESPACE USERS DATAFILE '/oradata/bloodora/users01new.dbf' SIZE 1024M REUSE
AUTOEXTEND ON NEXT 10240K
MINIMUM EXTENT 1024K
DEFAULT STORAGE ( INITIAL 128K NEXT 128K MINEXTENTS 1 MAXEXTENTS 4096 PCTINCREASE 0);

imp 导入数据后测试正常。