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

一个人想着一个人 提交于 2019-11-30 02:41:15

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

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.

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

 

解决方法一:截断日志

先把sysdatabases status 修改成-32768  然后重新启动数据库

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

4>go

登陆数据库

1> dump transaction escourt5 with truncate_only

2> go

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)检查一下数据一致性。

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!