码迷,mamicode.com
首页 > 数据库 > 详细

sybase ASE日志溢出解决方式探究

时间:2014-10-21 17:54:01      阅读:452      评论:0      收藏:0      [点我收藏+]

标签:sybase   数据库   


1.准备数据库环境

--创建设备
disk init name='dat1',physname='/opt/sybase/data/dat1',size='1M'
disk init name='log1',physname='/opt/sybase/data/log1',size='1M'
--设备太小,扩充
disk resize name='dat1',size='1M'
--创建数据库
create database test on dat1='2M' log on log1='1M'


2.插入数据一直到日志满

use test
go
create table person(name varchar(64)) 
insert into person values('name')
insert into person select * from person
--truncate table person
dbcc checktable('syslogs')


3.出现现象如下

1.free为7%,进程出现logsuspend状态,数据库日志中出现 xtasks are sleeping .for space to become available in the log segment for database test
2.进程状态为LOGSUSPEND

 

4.经测试,执行如下操作可以解决问题

1.如果 syslogshold无数据,则可以直接执行dump transaction test with truncate_only

2.如果 syslogshold有数据,则直接执行dump transaction test with truncate_only,可能报如下错误

‘DUMP TRANSACTION for database 'test' could not truncate the log. Either extend the log using ALTER DATABASE ... LOG ON command or eliminate the oldest active transaction in database 'test' shown in syslogshold table.’

 这个时候可以选择三种方式进行处理

     1.kill进程,用kill with status_only监控回滚进度

     2.重启服务

     3.增加设备

 重启方式测试:

 

[root@sybasehost ~]# isql -Usa -P -S ASE12_5_4                                                                                
1> shutdown  
2> go
2 task(s) are sleeping waiting for space to become available in the log segment
for database test.

日志中出现如下信息:

SHUTDOWN is waiting for 1 process(es) to complete.
SHUTDOWN is waiting for 1 process(es) to complete.

进程hang住,这时从另外一个窗口进去,用shutdown with nowait停掉,然后重启,重启后用户库标红,状态为suspend

bubuko.com,布布扣

执行执行online database test,报错如下

 

  SQL Server could not bring database 'test' online.


执行dump transaction test with truncate_only,然后online database test成功

 

增加设备方式测试

disk init name='log2',physname='/opt/sybase/data/log2',size='1M'
alter database test log on log2   ='1M'

显示执行成功

Extending database by 512 pages (1.0 megabytes) on disk log2
Warning: Using ALTER DATABASE to extend the log segment will cause user thresholds on the log segment within 128 pages of the last chance threshold to be disabled.
执行时间: 1.471 秒


原来挂起的进程自动继续执行

已插入 8192 行
Space available in the log segment has fallen critically low in database 'test'.  All future modifications to this database will be suspended until the log is successfully dumped and space becomes available.
The transaction log in database test is almost full.  Your transaction is being suspended until space is made available in the log.
执行时间: 158.9 秒


 

总结:

 

出现日志挂起,可以采用三种方式处理

     1.kill进程,用kill with status_only监控回滚进度

     2.重启服务,记着要用shutdown with nowait,重启后要先截断日志再online数据库

     3.增加设备


 

sybase ASE日志溢出解决方式探究

标签:sybase   数据库   

原文地址:http://blog.csdn.net/lileizhang/article/details/40344805

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!