1

I want to backup a database from our main server. But this error happens

System.Data.SqlClient.SqlException (0x80131904): Cannot open backup device 'C:\Temp\sample.bak'. Operating system error 3 (The system cannot find the path specified.).
BACKUP DATABASE is terminating abnormally.
at Microsoft.SqlServer.Management.Common.ConnectionManager.ExecuteTSql(ExecuteTSqlAction action, Object execObject, DataSet fillDataSet, Boolean catchException)
at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType)
ClientConnectionId:d9c1c173-e60e-4e07-91d6-2ba43b905ff6

Thank you for your help!

The query I tried is

BACKUP DATABASE H2RPDB_v2 
TO DISK = 'C:\Temp\test2.bak'

in SQL Server. H2RPDB_v2 is from my remote server.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
psyche
  • 75
  • 9
  • If you run a backup on a **remote** server, then the backup file will be created **on that remote server's filesystem** - where maybe `C:\temp` just doesn't exist (as the error pretty clearly says - no?) – marc_s Jul 22 '14 at 04:31

1 Answers1

1

The error indicates that the path doesn't exist. Does C:\Temp exist? If so, does the service account have access to the folder?

Other things might be storage is full, etc.

See related question: SQL server 2008 backup error - Operating system error 5(failed to retrieve text for this error. Reason: 15105)

Community
  • 1
  • 1
  • I can actually backup if I'm using local server. But when I'm using our remote server it doesn't work. I tried the query in the SQL Server and it didn't work. – psyche Jul 22 '14 at 03:46
  • Assuming you have appropriate access, this may do the trick: http://stackoverflow.com/questions/3942207/how-can-i-backup-a-remote-sql-server-database-to-a-local-drive – spotticusprime Jul 22 '14 at 03:58
  • I mean I need to backup a file using coding not generating script. So, I'm trying the query 'Backup Database...' in SQL Server because I need to use it in C# Coding. – psyche Jul 22 '14 at 04:06
  • Could you post your query here, or update your question with your query string? – spotticusprime Jul 22 '14 at 04:09
  • I'd be willing to bet that either C:\Temp doesn't exist, or the service account sql server is running under doesn't have access to that path. Try saving it to a path the service account has access to, or if you have RDP access to the server, see if the path exists and appropriate access exists. – spotticusprime Jul 22 '14 at 04:35