1

I try to backup database using code below :

backup database RestaurantManagement to disk = 'd:\'

sqlserver always show the message below :

Msg 3201, Level 16, State 1, Line 3 Cannot open backup device 'd:\'. Operating system error 3(The system cannot find the path specified.). Msg 3013, Level 16, State 1, Line 3 BACKUP DATABASE is terminating abnormally.

How can i code it ? help...

2 Answers 2

2

You need to provide the backup file name, like this:

backup database RestaurantManagement to disk = 'd:\backups\RestaurantManagement.bak'
Sign up to request clarification or add additional context in comments.

6 Comments

I have executed your code, but it show error message like below : Msg 3201, Level 16, State 1, Line 2 Cannot open backup device 'd:\backups\RestaurantManagement.bak'. Operating system error 3(The system cannot find the path specified.). Msg 3013, Level 16, State 1, Line 2 BACKUP DATABASE is terminating abnormally.
@Makara: Also, does the database server have access to that path? It will probably not be logged in with the same credentials as the user given (a removable drive perhaps). Also the path will be relative to the server, not whatever machine you are on, if that is different.
@ChristBint : the path is definitely exist.
Of course, d:\backups in my answer is just an example; use the path and file name that is appropriate for your setup. Make sure that the user accouont under which the SQL Server services are running has access to that path.
@Makara: SQL Server runs as a service, services operate as a different user usually to the one you log in as, different user accounts have different levels of access to the computer hardware, particularly directories and drives. The backup database command occurs on the server, the file you tell the server to make a backup to must be on that server and be in a path, a directory, that the user the SQL Server service is running as has access to, that is, has permission to write to.
|
0

Are you a member of the appropriate sql role? Does the account which Sql Server is running under have permissions to the path? Are you sure the media is available on the server? What I mean is, you may have a d: on your machine, but the paths you give are for the remote server.

The error you're getting indicates there's no d: drive, or no folder named backups.

I would double check all those things.

4 Comments

I use SA (System Administrator). My sql serve was install in the local machine. The drive has 2 GB free space and can store data... i have try using C:\ and D:\ but the results are the same.
Do you know what account sql is running as? It may not have permission to the d: drive or folder. Also, what OS are you running? Maybe its related to UAC.
I use Window 7. I use administrator account. and what is UAC?
Not what account are you using, what is Sql Server running as. Goto Control Panel -> Admin Tools -> Services to find out. UAC is User Account Control. Its probably enabled (a good thing), but you might have to explicity run SSMS as an Administator.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.