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.
TO DISK = N' \\backupserver`. Right after theN' `. My guess is that the backup task is seeing that extra space and switching it to your default SQL install location.