Skip to main content

Article ID

2027

Product Version

AhsayOBM: 9.1 and above

Operating System

Windows

Symptom

When performing an MS SQL database backup (ODBC backup mode), the following warning message is received in the backup report:

No. Type Timestamp Log
info
* info .... [Start] Back up "SQL_hostname\MSDB\
db_name"...
warn
* warn YYYY/MM/DD hh:mm:ss [Microsoft][ODBC SQL
Server Driver]{SQL Server] Cannot
open backup device 'temp_path\backupset_id\...
\db_name\
db_name.bak.YYYY-MM-DD-hh-mm-ss.ADD'.
Operating system error 5
(Access is denied).

Cause

The message suggests that there was a permission issue when attempting to access the temporary directory for storing backup files.

Resolution

To resolve the issue, ensure that the folder configured for the Temporary directory for storing backup files setting can be accessed by the SQL Server (MSDB) service:

Temporary Directory

On the other hand, if the temporary directory is set to a network share, for SQL Server to access a remote disk, the SQL Server service account must have access to the network share. The availability of network drives and permissions depends on the context in which SQL Server service is running:

  • To back up to a network drive when SQL Server is running in a domain user account, the shared drive must be mapped as a network drive in the session where SQL Server is running. If you start Sqlservr.exe from the command line, SQL Server sees any network drives you have mapped in your login session.
  • When you run Sqlservr.exe as a service, SQL Server runs in a separate session that has no relation to your login session. The session in which a service runs can have its own mapped drives, although it usually does not.
  • You can connect with the network service account by using the computer account instead of a domain user. To enable backups from specific computers to a shared drive, grant access to the computer accounts. As long as the Sqlservr.exe process that is writing the backup has access, it is irrelevant whether the user sending the BACKUP command has access.

Reference:https://docs.microsoft.com/en-us/sql/relational-databases/backup-restore/backup-devices-sql-server#NetworkShare

Temporary Directory

Alternatively, you can also re-create a new MS SQL Server backup set in VSS backup mode (supported since AhsayOBM version 7.11.0.0), which will not output the database file to the temporary directory: PICTURE

There are some limitations to the VSS backup mode, refer to the Limitation and Backup Mode sections of the AhsayOBM Microsoft SQL Server Backup and Restore Guide for details.