Sybase数据库日志损坏时重建日志启动数据库的解决办法

   首先判断错误为页损坏或者索引损坏,根据数据库

Adaptive Server failed to retrieve a row via its RID in database 'escourt5' because the requested RID has a higher number than the last RID on the page. Rid pageid = 0x1c88a8; row num = 0x27. Page pointer = 0x261CA000, pageno = 1869992, status = 0x1, objectid = 8, indexid = 0, level = 0.ui

判断其中:objectid = 8 表示日志段有问题this

 

解决方法一:截断日志spa

先把sysdatabases status 修改为-32768  而后从新启动数据库日志

1>update sysdatabases set status = -32768 where name = "escourt5"索引

4>goci

登录数据库it

1> dump transaction escourt5 with truncate_onlyio

2> goast

Msg 921, Level 14, State 1:

Line 1:

Database 'escourt5' has not been recovered yet - please wait and try again.

1>  dump transaction escourt5 with no_log

2>  go

Msg 921, Level 14, State 1:

Line 1:

Database 'escourt5' has not been recovered yet - please wait and try again.

说明这种发不起做用

解决方法二:重作日志

1>  sp_role "grant","sybase_ts_role",sa

2>  go

All the roles specified to be granted in the grant role statement have already

been granted to grantee 'sa'.

Authorization updated.

(return status = 0)

1>  use master

2>  go

1>  dbcc rebuild_log(escourt5,1,1)

2>  go

DBCC execution completed. If DBCC printed error messages, contact a user with

System Administrator (SA) role.

1>  shutdown with nowait

2>  go

Server SHUTDOWN by request.

The SQL Server is terminating this process.

重启服务后把status修改为0后再重启服务。

服务启动正常

最好是经过dbcc checkdb(databasename)检查一下数据一致性。

相关文章
相关标签/搜索