Makara
Makara

Reputation: 233

Why can't i backup database using t-sql?

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...

Upvotes: 1

Views: 2043

Answers (2)

Andy
Andy

Reputation: 8562

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.

Upvotes: 0

CesarGon
CesarGon

Reputation: 15335

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

backup database RestaurantManagement to disk = 'd:\backups\RestaurantManagement.bak'

Upvotes: 2

Related Questions