SYBASE数据库一般错误处理(重做日志)

SYBASE数据库一般错误处理(重做日志)

导入导出数据库对象表,索引(视图,规则,缺省值,触发器,存储过程)等定义

defncopy.exe
$sybaseocs-12_5in

select "defncopy -Usa -P -Ssir out "+name+".sql market50 "+name from sysobjects where type='P'


Error: 3475, Severity: 21, State:
7
00:00000:00001:2000/01/04 07:43:42.68 server Can't allocate space for object
'syslogs' in database 'DBbad' because 'logsegment' segment is full/has no free
extents. If you ran out of space in syslogs, dump the transaction log.
Otherwise, use ALTER DATABASE or sp_extendsegment to increase size of the
segment.
00:00000:00001:2000/01/04 07:43:42.68 server Error: 3475, Severity: 21, State:
7
00:00000:00001:2000/01/04 07:43:42.68 server There is no space available in
SYSLOGS for process 1 to log a record for which space has been reserved. This
process will retry at intervals of one minute. The internal error number is -4.

1. You will have to bring the server up with trace flag 3608 to prevent the
recovery of the user databases.
2. sp_configure "allow updates",1
go
3. Write down the segmap entries from the sysusages table for the toasted
database.
4. update sysusages
set segmap = 7
where dbid = db_id("my_toasted_db")
and segmap = 3
5. select status - 320
from sysdatabases
where dbid = db_id("my_toasted_db") -- save this value.
go
begin transaction
update sysdatabases set status = -32768 where dbid = db_id("my_toasted_db")
go -- if all is OK, then...
commit transaction
go
shutdown
go
6. Restart the server without the trace flag. With luck it should now have
enough space to recover. If it doesn't, you are in deeper trouble than
before, you do have a good, recent backup don't you?
7. dump database my_toasted_db with truncate_only
go
8. Reset the segmap entries in sysusages to be those as saved in 3. above.
9. Shutdown ASE and restart. (The traceflag should have gone at step 6., but
ensure that it is not there!)

sybase数据库error 3474的解决。
3474错误:"During redo the page timestamp value is less than old timestamp from log.Page……"

isql -Usa -P -Ssybase :

1>sp_configure "allow updates",1
2>go

1>update sysdatabases set status=-32768 where name="xtsum"
2>go

1>shutdown

2>go

重新启动数据库服务。
isql -Usa -P -Ssybase
1>dbcc rebuild_log(xtsum,0,0)

2>go

1>dbcc rebuild_log(xtsum,1,1)
2>go

1>shutdown

2>g
重新启动数据库服务器
isql -Usa -P -Ssybas
1>update sysdatabases set status=12 where name="xtsum"

2>g
1>sp_configure "allow updates",0
2>
1>shutdown
2>
重启数据库后,恢复正常,rebuild log工作完成。


返回结果查询
select 'truncate table ' + name from sysobjects where type = 'U' and name like 'Tbt_Mk%Up'

SYBASE3414错误处理:

解决办法:

重建数据库日志,方法如下:
 (1)赋予sa用户sybase_ts_role的角色
isql -Usa -P
1>sp_role "grant","sybase_ts_role",sa
2>go
1>quit

(2)将数据库置为"bypass recovery"状态
isql -Usa -P
1>sp_configure "allow updates",1
2>go
1>use master
2>go
1>update sysdatabases set status=-32768
2>where name="database_name"
3>go
1>shutdown with nowait r`;m'H!
2>go

(3)rebuild数据库日志
重启Server
isql -Usa -P q=7$ |_.
1>use master
2>go
1>dbcc rebuild_log(database_name,1,1)
2>go
1>shutdown with nowait
2>go

(4)重启server
1>use master
2>go
1>update sysdatabases set status=0 where name="database_name"
2>go
1>sp_configure "allow updates",0
2>go
1>shutdown with nowait
2>go

(5)在重启server之后,如果数据库恢复正常,rebuild log工作将会成功完成,否则要恢复数据库备份,使用dump database或bcp命令。

推荐阅读