×

Loading...
Ad by
  • 推荐 OXIO 加拿大高速网络,最低月费仅$40. 使用推荐码 RCR37MB 可获得一个月的免费服务
Ad by
  • 推荐 OXIO 加拿大高速网络,最低月费仅$40. 使用推荐码 RCR37MB 可获得一个月的免费服务

我的建议

仅仅从你的表述很难判断到底是什么问题,潜在的一个原因是,大量的applications 如果都share 这么几个database, 那么就很容易产生locking, 如果这些locks被hold的时间过长,就有可能在前台出现time out 的错误。

1。看看你的那些application是不是大量的使用了transaction block
2。检查一下你的sql errorlog,看看出现timeout error 时候, sql server 的log里相应的error entry是什么。
3. 打开performance monitor, 选择cache hit ratio, system usage %,transactionlog usage , locking activitity等几个counter, 当问题出现的时候看看相应的performance chart
4。你的application有没有大量使用cursor,这常常会消耗大量的memory,如果cursor又没有及时release,就可能使得系统没有足够的资源去处理application query.
5.你的system memory是多大?
6。你设置的page file 多大?
Report

Replies, comments and Discussions:

  • 工作学习 / IT技术讨论 / SQL Server 7 高手请进!
    一台SQL Server 7, 其中database有5个, size 最大的为534M, 其余的约为200M。约有20多个applications 利用这个 sql server. 局域网用户为1500多。

    问题:所有应用程序运行正常,但每隔一个星期左右当用户使用应用程序时,程序就不能正常运行,提示 "Time Out Error" 。所有应用程序均为 web applications (ASP). 必须 stop then restart SQL Server Service , 然后一切正常。但过一个星期左右同样情况又会出现。

    请高手们给个解决办法。先谢了!
    • 是不是程序里有的数据库链接没断掉,数据库维护链接越来越多,然后down掉
      • select the counter connection memory (KB) under sql server:memory manager for the perf monitor to verify if the number of non-closed connections is the cause.
    • 我的建议
      仅仅从你的表述很难判断到底是什么问题,潜在的一个原因是,大量的applications 如果都share 这么几个database, 那么就很容易产生locking, 如果这些locks被hold的时间过长,就有可能在前台出现time out 的错误。

      1。看看你的那些application是不是大量的使用了transaction block
      2。检查一下你的sql errorlog,看看出现timeout error 时候, sql server 的log里相应的error entry是什么。
      3. 打开performance monitor, 选择cache hit ratio, system usage %,transactionlog usage , locking activitity等几个counter, 当问题出现的时候看看相应的performance chart
      4。你的application有没有大量使用cursor,这常常会消耗大量的memory,如果cursor又没有及时release,就可能使得系统没有足够的资源去处理application query.
      5.你的system memory是多大?
      6。你设置的page file 多大?
      • 多谢DX的建议,以下是对你问题的回答. Hope you can get more ideas, thanks.
        本文发表在 rolia.net 枫下论坛多谢DX的建议。以下是对你问题的回答:

        1。看看你的那些application是不是大量的使用了transaction block
        Answer: 在所有 application 中,即使用到 transaction也有明显的 begin transaction, commit transaction, 或 rollback. 而且 transaction 用得不是很多。

        2。检查一下你的sql errorlog,看看出现timeout error 时候, sql server 的log里相应的error entry是什么。
        Answer. sql server log 中没有如何异常现象。

        3. 打开performance monitor, 选择cache hit ratio, system usage %,transactionlog usage , locking activitity等几个counter, 当问题出现的时候看看相应的performance chart
        Answer: Cache hit ratio = 100% (which is normal)
        Total memory usage (1G, which is the largest size SQL Server has been assigned, I set the server to fixed memory(1G) in stead of dynamic after we encounter the problem. It works for a month, then the same thing happened again. The total server memory is 2G)

        4。你的application有没有大量使用cursor,这常常会消耗大量的memory,如果cursor又没有及时release,就可能使得系统没有足够的资源去处理application query.
        Answer: All these applications are ASP app. Theoriotically, all the database object (connections, recordsets) should be automatically destroyed by IIS. So this should not be a reason. P.S. 95% connections have been closed after use.

        5.你的system memory是多大?
        Answer: 2G

        6。你设置的page file 多大?
        Answer: C drive max 1G, e drive max 4G, f drive max 4G.更多精彩文章及讨论,请光临枫下论坛 rolia.net
        • 我的直觉: 问题可能是由于memory leak 或者是locking造成的.
          本文发表在 rolia.net 枫下论坛1. SQL 7 在SP1 之前存在memory leak的问题,当然如果你已经apply 了最新的sp, 这个应该不是问题了.
          2.关于locking的问题, 可能是单一的statement(implicit transaction)或者是所谓的transaction block造成的. 当一个statement去access一个object时,其他的statement如果也要试图打开同一个object就只有等待,一直到前者完成为止,如果前者持续的时间过长,就有可能造成后者出现tiemout error.要确定是否这个问题,你可以打开sql profile,当问题出现的时候,看看当时在server端运行的是什么东西,是否由于它block住了其他的transaction.

          这儿有几点要说明一下:

          1.transaction应该尽量短,前后加begin tran 和commit tran 以及rollback 是explicit transaction 的基本要求,但不代表那个transaction就不会产生blocking.要知道在transaction commit 或 rollback之前,所有的被用的object都是被lock住的.
          2.不管你的application是否ASP,依然可能通过stored proc调用server cursor, 你所说的recordset相对于SQL SERVER 来说基本属client cursor,对server影响的是前者
          3.如果你的server只是用于SQL SERVER, 你应该使用dynamic memory setting, 只是限制一下maximum value就可以了, 对database 来说,memory 总是越多越好的.

          几点不成熟的意见,仅供参考.更多精彩文章及讨论,请光临枫下论坛 rolia.net
        • 这个错误一个星期左右才会发生,应该不是locking的问题。如果是locking,应该有一定随机性。这是一个时间积累的错误,应该是资源越来越少。应该检查数据库链接或cursor等是否用完释放。另外IIS并不释放DB connection
    • http://www.sqlmag.com/forums/messageview.cfm?catid=8&threadid=6794