Hello,
I tried to follow these instructions (see below) in order to backup SQL Express 2017 automatically in three steps (A - stored procedure, B - bat file, C - scheduled task) using T-SQL.
Link
The first step (Step A) went OK.
The next step, B, is failing if run as .bat (sqlcmd -U SQLLogin -P password -S .\SQLEXPRESS -Q "EXEC sp_BackupDatabases @backupLocation ='D:\SQLBackups', @BackupType='F'").
It works if run as a query directly from SSMS v18.2 "EXEC sp_BackupDatabases @backupLocation ='D:\SQLBackups', @BackupType='D'" on the server.
If run from a workstation it fails in both, .bat and SSMS v18.4, giving an error in SSMS - Cannot open backup device 'D:\xxx.BAK'. Operating system error 5(Access is denied.).
The best option would be to run it as .bat from a workstation; can you please advise what needs to be done to do it?
Thx
I tried to follow these instructions (see below) in order to backup SQL Express 2017 automatically in three steps (A - stored procedure, B - bat file, C - scheduled task) using T-SQL.
Link
The first step (Step A) went OK.
The next step, B, is failing if run as .bat (sqlcmd -U SQLLogin -P password -S .\SQLEXPRESS -Q "EXEC sp_BackupDatabases @backupLocation ='D:\SQLBackups', @BackupType='F'").
It works if run as a query directly from SSMS v18.2 "EXEC sp_BackupDatabases @backupLocation ='D:\SQLBackups', @BackupType='D'" on the server.
If run from a workstation it fails in both, .bat and SSMS v18.4, giving an error in SSMS - Cannot open backup device 'D:\xxx.BAK'. Operating system error 5(Access is denied.).
The best option would be to run it as .bat from a workstation; can you please advise what needs to be done to do it?
Thx