Query Timeout During DB Backup

  • I have written a vbscript in which first i connect to the database, get list of databases to backup and generate backup string. I am runnig all this in a loop and trying to backup the database using

    set dbExecResult = dbConnection.Execute(backupString)

    The script ran fine for all the databases except the last one. I checked this from the log file i was creating in the same vbscript. The error I got is

    SQL Native Client 80040E31: Query Timeout Expired

    When i ran the same database backup string in SMS, it processed without any errors.

    My questions

    1. How come this script failed only on the last database with timeout. What could be the possible reasons for timeout here.

    2. Will putting delay after executing the query solve the purpose?

    3. Is there any way i could put a check to ensure that the previous statement execution is complete. I mean to say that if i put "1 , True" at the end of any statement executed at command prompt, it waits till the executed statement is finished.

  • The last one probably timed out because it took longer than the others to back up.

    You will need to specify an infinite timeout (0) when you connect to the server, rather than leave it at the default (which could be 30, 45 or 60 seconds, depending on how you are connecting)

  • Ian Scarlett (7/9/2008)


    The last one probably timed out because it took longer than the others to back up.

    yes the database was marginally bigger than others.

    You will need to specify an infinite timeout (0) when you connect to the server, rather than leave it at the default (which could be 30, 45 or 60 seconds, depending on how you are connecting)

    I'll try to specify infinite timeout while connecting to server. But that was for sure that other databases took more than 60 secs in total to backup. I'll give a shot tomorrow and hope it works. 🙂

Viewing 3 posts - 1 through 2 (of 2 total)

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