Operating system error 53(error not found).

Category: sql server smodmo


Sabhari OK on Mon, 19 Apr 2010 05:50:33


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();


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.Incremental = false;

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

sqlBackup.FormatMedia = false;


statusstr = "success";
catch (Exception ex)
statusstr = "failed";
throw ex;
sqlBackup = null;
return statusstr;

Thanks in advance.

Please help me regarding this.


cmille19 on Mon, 19 Apr 2010 11:55:25

It could be permission issue writing the file to UNC path. I would suggest two things:

  • Test using plain T-SQL, backing up to the same file path
  • Re-write your error handling code to provide more detailed error information. SMO uses nested error which can make troubleshooting issues difficult unless you code error handling accordingly. See http://msdn.microsoft.com/en-us/library/ms162127.aspx
If its a permission issue or anything else either of these two methods will provide more information on why its failing.

ShawnNWF on Mon, 19 Apr 2010 13:30:57

Operating system error 53 is:

The network path was not found.


Check to make sure the user running this has permission to that network share or that it actually exsists.

Gulf Coast SQL

[Ayyappan] on Mon, 13 Sep 2010 07:31:26

Hi All,

Following to the above discussion. I am posting the additional error information to the existing solution.

I got an error while backup my database using SSMS.

Backup failed for Server 'MyServerName'.  (Microsoft.SqlServer.SmoExtended)

Additional information

System.Data.SqlClient.SqlError: Cannot open backup device '\\IP\drive letter $\backupfilename.bak'. Operating system error 53(failed to retrieve text for this error. Reason: 15105). (Microsoft.SqlServer.Smo)