Suddenly unable to backup a new database, os path error 3

%3CLINGO-SUB%20id%3D%22lingo-sub-2195573%22%20slang%3D%22en-US%22%3ESuddenly%20unable%20to%20backup%20a%20new%20database%2C%20os%20path%20error%203%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2195573%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%20I%20have%20two%20MS%20SQL%20Server%202016%20Std%20Service%20Pack%202%20instance%20running%20on%20two%20outsourced%20OS%20machine.%20One%20Windows%20Server%202016%20and%20one%20Windows%20Server%202012%20R2.%20Then%20I%20recently%20added%20a%20new%20database%20and%20modified%20my%20existing%20maintenance%20job%20but%20then%20I%20got%20like%20%22cannot%20find%20the%20path%20specified%2C%20OS%20error%203%20and%20the%20path%20is%20the%20backup%20destination%20path%20and%20file.%26nbsp%3B%3CBR%20%2F%3EWindows%20SQLServerAgent%20service%20is%20run%20by%20SQLSERVERAGENT%20and%20%22NT%20Service%5CSQLSERVERAGENT%22%20has%20full%20or%20modify%20access%20there.%20It%20doesnt%20matter%20if%20I%20create%20a%20new%20maintenance%20job%20it%20still%20the%20same%20problem.%20The%20problem%20also%20exist%20on%20both%20server%2C%20but%20only%20on%20the%20new%20databases%2C%20with%20the%20existing%20databases%20there%20are%20no%20problem.%3C%2FP%3E%3CP%3EUnfortunately%2C%20becuase%20the%20two%20OS%20servers%20are%20outsourced%20I%20dont%20know%20what%20happens%20in%20the%20%22background%22%20but%20I%20have%20an%20account%20with%20administrative%20rights.%3CBR%20%2F%3EI%20cheated%20and%20tried%20to%20put%20both%20%22Nt%20Service%5CMSSQLSERVER%22%20and%20Nt%20Service%5CSQLSERVERAGENT%22%20in%20the%20local%20administrators%20group%20but%20nothing%20helps.%20Any%20id%C3%A9%20whats%20wrong%3F%3C%2FP%3E%3CP%3EI%20also%20have%20a%20service%20request%20with%20the%20outsourced%20firm%20where%20I%20still%20wait%20for%20help.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2199395%22%20slang%3D%22en-US%22%3ERe%3A%20Suddenly%20unable%20to%20backup%20a%20new%20database%2C%20os%20path%20error%203%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2199395%22%20slang%3D%22en-US%22%3EWhen%20I%20look%20at%20the%20history%20log%20and%20choose%20to%20View%20T-SQL%20done%20by%20MS%20SQL%20Mgmt%20Studio%20then%20I%20found%20a%20lot%20of%20errors%20in%20it.%20When%20I%20manually%20fix%20that%20code%20the%20backup%20are%20working%20...%3CBR%20%2F%3EThe%20MS%20SQL%20Mgmt%20Studio%20version%20is%2018.6.%3CBR%20%2F%3EHere%20is%20the%20automatically%20created%20WRONG%2FNot%20working%20code%20(extra%20space%20and%20dots)%3A%3CBR%20%2F%3EEXECUTE%20master.dbo.xp_create_subdir%20N''F%3A%5CDBBackup%5CDW_ARKIV%20''%3CBR%20%2F%3EGO%3CBR%20%2F%3EBACKUP%20DATABASE%20%5BDW_ARKIV%20%5D%20TO%20DISK%20%3D%20N''F%3A%5CDBBackup%5CDW_ARKIV%20%5CDW_ARKIV%20_backup_2021_03_10_134006_2704819.bak''%20WITH%20NOFORMAT%2C%20NOINIT%2C%20NAME%20%3D%20N''DW_ARKIV%20_backup_2021_03_10_134006_2704819''%2C%20SKIP%2C%20REWIND%2C%20NOUNLOAD%2C%20STATS%20%3D%2010%3CBR%20%2F%3EGO%3CBR%20%2F%3Edeclare%20%40backupSetId%20as%20int%3CBR%20%2F%3Eselect%20%40backupSetId%20%3D%20position%20from%20msdb..backupset%20where%20database_name%3DN''DW_ARKIV%20''%20and%20backup_set_id%3D(select%20max(backup_set_id)%20from%20msdb..backupset%20where%20database_name%3DN''DW_ARKIV%20''%20)%3CBR%20%2F%3Eif%20%40backupSetId%20is%20null%20begin%20raiserror(N''Verify%20failed.%20Backup%20information%20for%20database%20''''DW_ARKIV%20''''%20not%20found.''%2C%2016%2C%201)%20end%3CBR%20%2F%3ERESTORE%20VERIFYONLY%20FROM%20DISK%20%3D%20N''F%3A%5CDBBackup%5CDW_ARKIV%20%5CDW_ARKIV%20_backup_2021_03_10_134006_2704819.bak''%20WITH%20FILE%20%3D%20%40backupSetId%2C%20NOUNLOAD%2C%20NOREWIND%3CBR%20%2F%3E%3CBR%20%2F%3EGO%3CBR%20%2F%3E%3CBR%20%2F%3E_____________%3CBR%20%2F%3Eand%20here%20are%20the%20simple%20code%20I%20test%2Fcorrected%20to%20and%20that%20works%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EEXECUTE%20master.dbo.xp_create_subdir%20N'F%3A%5CDBBackup%5CDW_ARKIV'%3CBR%20%2F%3EGO%3CBR%20%2F%3EBACKUP%20DATABASE%20%5BDW_ARKIV%20%5D%20TO%20DISK%20%3D%20N'F%3A%5CDBBackup%5CDW_ARKIV%5CDW_ARKIV_backup_2021_03_10_134006_2704819.bak'%20WITH%20NOFORMAT%2C%20INIT%2C%20NAME%20%3D%20N'DW_ARKIV_backup_2021_03_10_134006_2704819'%2C%20SKIP%2C%20REWIND%2C%20NOUNLOAD%2C%20STATS%20%3D%2010%3CBR%20%2F%3EGO%3CBR%20%2F%3E%3CBR%20%2F%3EIs%20it%20a%20bug%20in%20the%20Studio%3F%20I%20know%20there%20are%20newer%20ones%20and%20I%20have%20to%20try%20them%20out.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2199573%22%20slang%3D%22en-US%22%3ERe%3A%20Suddenly%20unable%20to%20backup%20a%20new%20database%2C%20os%20path%20error%203%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2199573%22%20slang%3D%22en-US%22%3E18.8%2C%20the%20latest%20MS%20SQL%20Mgmt%20Studio%20did%20not%20work%20either.%20It%20was%20the%2018.6%20which%20create%20the%20database-name%20with%20an%20extra%20space%20on%20the%20end.%20Now%20you%20think%20I'm%20crazy%20and%20did%20it%20my%20self%20...%20oh%20yes%20but%20then%20that%20I%20should%20do%20this%20exact%20same%20misstake%20on%20two%20different%20instances%20which%20I%20do%20not%20believe.%3CBR%20%2F%3EI%20have%20been%20working%20with%20MS%20SQL%20Mgmt%20Studio%20for%20over%2020%20years%20and%20never%20had%20this%20kind%20of%20bug%2C%20which%20I%20beleive%20it%20must%20be.%3CBR%20%2F%3ECase%20closed.%3C%2FLINGO-BODY%3E
New Contributor

Hi, I have two MS SQL Server 2016 Std Service Pack 2 instance running on two outsourced OS machine. One Windows Server 2016 and one Windows Server 2012 R2. Then I recently added a new database and modified my existing maintenance job but then I got like "cannot find the path specified, OS error 3 and the path is the backup destination path and file. 
Windows SQLServerAgent service is run by SQLSERVERAGENT and "NT Service\SQLSERVERAGENT" has full or modify access there. It doesnt matter if I create a new maintenance job it still the same problem. The problem also exist on both server, but only on the new databases, with the existing databases there are no problem.

Unfortunately, becuase the two OS servers are outsourced I dont know what happens in the "background" but I have an account with administrative rights.
I cheated and tried to put both "Nt Service\MSSQLSERVER" and Nt Service\SQLSERVERAGENT" in the local administrators group but nothing helps. Any idé whats wrong?

I also have a service request with the outsourced firm where I still wait for help.

3 Replies
When I look at the history log and choose to View T-SQL done by MS SQL Mgmt Studio then I found a lot of errors in it. When I manually fix that code the backup are working ...
The MS SQL Mgmt Studio version is 18.6.
Here is the automatically created WRONG/Not working code (extra space and dots):
EXECUTE master.dbo.xp_create_subdir N''F:\DBBackup\DW_ARKIV ''
GO
BACKUP DATABASE [DW_ARKIV ] TO DISK = N''F:\DBBackup\DW_ARKIV \DW_ARKIV _backup_2021_03_10_134006_2704819.bak'' WITH NOFORMAT, NOINIT, NAME = N''DW_ARKIV _backup_2021_03_10_134006_2704819'', SKIP, REWIND, NOUNLOAD, STATS = 10
GO
declare @backupSetId as int
select @backupSetId = position from msdb..backupset where database_name=N''DW_ARKIV '' and backup_set_id=(select max(backup_set_id) from msdb..backupset where database_name=N''DW_ARKIV '' )
if @backupSetId is null begin raiserror(N''Verify failed. Backup information for database ''''DW_ARKIV '''' not found.'', 16, 1) end
RESTORE VERIFYONLY FROM DISK = N''F:\DBBackup\DW_ARKIV \DW_ARKIV _backup_2021_03_10_134006_2704819.bak'' WITH FILE = @backupSetId, NOUNLOAD, NOREWIND

GO

_____________
and here are the simple code I test/corrected to and that works


EXECUTE master.dbo.xp_create_subdir N'F:\DBBackup\DW_ARKIV'
GO
BACKUP DATABASE [DW_ARKIV ] TO DISK = N'F:\DBBackup\DW_ARKIV\DW_ARKIV_backup_2021_03_10_134006_2704819.bak' WITH NOFORMAT, INIT, NAME = N'DW_ARKIV_backup_2021_03_10_134006_2704819', SKIP, REWIND, NOUNLOAD, STATS = 10
GO

Is it a bug in the Studio? I know there are newer ones and I have to try them out.
18.8, the latest MS SQL Mgmt Studio did not work either. It was the 18.6 which create the database-name with an extra space on the end. Now you think I'm crazy and did it my self ... oh yes but then that I should do this exact same misstake on two different instances which I do not believe.
I have been working with MS SQL Mgmt Studio for over 20 years and never had this kind of bug, which I beleive it must be.
Case closed.