Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 Cannot backup database

Author  Topic 

farizvi
Starting Member

1 Post

Posted - 2009-12-29 : 07:38:40
I'm using SQL Server 2005 Enterprise Edition with Visual Basic .Net 2.0. My code performs backup of a database. The size of my database (mdf file) is very big (approx. 22GB). When I perform backup through my application I get the exception

Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.The backup or restore was aborted.

Does it has something to do with the size of the database or the problem is somewhere else? Below is the code of my app which performs this task

Private _con As SqlConnection
_con = New SqlConnection("Password=" & strPassword & ";Integrated Security=sspi;Trusted_Connection=no;" _
& "User ID=" & strUsername & ";Initial Catalog=master" & "" _
& ";Data Source=" & strDBServerName)

Dim objCommand As New SqlCommand
objCommand.CommandText = "backup database " & strDatabaseName & " to disk='" & strPath & "'"
_con.Open()
objCommand.Connection = _con
objCommand.ExecuteNonQuery()

_con.Close()

I've used Microsoft.SqlServer.Management.Smo namespace here.

Sachin.Nand

2937 Posts

Posted - 2009-12-29 : 08:46:15
Metion the timeout of your command object to 0.
Ex objCommand.CommandTimeout = 0;

PBUH
Go to Top of Page
   

- Advertisement -