When using SqlBackupAndFtp you may have come across this SQL Server error when saving a database backup: Cannot open backup device ‘<Path\Filename>’. Operating system error 3 (The system cannot find the path specified).
Assuming the full path and file name are correct and actually exist, this error is caused by SQL Server being unable to either access or write to the specified path. This lack of permission can itself have one or more root causes. Let us look at these in more detail.
Possible Reasons for Operating system error 3
This error is most commonly encountered when taking backups that should then be copied over to another computer/ server on the same or a different network. But it can sometimes also occur even on the same computer/ server.
When you get this error, the cause is insufficient file-path access permissions for the operating-system account used by SQL Server. Remember, the login name you have used on Windows is not what is used when running SQL Server jobs. Instead what is used is the account specified for use for the SQL Server service. To check this, open services on the computer where SQL Server is installed (go to Start => Run, type services.msc and hit Enter). Once it opens, look for the service with the name SQL Server and double click it. Navigate to the tab labeled Log On and note down the username listed therein – this is the set of credentials used by SQL Server.
Even though the general cause of this error is the lack of SQL Server access to the backup folder/ path, this may in turn be caused by the following scenarios (with resolutions for each scenario):
- Unknown drive letter. You may have specified your path to back up to as Z:\Mypath\Backups, where Z: is a drive mapped to a UNC network path. Your SQL Server may be unaware of this mapping. To resolve this, it is better to always specify a full UNC path in SQL Server instead of using mapped drives. So for example Z:\Mypath\Backups should be altered to \\Remote_Svr\C\ Mypath\Backups.
- The account you specified for your SQL Server service really doesn’t have write permissions on the specified folder or part of it. Check these permissions on the target folder. Right-click the folder and check in the Security tab that the SQL Server service account has explicit permissions to both read and write to the folder. The account may be part of a group, and permissions have been granted to the group not directly to the account. In this case there is no harm in adding the account directly and explicitly granting it the required permissions.
- Lack of trust between domains. If your SQL Server installation and your remote backup location are on computers in different Active Directory domains, then a lack of trust or expired trust between the domains can also cause this error. This is true even though the SQL Server service account has full permissions on the remote folder it is supposed to write to. To resolve this issue, ensure domain-to-domain trust is properly set up, and also set up the SQL Server service account with pass-through authentication between the 2 domains.
In SQLBackupAndFTP, this “Operating system error 3” error message is broadly caused by SQL Server being unable to write to a remote folder location. But this may itself be caused by more than one underlying fault. Use the above guide to help troubleshoot the exact cause and then resolve it as necessary.