2

So, MSSQL is nice enough to have given us a nifty little sql code for creating a database backup from a command line:

BACKUP DATABASE [db_name] TO  DISK = N'D:\backups\back.bak' WITH NOFORMAT, NOINIT,  NAME = N'db_name', SKIP, NOREWIND, NOUNLOAD,  STATS = 10
GO

However, I am looking to be able to run this command from a php or even shell script on a remote Mac server.

The Problem I am running into is when I try to change the DISK to say my admin home directory, it keeps complaining to me about:

Cannot open backup device 'D:\PATH\ON\SERVER\/Users/admin/back.bak'. Operating system error 3(The system cannot find the path specified.).

Anyone know what I am missing here? I would be very appreciative

2 Answers 2

2

SQL Server's BACKUP command does a backup to the database server's local disk. That means that setting the path to a directory on the client machine makes no sense.

If you want a database backup stored on your client machine, I can basically see 3 options;

  • Back up to a temporary location accessible from the database server, and copy it from there to your client.
  • Mount a disk shared from your client machine on your database server as for example X:\ and do the backup to that disk.
  • Find another backup solution that does backups in a different way (sorry, no, I have no recommendations)
Sign up to request clarification or add additional context in comments.

1 Comment

Aw Man... All my hopes and dreams crushed... Thats okay. I found a way around this per your suggestion thank you
-1

You can use RasorSQL, it's a client for mac and windows. https://razorsql.com/

1 Comment

this doesnt do .bak files on mac for microsoft sql server

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.