Timeout Expired error calling sp from ADO script
DavidCook
Posts: 8 Bronze 2
I'm experiencing a "Timeout expired" error condition running the SQLBackup 5.1 stored procedure from within an ADO VBScript on a large-ish (40+Gb) SQL Server 2000 database. The script works fine if I run it on a 1 Gb database, only the large one causes the timeout error condition. The interesting point is that the SQLBackup 5.1 GUI shows the backup as successful, even when the ADO script has eventually died with the timeout error.
Note that running the commandline version of SQLBackup 5.1 on the large database works fine, it's only the stored procedure version that is causing me grief.
Here is the script I am using:
' VBS script to backup up an SQLServer 2000 DB to a file share using Red-Gate's SQLBackup's stored procedure via ADO
' 20070618 dac
Option Explicit
Dim myConn
Dim mySQLCmdText
' Initialise connection object
set myConn=CreateObject("ADODB.Connection")
' Open connection to SQL server
myConn.Open="Provider=SQLOLEDB;Data Source=DB-SERVER;Initial Catalog=master;Trusted_Connection=Yes;"
' Load command to run stored procedure
mySQLCmdText= "exec master..sqlbackup N'-SQL ""BACKUP DATABASE [BigDB] TO DISK = [\\DB-SERVER\SQLBackup\BigDB-20070622.sqb] WITH INIT, COMPRESSION = 1""'"
' Execute the command
myConn.Execute mySQLCmdText
' Close connection
myConn.close
' That's All Folks!
Any ideas?
Cheers
David Cook
Technical Services Manager
Latrobe Health Services
Note that running the commandline version of SQLBackup 5.1 on the large database works fine, it's only the stored procedure version that is causing me grief.
Here is the script I am using:
' VBS script to backup up an SQLServer 2000 DB to a file share using Red-Gate's SQLBackup's stored procedure via ADO
' 20070618 dac
Option Explicit
Dim myConn
Dim mySQLCmdText
' Initialise connection object
set myConn=CreateObject("ADODB.Connection")
' Open connection to SQL server
myConn.Open="Provider=SQLOLEDB;Data Source=DB-SERVER;Initial Catalog=master;Trusted_Connection=Yes;"
' Load command to run stored procedure
mySQLCmdText= "exec master..sqlbackup N'-SQL ""BACKUP DATABASE [BigDB] TO DISK = [\\DB-SERVER\SQLBackup\BigDB-20070622.sqb] WITH INIT, COMPRESSION = 1""'"
' Execute the command
myConn.Execute mySQLCmdText
' Close connection
myConn.close
' That's All Folks!
Any ideas?
Cheers
David Cook
Technical Services Manager
Latrobe Health Services
Comments
You want to set the SqlCommand's CommandTimeout property to 0.
Here is an example.
SQL Backup Consultant Developer
Associate, Yohz Software
Beyond compression - SQL Backup goodies under the hood, updated for version 8