ShenTong oscar DB CRC error
测试服务器掉电,重启后尝试启动神通数据库不成功,在elog里面看到如下信息:
2020-06-30 09:07:44, /*Session 65535*/ WARNING, file operate faild, the reason is on the file /oscardb/ShenTong/odbs/OSRDB/OSRDB04.dbf to access occurs when CRC errors
2020-06-30 09:07:44, /*Session 65535*/ WARNING, file operate faild, the reason is on the file /oscardb/ShenTong/odbs/OSRDB/OSRDB04.dbf to access occurs when CRC errors
2020-06-30 09:07:44, /*Session 65535*/ WARNING, file operate faild, the reason is on the file /oscardb/ShenTong/odbs/OSRDB/OSRDB04.dbf to access occurs when CRC errors
2020-06-30 09:07:44, /*Session 65535*/ WARNING, file operate faild, the reason is on the file /oscardb/ShenTong/odbs/OSRDB/OSRDB04.dbf to access occurs when CRC errors
看现象似乎是文件校验错误,也许掉电导致的写坏了文件吧,测试库没有备份。
根据错误提示,将数据库的DOUBLE WRITE和CHECK SUM都关掉,修改$SZ_OSCAR_HOME/admin/OSRDB.conf:
ENABLE_DOUBLE_WRITE=false
ENABLE_CHECK_SUM=false
重启数据库就可以起来了,我这个测试库是用来跑benchmarkSQL的,测试数据可以再生成,如果是在生产环境中,这样起码可以抢救部分数据。
数据库虽然能起来,但是数据错误肯定还是存在的,尝试跑benchmarkSQL,果然报错:
09:41:51,963 [Thread-6] ERROR jTPCCTData : ERROR, physical table operation error, 璇诲彇RowId:19984736231544880, SegmentId:12884902096澶辫触,椤甸潰 3.186416 璇诲彇閿欒
ERROR, physical table operation error, 璇诲彇RowId:19984736231544880, SegmentId:12884902096澶辫触,椤甸潰 3.186416 璇诲彇閿欒
at com.oscar.protocol.OSCARProtocol.query(Unknown Source)
at com.oscar.core.QueryExecutor.execute(Unknown Source)
at com.oscar.jdbc.OscarStatement.executeStatement(Unknown Source)
at com.oscar.jdbc.OscarStatement.executeUpdate(Unknown Source)
at jTPCCTData.executeDeliveryBG(jTPCCTData.java:1684)
at jTPCCTData.execute(jTPCCTData.java:115)
at jTPCCTerminal.executeTransactions(jTPCCTerminal.java:237)
at jTPCCTerminal.run(jTPCCTerminal.java:88)
at java.lang.Thread.run(Thread.java:748)
从错误信息看,不是索引,是表,如果是索引,重建就好了,是表就麻烦,但是还有一丝希望,就是如果坏的是个小配置表,还是可以从别的地方导过来的。按segment_id, 从数据库里查对象名:
SQL> select object_name,object_id,data_object_id from dba_objects where data_object_id=12884902096;
OBJECT_NAME | OBJECT_ID | DATA_OBJECT_ID
——————+———–+—————-
BMSQL_ORDER_LINE | 33997 | 12884902096
(1 row)
是一张大表,尝试全扫(不加hint就扫索引了):
SQL> select /*+ full(t1)*/ count(*)from bmsql_order_line t1;
ERROR, physical table operation error, 页面 3.186376 读取错误
查了半天文档,也没看到有dbms_repair这样的包或其他类似工具,只能放弃,重新生成数据了,当然,如果有备份,这个事就比较简单了,所以备份不能忘。