Click here to Skip to main content
15,910,981 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

I need to take an Back up of DB from sql server 2008 management studio

I used the below query

BACKUP DATABASE DB1 TO DISK='Localpath\db.bak'

This works fine in local server, but when I execute the same code in server
I am getting error as

Msg 3201, Level 16, State 1, Line 1
Cannot open backup device 'D:\DB.bak'. Operating system error 5(Access is denied.).

Msg 3013, Level 16, State 1, Line 1
BACKUP DATABASE is terminating abnormally.

Kindly let me know how to solve this issue...
Thanks in advance
Posted
Comments
Dylan Morley 8-Mar-11 6:19am    
SQL Server is trying to write to D:\DB.bak and the account running the SQL instance doesn't have permissions to that location

Most likely, it doesn't have rights to the D:\ drive?

Is this a server that you control and can manage? Or is it hosted?
sathya4260 8-Mar-11 6:21am    
i even tried with default path that is C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup but the same error
Dylan Morley 8-Mar-11 6:22am    
Is this a server that you control and can manage? Or is it hosted?
sathya4260 8-Mar-11 6:23am    
hosted

1 solution

Check with your ISP hosting the SQL Server, they should have a way of performing this task and providing you access to the backup file

Obviously, the commands you are running will not work in a hosted environment. Allowing customers to create files in the locations you've mentioned in a shared, hosted environment would be a massive issue and cause all sorts of problems!

Instead, there should be some sort of controlled way or documentation for you to do this that would create the file in a location specific to your user\site\hosted environment.
 
Share this answer
 
Comments
sathya4260 8-Mar-11 6:33am    
I would try

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900