修改Sybase数据库最大连接数

今天有一家客户说数据库产生了错误,让我看一下。

Error: 1601, Severity: 17, State: 3 There are not enough 'user connections' available to start a new process. Retry when there are fewer active users, or ask your System Administrator to reconfigure SQL Server with more user connections.

经分析,认为是连接数太小导致,需要修改数据库的最大连接数。

1、查看最大连接数

sp_configure 'number of user connections'

结果如下:

Parameter Name                 Default     Memory Used Config Value Run Value   Unit                 Type      

--------------                 -------     ----------- ------------ ---------   ----                  ----      

number of user connections              25        2372          25           25 number               dynamic

Sybase的数据库默认最大连接数为25,当连接数不够用的情况下,需要修改数据库配置。

2、修改为200

sp_configure 'number of user connections',200

报如下错误:

Server Message: Number 7415, Severity 10

Procedure 'sp_configure', Line 606:

The transaction log in database master is almost full. Your transaction is being suspended until space is made available in the log.

看来是由于日志空间将满导致,需清除日志。

清除Log有两种方法:

1>自动清除法

开放数据库选项 Trunc Log on Chkpt,使数据库系统每隔一段时间自动清除Log。此方法的优点是无须人工干预,由SQL Server自动执行,并且一般不会出现Log溢满的情况;缺点是只清除Log而不做备份。

2>手动清除法

执行命令“dump transaction”来清除Log。以下两条命令都可以清除日志:

dump transaction with truncate_only

dump transaction with no_log

通常删除事务日志中不活跃的部分可使用“dump transaction with trancate_only”命令,这条命令写进事务日志时,还要做必要的并发性检查。SYBASE提供“dump transaction with no_log”来处理某些非常紧迫的情况,使用这条命令有很大的危险性,SQL Server会弹出一条警告信息。为了尽量确保数据库的一致性,你应将它作为“最后一招”。

以上两种方法只清除日志,而不做日志备份,若想备份日志,应执行“dump transaction database_name to dumpdevice”命令。

3、清除日志,选用第一种方法

dump transaction melinets with truncate_only

清除后执行sp_configure 'number of user connections',200

发现依然存在该错误

Server Message: Number 7415, Severity 10

Procedure 'sp_configure', Line 606:

The transaction log in database master is almost full. Your transaction is being suspended until space is made available in the log.

4、看来还需要清除一下master的日志文件

dump transaction master with truncate_only

再次执行sp_configure 'number of user connections',200

结果报如下错误,提示'max memory'值不够大

Server Message: Number 5861, Severity 16

Procedure 'sp_configure', Line 606:

The current 'max memory' value '23552', is not sufficient to change the parameter 'number of user connections' to '200'. 'max memory' should be greater than 'total logical memory' '26606' required for the configuration.

(1 row affected)

(return status = 1)

5、根据失败提示信息,修改'max memory'为需要的值

sp_configure 'max memory',26606

执行结果

Parameter Name                 Default     Memory Used Config Value Run Value   Unit                 Type      

--------------                 -------     ----------- ------------ ---------   ----                 ----      

max memory                           23552       53212       26606        26606 memory pages(2k)     dynamic   

Configuration option changed. The SQL Server need not be rebooted since the option is dynamic.

Changing the value of 'max memory' to '26606' increases the amount of memory ASE uses by 10 K.

(1 row affected)

(return status = 0)

6、重新修改连接数,终于成功

sp_configure 'number of user connections',200

结果如下:

 

Parameter Name                 Default     Memory Used Config Value Run Value   Unit                 Type      

-------------                 -------     ----------- ------------ ---------   ----                 ----      

number of user connections              25       17347         200          200 number               dynamic

Configuration option changed. The SQL Server need not be rebooted since the option is dynamic.

Changing the value of 'number of user connections' to '200' increases the amount of memory ASE uses by 19534 K.

(1 row affected)

(return status = 0)

7、重启数据库服务。

刚发表这篇日志,那个客户就来找我,说中午人少的时候把数据库服务期重启了,然后所有的系统都不能用了。晕哦,有点严重,马上远程连接看了下,ping也ping不通,看了一下服务也没有启,请教了一下老员工,说可能是由于内存比较小,承受不了200个连接,要改小一点。于是在sybase根目录下找到sybase.cfg,将number of user connections的值由200改为100,然后就可以启动数据库服务了。所以,改连接数的时候还要充分考虑内存的问题。

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值