Share via


Operating system error 53(error not found).

Question

Monday, April 19, 2010 5:52 AM

Hi,

I am sabhari. I am trying to take DB backup and restore in web server using Backup Class (Microsoft.Sqlserver.SMO) namespace. Its working fine in local machine, but it not working in web server.

I am getting following error in live

Cannot open backup device '\n5200-2\iis7_www\c\o\web site name\www\Folder1\DBBackup\DB_PRA_19042010.bak'. Operating system error 53(error not found).
BACKUP DATABASE is terminating abnormally.

Please find the code for DB Backup

//code for taking backup.

public string BackupDatabase(String databaseName, String userName, String password, String serverName, String destinationPath)
{
Backup sqlBackup = new Backup();

try
{

sqlBackup.Action = BackupActionType.Database;
sqlBackup.BackupSetDescription = "ArchiveDataBase:" + DateTime.Now.ToShortDateString();
sqlBackup.BackupSetName = "Archive";

sqlBackup.Database = databaseName;

BackupDeviceItem deviceItem = new BackupDeviceItem(destinationPath, DeviceType.File);
ServerConnection connection = new ServerConnection(serverName, userName, password);
Server sqlServer = new Server(connection);

Database db = sqlServer.Databases[databaseName];

sqlBackup.Initialize = true;
sqlBackup.Checksum = true;
sqlBackup.ContinueAfterError = true;

sqlBackup.Devices.Add(deviceItem);
sqlBackup.Incremental = false;

sqlBackup.ExpirationDate = DateTime.Now.AddDays(3);
sqlBackup.LogTruncation = BackupTruncateLogType.Truncate;

sqlBackup.FormatMedia = false;

sqlBackup.SqlBackup(sqlServer);

statusstr = "success";
}
catch (Exception ex)
{
sqlBackup.Abort();
statusstr = "failed";
throw ex;
}
finally
{
sqlBackup = null;
}
return statusstr;
}

Thanks in advance.

Please help me regarding this.

All replies (4)

Monday, April 19, 2010 6:14 AM ✅Answered | 1 vote

Sabhari,

Operating system error 53 means 'the network path was not found' so looks like your path specified to backup device is wrong. Make sure that you provide full UNC and Verify that the account specified has write access on the Windows NT share to which you are backing up

Thanks,Suhas V


Monday, April 19, 2010 8:26 AM ✅Answered

Make sure the SQL service account has write privilege on the network share folders .Thanks, Leks


Monday, April 19, 2010 11:50 AM

hi Suhas V,

 

Please check my code and can you suggest some idea on this..?

 

string path = Server.MapPath("~/Consultant/DBBackup/" + filename);

                // backup the DB
                if (backupdb.BackupDatabase(DbName, DBusername, DBpwd, DBDataSource, path) == "success")
                {

                    //after stored in specified location, access the particular file and show download aoption to download the file
                    Response.ContentType = "application/x-msdownload";
                    Response.AddHeader("Content-Disposition", "attachmnt;filename=" + filename);
                    Response.TransmitFile(Server.MapPath("~/Consultant/DBBackup/" + filename));
                    Response.End();
                }

 

What is full UNC and where to i check this?

 

 

Thanks in advance.

 

 

 


Monday, April 19, 2010 12:05 PM | 1 vote

Sabhari,

UNC is called as Universal naming convention . What lekss and me suggested was to check weather the service account has write privilege to the network shared folder ? i.e \servername\shared_resourse_pathname .. and please make sure that u are providing the network path that exists ..

Thanks,Suhas V