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)檢查一下數據一致性。

相關文章
相關標籤/搜索