2

I am struggling with a backup job created under Maintenance Plans for one installation.

A "Back Up Database Task" is set for specific databases, option "Disk" is selected, as well as "Create a backup file for every database", and "Create a sub-directory for each database". Folder is set as a browseable UNC path:

\\\backupserver\SQLBack\servername

View T-SQL shows the same correct backup location:

BACKUP DATABASE [DBName] 
TO DISK = N' \\\backupserver\SQLBack\servername\DBName\DBName_backup_2018_04_27_141724_2876433.bak' 
WITH NOFORMAT, NOINIT, 
     NAME = N'DBName_backup_2018_04_26_141724_2856433', 
     SKIP, REWIND, NOUNLOAD, NO_COMPRESSION,  STATS = 10

Everything looks great, but the actual path is failing with the actual path being different from what it should be:

Executing the query "BACKUP DATABASE [DBName] TO DISK = N' \\..." failed with the following error: "Cannot open backup device 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\ \\backupserver\SQLBack\servername\\DBName\DBName_backup_2018_04_26_124542_5356659.bak'.

I can't figure out why is it appending C:\\Program Files\\Microsoft SQL Server\\MSSQL.1\\MSSQL\\Backup\\ to the entered backup location, any help is appreciated.

Both locations are available to the SQL Server.

5
  • 1
    Check the extra space in TO DISK = N' \\backupserver`. Right after the N' `. My guess is that the backup task is seeing that extra space and switching it to your default SQL install location. Commented Apr 27, 2018 at 21:29
  • I'll be damned. Thank you, with that space removed it is backing up successfully! Commented Apr 27, 2018 at 21:36
  • OK, just confirmed. The extra space will cause the backup process to prepend your default SQL backup location. Commented Apr 27, 2018 at 21:37
  • I never knew it would do that either. Learned something new today. :-) Commented Apr 27, 2018 at 21:38
  • Take a look at this. This might also help: community.spiceworks.com/topic/107157-problem-with-sql-backups Commented Apr 28, 2018 at 6:02

1 Answer 1

1

There is an extra space in TO DISK = N' \\...", after the N'. This will cause the default SQL backup location to be prepended to the TO DISK setting. Removing that extra space will allow it to backup normally.

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you again! I was fooled by View T-SQL script.
@user2101153 Can you accept the response as the answer please?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.