i want to schedule a daily backup with SQL Server Express by using window schedule. I am able to backup my database to D drive.But when i try to backup my database to c drive. The ms sql return me this error
Msg 3201, Level 16, State 1, Line 3
Cannot open backup device 'C:\inetpub\Project backup Live\LewreDB backup\Wednesday\20120502.bak'. Operating system error 5(failed to retrieve text for this error. Reason: 15105).
Msg 3013, Level 16, State 1, Line 3
BACKUP DATABASE is terminating abnormally.
Here is my query
DECLARE @pathName NVARCHAR(512)
SET @pathName = 'C:\inetpub\Project backup Live\LewreDB backup\' + DATENAME(DW,GETDATE())+'\'+ Convert(varchar(8), GETDATE(), 112) + '.bak'
BACKUP DATABASE [LEWREDB] TO DISK = @pathName WITH NOFORMAT, NOINIT, NAME = N'db_backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10
Did any one face this problem before
Are you trying to backup a SQL Server Express database on a remote server to your local C: drive?
I got a similar error when I thought I could execute SQL on a remote database to backup to a location on my C:\ drive.
In any case I can recommend a workaround where you run the backup in a batch file fired by a windows scheduled task and include a line in the batch file to copy the backup from the D: drive location on the SQL Express Server to your C: drive location wherever that may be.