sybase :数据库不能打开的解决办法(状态装载或可疑)

平台资料:
操作系统平台:Windows 2000 5.00.2195 Service Pack 4
数据库平台:Sysbase 12.5
server:db_jc,database:db_text,db_jd,db_jh,db_app
现象:
整个服务器正常运行,此服务器上的db_jd,db_jh运行正常,只有db_text不能打开(提示状态为装载或可疑状态)。
用Powerbuilder 6.0连接时报
Database 'db_jc' cannot be opened. An earlier attempt at recovery marked it 'suspect'. Check the SQL Server errorlog
for information as to the cause.
查看错误日志errorlog,发现有这么一段:
Keys of index id 1 for table 'systhresholds' in data page not in correct order. Drop and re-create the index. (index
page 337)
The total number of data pages in this table is 1.
Table has 2 data rows.
DBCC execution completed. If DBCC printed error messages, contact a user with System Administrator (SA) role.
分析:
数据库重新启动的时候报错,该应用数据库不能online,无法访问该数据库上的应用数据。
解决办法:
查手册的表述入下
  Table 'systhresholds' in database '%.*s' is not in its
    correct sort order. Either the clustered index is
    missing or there is data corruption in the table.
和日志中表述一样,按照提示,执行dbcc
错误信息如下:
    Keys of index id 1 for table 'systhresholds' in data page not in correct order. Drop and re-create the index. (index page
337)
The total number of data pages in this table is 1.
Table has 2 data rows.
DBCC execution completed. If DBCC printed error messages, contact a user with System Administrator (SA) role.
最后的解决办法是:
isql -Usa -P************ -Sdb_jc 进入isql环境  (后面带备注)
  use master
  go
  dump database master to "/usr/sybase/master.dup"  --备份master数据库
  go
  sp_configure "allow updates", 1    --允许sysdatabases可以被修改
  go
  update sysdatabases set status = -32768 where name = 'db_text'    --状态标志修改
  go
  update sysdatabases set status2 = -32768 where name = 'db_text'
  go
  shutdown --服务器关闭
  go
  use db_text
  go
  select first from sysindexes where id = object_id("systhresholds")  --获取索引页
  go
  select count(*) from systhresholds  --获取数据行
  go
  dbcc traceon(3604)
  go
  dbcc delete_row('db_text',337;, row, 0) --删除坏行
  go
  dbcc delete_row('db_text',337, row, 1)
  go
  select count(*) from systhresholds --检查
  go
  use master
  go
  update sysdatabases set status = 0 where name = 'db_text'  --标志复位
  go
  update sysdatabases set status2 = 0 where name = 'db_text'
  go
  sp_configure "allow updates", 0  --不允许sysdatabases可以被修改
  go
  shutdown with nowait
  go
  此时启动正常了。。做dbcc检查,没有报错!
 

你可能感兴趣的:(数据库,windows,操作系统,Sybase,休闲)