Skip to main content

MS SQL ODBC Backup Fails: Device Name Length Exceeds Limit

April 16, 2025

Product Version

AhsayOBM: 7 and above

Operating System

Windows

Symptom

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

No.TypeTimestampLog
*.........
*info...[Start] Backing up "SQL_hostname\...\long_db_name" ... to "temp_path\long_db_name"
*warnYYYY/MM/DD hh:mm:ss[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid device name. The length of the device name provided exceeds supported limit (maximum length is:259). Reissue the BACKUP statement with a valid device name.
*.........

Cause

This is a warning message returned by the SQL server, suggesting that length of the directory path to the backup device (e.g. temporary folder path plus the database name) exceeded 259 characters.

The maximum number of characters is a limit imposed by the SQL server and not AhsayOBM.

Resolution

To resolve the issue:

  • Option 1 - Modify the temporary directory for storing backup files to a shorter directory path:

    Temporary Directory settings in MSSQL Backupset

    OR

  • Option 2 - Rename the database to a shorter name if possible. (Instructions)

    OR

  • Option 3 - Create a new MS SQL Server backup set in VSS backup mode:

    Create MSSQL Backupset in VSS Mode