Detecting Database Maintenance Mode on remote Server

  • (Visual 6.0 C/C++)Lets say you have a piece of code that does database updates to a primary server at a remote site and these updates take about 2 to 3 seconds to complete. This application is designed to collect, parse, and save data in a do while true loop that runs forever. Now, lets say that all works great until...

    at a specified time during the week, the remote server enters maintenance mode where the tables are backed upa nd all the tables are optimized and shrunk (standard maintenance).

    During this time, the application crashes with run time error. If I turn off the server optimization (database tuning), then all is well and the app runs fluidly.

    Is there a way to detect and avoid this condition, i.e. detecting if the database is in or enterring into maintenance mode? I am stuck on the proper method of dealing with this one.

  • Usually this kind of maintenece is performed with Jobs. If you can query job status and next run date/time you should be able to  aviod the contention

     


    * Noel

  • Usually this kind of maintenece is performed with Jobs. If you can query job status and next run date/time you should be able to  aviod the contention

    I guess what I am asking for is: how?

    FYI: app is written in VC/C++ MSVS6.0, using ADO and MSSQL2K.

  • Select * from msdb.dbo.SysJobHistory where Run_Status = 4 AND job_id = '3017EDE7-E5AC-4ECA-A376-FCEA13AD57DC'

    Run_Status = 4 means that the step is running, look at the same table to find the correct job_id.

  • YES!!! YOU ROCK!! This is exactly what i was looking for!!

     

    Thank you so very much!

  • HTH.

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply