Running a backup script on Sql 2014 to a UNC path fails with error

Running a backup script on Sql 2014 to a UNC path fails with error (operating system error code 3(the system cannot find the path specified). We have tried to give full rights to the folder but nothing seems to be working. The backup job does works fine if we send it to the C:\ drive. Is there anything else we can try?
Thanks

Script i'm running:
--- Automatically do Full Backup of all databases simple Recovery Mode

DECLARE @name VARCHAR(50) -- database name  
DECLARE @path VARCHAR(256) -- path for backup files  
DECLARE @fileName VARCHAR(256) -- filename for backup  
DECLARE @fileDate VARCHAR(20) -- used for file name 

SET @path = '\\server-4\c$\BackupLocation\'  --Case Sensitive

SELECT @fileDate = CONVERT(VARCHAR(20),GETDAT<wbr ></wbr>E(),112) 
   + '_' 
   + REPLACE(CONVERT(VARCHAR(20<wbr ></wbr>),GETDATE(<wbr ></wbr>),108),':'<wbr ></wbr>,'')

DECLARE db_cursor CURSOR FOR  
SELECT name
FROM master.dbo.sysdatabases 
WHERE
    name NOT IN (N'tempdb') AND
    DATABASEPROPERTYEX(name, N'Status') IN ( N'EMERGENCY', N'ONLINE' )

OPEN db_cursor   
FETCH NEXT FROM db_cursor INTO @name 

WHILE @@FETCH_STATUS <> -1   
BEGIN   
       SET @fileName = @path + @name + '_Full_' + @fileDate + '.bak'  
       PRINT 'Backup Database command being issued on database "' + @name + '".' 
       BACKUP database @name TO DISK = @fileName WITH CONTINUE_AFTER_ERROR 
       --IF @@ERROR > 0
       --BEGIN 
           --add code here to record and/or notify yourself that an error occurred during BACKUP
       --END --IF
       FETCH NEXT FROM db_cursor INTO @name   
END  

CLOSE db_cursor   
DEALLOCATE db_cursor 

--REF
--Simple: No log backups. Automatically reclaims log space to keep space requirements small, essentially eliminating the need to manage the transaction log space. 
--Full: Requires log backups. No work is lost due to a lost or damaged data file. Can recover to an arbitrary point in time (for example, prior to application or user error). 

Open in new window

LVL 2
CityInfoSysAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Vitor MontalvãoMSSQL Senior EngineerCommented:
Who's the user that is running the script? It need to have access in the share.
0
CityInfoSysAuthor Commented:
It is the sa account.
0
Vitor MontalvãoMSSQL Senior EngineerCommented:
SA account it's a SQL login and not a Windows login. You can't give permissions on a share to SA, right?
The SQL Server account or SQL Agent account are domain accounts?
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

CityInfoSysAuthor Commented:
Under services they are both the default log on as (NT AUTHORITY\System). But no they are not domain accounts. Could I just change the log on as to a local user?
0
Vitor MontalvãoMSSQL Senior EngineerCommented:
I wrote an article explaining why NT AUTHORITY\System shouldn't be used as service account. Please take a read on it so you can understand it better.
Local users can't access to the network since they exists only on local computers. You may change the SQL Server and Agent accounts to NT AUTHORITY\Network Service. Still not good but better that System.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CityInfoSysAuthor Commented:
If i change the NT AUTHORITY\System on the SQL agent service will it cause any issues (besides affecting backups) while the server is running?
0
CityInfoSysAuthor Commented:
I was wrong the sql server agent log on as is NT Service\SQLSERVERAGENT.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.