Troubleshooting Guide: SQL Server Error 2505 – “The device ‘%.*ls’ does not exist”
Why This Error Happens
This error occurs when a backup or restore operation references a logical or physical backup device name that SQL Server cannot locate in its system catalog. It typically happens because the backup device was never registered via sp_addumpdevice, was deleted, or the physical file path referenced by the device has been moved, renamed, or deleted from disk. It can also occur if a script references a device name with a typo or from a different server instance where the device metadata doesn’t exist locally.
Step-by-Step Resolution Guide
Step 1: Verify Existing Backup Devices
- Open SQL Server Management Studio (SSMS) or a query window connected to the affected instance.
- Run the following query to list all registered devices:
SELECT name, physical_name, type FROM sys.backup_devices;
- Confirm whether the device name referenced in your script or job actually exists in this result set.
Step 2: Check the Physical File Path on Disk
- Navigate to the default backup directory, typically located at:
C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Backup\ - Confirm the
.bakor.trnfile referenced by the device still exists and has not been renamed or moved. - If the file is missing, check Windows Server 2025 backup/archive logs or any storage migration history for the file.
Step 3: Re-register the Backup Device (If Missing)
- If the device was deleted or never created, re-add it using
sp_addumpdevice:
EXEC sp_addumpdevice 'disk', 'MyBackupDevice',
'C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Backup\MyBackup.bak';
- Ensure the SQL Server service account has read/write permissions on the target folder (right-click folder > Properties > Security > confirm
NT SERVICE\MSSQLSERVERhas Modify rights).
Step 4: Correct the Script or Job Reference
- If using a SQL Agent Job or maintenance plan, open the job step and verify the exact device name spelling matches
sys.backup_devices. - Update any hardcoded device names in Transact-SQL scripts to match the verified name from Step 1.
Alternative or Verification Steps
- Re-run the backup/restore command using the corrected device name or direct file path (e.g.,
BACKUP DATABASE ... TO DISK = 'C:\Backup\MyBackup.bak') instead of a logical device name to bypass the lookup entirely. - To verify the fix, execute
RESTORE VERIFYONLY FROM MyBackupDevice;and confirm it completes without raising Error 2505.