Fix it now
SQL Server could not open the file or device you named. The useful part of the message is the operating system error in brackets, and the state number in front of it. Almost every 3201 comes down to one thing: the file is opened by the SQL Server service account, not by you, so your own rights and your own mapped drives are irrelevant.
SELECT servicename, service_account, status_desc FROM sys.dm_server_services;
EXEC sys.sp_readerrorlog 0, 1, N'BACKUP';
- Read the operating system error number in brackets. 2, 3 and 6 mean the device is unavailable or the path is wrong. 5 and 1117 mean permissions. 21, 23 and 27 mean damaged or unreadable media.
- Use a UNC path rather than a drive letter for anything not physically in the server. Mapped drives belong to an interactive logon session and the service has its own.
- Grant the account from that query Modify at the NTFS level, and Change at the share level if the target is a share:
icacls D:\SQLBackup /grant "DOMAIN\sqlservice":(OI)(CI)M - If the service runs under a virtual account such as
NT SERVICE\MSSQLSERVER, it reaches the network as the computer account, so grantDOMAIN\SERVERNAME$on the share instead. - Confirm the folder exists on the server. SQL Server will not create directories for you.
Running Management Studio as administrator changes nothing at all. The statement executes inside the engine and the file is created by sqlservr.exe under the service account.
If the backup completes you are done. If not, the next section explains whose permissions are actually in play and what the state numbers tell you.
Why it happens
When you run BACKUP DATABASE, nothing happens on your workstation. The statement is executed inside the engine and the file is created by the sqlservr.exe process under the service account. Management Studio only sends the text of the command. Microsoft’s backup devices documentation puts it about as plainly as it can be put: as long as the sqlservr.exe process writing the backup has access, it is irrelevant whether the user sending the BACKUP command has access.
The same logic explains the drive letter trap. Microsoft documents that when sqlservr.exe runs as a service it runs in a separate session with no relation to your logon session, and that session can have its own mapped drives although it usually does not. So a local path such as C:\Backups in a backup dialog means the server’s C drive, not yours, and a mapped letter means nothing at all. UNC paths are interpreted the same way by both, which is why they are the safe default for anything remote.
3201 carries two pieces of information most people skip. The state number tells you what the engine was trying to do: states 1 and 3 were creating a backup file, state 2 was opening one, state 5 was opening tape, states 6 and 7 were the virtual device interface, and state 8 was taking ownership of a tape device. The bracketed operating system error tells you why it failed. Together they usually settle the question before you have looked at a single permission.
The service account has no rights to the target
You have this one if Operating system error 5, and you can write to the same folder yourself without difficulty.
- Identify the account with the
sys.dm_server_servicesquery above. - Grant it Modify on the folder. From an elevated prompt on the file server:
icacls D:\SQLBackup /grant "DOMAIN\sqlservice":(OI)(CI)M - For a share, grant Change at the share level too. Share and NTFS permissions are evaluated together and the more restrictive one wins.
- Retry the backup to the same path.
Grant to the specific service or computer account, not to Everyone. Where several instances write to one share, give each account its own subfolder.
The path is a mapped drive or a workstation path
You have this one if The path contains a drive letter that exists on your machine, or exists on the server only inside your own session.
- Replace the letter with a fully qualified UNC name:
BACKUP DATABASE [MyDb] TO DISK = N'\\fileserver\sqlbackup\MyDb.bak' WITH INIT, CHECKSUM; - If you must use a letter, confirm the volume is presented to the server itself and is online.
- For a virtual or built-in service account, grant the computer account access on the share:
DOMAIN\SERVERNAME$.
Do not try to create the mapping inside a startup script for the service account. Microsoft’s documented route to a network target is a UNC path the service account can reach.
The folder does not exist on the server
You have this one if Operating system error 2 or 3, and the parent folder is missing or spelled differently.
- Log on to the server, or use an administrative share, and confirm the exact path exists.
- Create the folder and set permissions for the service account before retrying.
- Watch for a trailing space, a transposed letter, or a date-stamped folder that a job was supposed to create and did not.
A scheduled job fails while the same statement works by hand
You have this one if You can back up from a query window, but the SQL Server Agent job step reports 3201.
- Check which account Agent runs under in the same
sys.dm_server_servicesoutput. It is often not the engine account. - If the job step uses a proxy or a Run as account, grant that identity the same folder rights.
- Grant rights to both the engine and the Agent account where a step calls out to the file system directly.
- Re-run the job and read the step history for the new message.
Something else is holding the file, or the media is failing
You have this one if A sharing violation, or operating system errors 21, 23 or 27 pointing at the device rather than at permissions.
- Exclude backup folders and the .bak and .trn extensions from real-time antivirus scanning on the server.
- Check whether a file-level backup agent is holding yesterday’s file open while it copies it away.
- For errors 21, 23 and 27, treat the device as suspect: Microsoft groups these as damaged or corrupt data and the remedy is repair or replacement, not a permission change.
- Write to a new file name per run, or use
WITH INITto overwrite deliberately rather than appending.
Full reference
Reading the operating system error, Microsoft’s groupings
| OS error | Group | What to do |
|---|---|---|
| 2, 3, 6 | Device unavailable or invalid | Verify the path exists on the server and is online. Check it in Explorer from the server itself |
| 5, 1117 | Insufficient permissions | Grant the service account access. For a cloud target, check the SAS token or managed identity |
| 21, 23, 27 | Damaged or corrupt media | Have the device checked with read and write tests, and repair or replace it |
| 32 | The file is in use | Find the process holding it: antivirus and file-level backup agents are the usual pair |
The state number, and what the engine was doing
| State | The operation that failed |
|---|---|
| 1 and 3 | Creating the backup file |
| 2 | Opening an existing backup file |
| 5 | Opening a tape device |
| 6 | Opening a virtual device |
| 7 | Initialising a virtual device |
| 8 | Opening and taking ownership of a tape device |
A state 6 or 7 with no tape and no third-party product in sight is worth pausing on: something is presenting itself through the virtual device interface, which usually means a backup product’s agent is involved even if nobody mentioned it.
Which identity you actually need to grant
| How the service runs | What to grant on a local folder | What to grant on a share |
|---|---|---|
| A domain user account | That account, Modify | That account, Change plus NTFS Modify |
A virtual account, NT SERVICE\MSSQLSERVER |
That account, Modify | The computer account, DOMAIN\SERVERNAME$ |
A virtual account on a named instance, NT SERVICE\MSSQL$INSTANCE |
That account, Modify | The computer account |
| A managed service account | That account, Modify | That account |
Microsoft’s own recommendation for network shares is the computer account rather than a domain user, precisely because it survives service account changes and does not need a password to be managed.
Cloud and object storage targets
- SQL Server supports BACKUP TO URL against Azure Blob Storage, and against S3-compatible object storage from SQL Server 2022 onwards. A general-purpose file sync folder is not a supported backup target.
- The failure looks identical: a 3201 naming the URL, with an operating system error. Microsoft’s troubleshooting page documents operating system error 50, the request is not supported, and lists the causes: a storage account that is not General Purpose v1 or v2, a SAS token beginning with a question mark, an expired policy behind the token, or a missing root certificate in the trusted store.
- For a cloud target, the equivalent of a permission grant is a valid SAS token or managed identity on the credential.
- Check outbound connectivity on 443 as well as 1433 from the database server.
The companion codes and what each adds
| Code | What it adds |
|---|---|
| 3013 | The command is terminating abnormally. It follows whichever error came first and carries no diagnosis of its own |
| 3634 | The operating system returned an error while attempting an operation on a file. The raw OS failure, relayed |
| 3041 | BACKUP failed to complete the command. This is the summary line written to the error log whenever a backup fails |
| 15105 | Not a backup error at all as a SQL Server message number. See the note below |
15105 needs care. As a SQL Server message number it means something entirely unrelated to backups: cannot bind a default to a column created with or altered to have a default value. The 15105 people see in a failed backup is an operating system error number printed inside a 3201 or 3634, and no Microsoft page publishes a meaning for that number. Treat it as an unexplained failure from the storage layer and diagnose it by the state number and the target, not by the number itself.
Every code this article covers
| Code | What it points at | Source |
|---|---|---|
3201 |
Cannot open backup device. The message carries the operating system error, and the state number says whether the engine was creating a file, opening one, or talking to tape or a virtual device | Microsoft Learn |
3013 |
The command is terminating abnormally. It follows the real error rather than explaining anything itself | Microsoft Learn |
3634 |
The operating system returned an error while attempting a named operation on a named file | Microsoft Learn |
15105 |
As a SQL Server message this means a default cannot be bound to a column that already has one, and has nothing to do with backups. The 15105 seen in a failed backup is an operating system error number inside a 3201 or 3634, for which no vendor page publishes a meaning | Microsoft Learn, for the SQL Server message only |
3041 |
BACKUP failed to complete the command. The summary line written to the error log when a backup fails | Microsoft Learn |
Confirm the fix worked
- Run the backup again and confirm it completes and reports the pages processed.
- Confirm the file exists on the server at the exact path you specified, with a plausible size.
- Check the history:
SELECT TOP 5 database_name, backup_finish_date, backup_size FROM msdb.dbo.backupset ORDER BY backup_finish_date DESC; - Run
RESTORE VERIFYONLY FROM DISK = N'<your path>';and confirm the set is readable. - Run the scheduled job as well as the ad-hoc statement, because Agent may use a different identity.
Questions people ask about this
Do I need to buy anything to fix this?
No. Native backup is part of every edition of SQL Server, including the free ones, and 3201 is a permissions or path problem on hardware you already own. Fixing it costs one permission change.
Why does running Management Studio as administrator not help?
Because the file is not opened by Management Studio. The statement runs inside the engine and sqlservr.exe creates the file under the service account. Microsoft’s documentation says outright that whether the user sending the BACKUP command has access is irrelevant.
Is it safe to give the service account rights to a share?
Yes, and it is the intended design. Grant to the specific service or computer account rather than opening the share to everyone, and keep backups on a server that is not the database server.
Why does the error mention a path I did not type?
If you did not name a device, the instance used its configured default backup directory. Check the backup path in the instance properties and confirm that folder still exists on the server.
Can I back up straight to a NAS or to cloud storage?
To a NAS, yes, through a UNC path the service account can reach. For cloud, SQL Server supports BACKUP TO URL against Azure Blob Storage, and against S3-compatible object storage from SQL Server 2022 onwards. A general-purpose sync folder is not a supported target.
