Error backup database using SQL statement..Experience Timeout.Help...Urgent.

V

Vanessa

Hi,
I'm using SQL Server 2000 as my database and I'm trying to backup the database through the software using SQL statement.

One of my Client experienced an error,
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. System.Data.SqlClient.sqlexception: Timeout Expired: the timeout period elapsed prior to Completion of the operation or the server is not responding....

The Backup operation is done halfway then the system will throw out this error.

Among my Clients, only One experienced this, I do not know why this happen. Does any know? How can I solve this? My Procedure for Backup is I called my Backup from PerformLocalBackup,creating all the necessary device.


Public Sub PerformLocalBackup(ByVal filePathOnDBServer As String, ByVal dbCatalog As String)

'Drop Existing Backup Device

If (DeviceExists()) Then

DropDevice()

End If

'Create Backup Device

CreateNewDevice(filePathOnDBServer)

'Process Backup

BackupDatabase(dbCatalog)

VerifyDeviceFile()

'Drop Backup Device

DropDevice()

End Sub



Public Sub BackupDatabase(ByVal databaseName As String)

Dim myCMD As New SqlCommand

myCMD.Connection = my_SqlConnection

myCMD.CommandType = CommandType.Text

Try

myCMD.Connection.Open()

myCMD.CommandText = "USE MASTER BACKUP DATABASE " & databaseName & " TO myCASDevice WITH INIT"

Console.WriteLine(myCMD.CommandText)

myCMD.ExecuteNonQuery()

Catch ex As Exception

Throw ex

Finally

myCMD.Connection.Close()

End Try

End Sub

Please Help.



Regards
Vanessa
 
M

Miha Markic [MVP C#]

Hi Vanessa,

Try increasing the CommandTimeout property of SqlCommand instance.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com
Hi,
I'm using SQL Server 2000 as my database and I'm trying to backup the database through the software using SQL statement.

One of my Client experienced an error,
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. System.Data.SqlClient.sqlexception: Timeout Expired: the timeout period elapsed prior to Completion of the operation or the server is not responding....

The Backup operation is done halfway then the system will throw out this error.

Among my Clients, only One experienced this, I do not know why this happen. Does any know? How can I solve this? My Procedure for Backup is I called my Backup from PerformLocalBackup,creating all the necessary device.


Public Sub PerformLocalBackup(ByVal filePathOnDBServer As String, ByVal dbCatalog As String)

'Drop Existing Backup Device

If (DeviceExists()) Then

DropDevice()

End If

'Create Backup Device

CreateNewDevice(filePathOnDBServer)

'Process Backup

BackupDatabase(dbCatalog)

VerifyDeviceFile()

'Drop Backup Device

DropDevice()

End Sub



Public Sub BackupDatabase(ByVal databaseName As String)

Dim myCMD As New SqlCommand

myCMD.Connection = my_SqlConnection

myCMD.CommandType = CommandType.Text

Try

myCMD.Connection.Open()

myCMD.CommandText = "USE MASTER BACKUP DATABASE " & databaseName & " TO myCASDevice WITH INIT"

Console.WriteLine(myCMD.CommandText)

myCMD.ExecuteNonQuery()

Catch ex As Exception

Throw ex

Finally

myCMD.Connection.Close()

End Try

End Sub

Please Help.



Regards
Vanessa
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top