cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Musicians, convert your MuseScore files to PDF to play music on the go! Learn more here.

View, download, and export

Need support with viewing, downloading, and exporting files and folders from your Dropbox account? Find help from the Dropbox Community.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Backup a SQL Server database and transfer it to Dropbox.

Backup a SQL Server database and transfer it to Dropbox.

Michel1955
Explorer | Level 3
Go to solution

Hi,

I want to backup a SQL Server database using a bat file.

This is the contents of the bat file when I backup it on my laptop :

cls
set SERVERNAME=DESKTOP-6PULTF9\SQLEXPRESS05
set DATABASENAME=AssetManagement
set DATABASESHOP=HuntsmanShop
set datestr=%date:~6,4%%date:~3,2%%date:~0,2%
set timestr=%Time:~0,2%%Time:~3,2%%Time:~6,2%
set FileName=%DATABASESHOP%_%DATABASENAME%_%datestr%%timestr%.bak
set BAK_PATH=C:\Data\Test\
set DEST_FILE=%BAK_PATH%%FileName%
:: --------------------------------------------------
:: BACKUP Database
:: NOTE: If error "access is denied" appear - go to service properties - log on.
sqlcmd -E -S %SERVERNAME% -d master -Q "BACKUP DATABASE [%DATABASENAME%] TO DISK = N'%DEST_FILE%' WITH INIT , NOUNLOAD , NAME = N'%DATABASENAME% backup', NOSKIP , STATS = 10, NOFORMAT"

and this works perfectly.

Now when I want to make a backup to a Dropbox folder it doesn't work :

cls
set SERVERNAME=DESKTOP-6PULTF9\SQLEXPRESS05
set DATABASENAME=AssetManagement
set DATABASESHOP=HuntsmanShop
set datestr=%date:~6,4%%date:~3,2%%date:~0,2%
set timestr=%Time:~0,2%%Time:~3,2%%Time:~6,2%
set FileName=%DATABASESHOP%_%DATABASENAME%_%datestr%%timestr%.bak
set BAK_PATH=C:\Users\miche\Dropbox\Huntsman Shop\Backup\
set DEST_FILE=%BAK_PATH%%FileName%
:: --------------------------------------------------
:: BACKUP Database
:: NOTE: If error "access is denied" appear - go to service properties - log on.
sqlcmd -E -S %SERVERNAME% -d master -Q "BACKUP DATABASE [%DATABASENAME%] TO DISK = N'%DEST_FILE%' WITH INIT , NOUNLOAD , NAME = N'%DATABASENAME% backup', NOSKIP , STATS = 10, NOFORMAT"

I have been looking for a solution for a long time but I can't find it.
What am I doing wrong?
Thanks in advance.
Regards
Michel

1 Accepted Solution

Accepted Solutions

Walter
Dropbox Staff
Go to solution

Hey @Michel1955 - thanks for using Dropbox and welcome to the Community!

 

I'm afraid I can't really suggest anything on this, since we usually recommend that people do not sync live databases with Dropbox. 

 

Most databases have remote access methods anyway, so you don't need to sync the live database. You can sync saved snapshots, however, with no issues.

 

That said, note that I'll leave this thread open in case other users have something additional to offer and you can let us know if you have anything else to ask. 


Walter
Community Moderator @ Dropbox
dropbox.com/support


Heart Did this post help you? If so, give it a Like below to let us know.
:arrows_counterclockwise: Need help with something else? Ask me a question!
:pushpin: Find Tips & Tricks Discover more ways to use Dropbox here!
:arrows_counterclockwise: Interested in Community Groups? Click here to join

View solution in original post

1 Reply 1

Walter
Dropbox Staff
Go to solution

Hey @Michel1955 - thanks for using Dropbox and welcome to the Community!

 

I'm afraid I can't really suggest anything on this, since we usually recommend that people do not sync live databases with Dropbox. 

 

Most databases have remote access methods anyway, so you don't need to sync the live database. You can sync saved snapshots, however, with no issues.

 

That said, note that I'll leave this thread open in case other users have something additional to offer and you can let us know if you have anything else to ask. 


Walter
Community Moderator @ Dropbox
dropbox.com/support


Heart Did this post help you? If so, give it a Like below to let us know.
:arrows_counterclockwise: Need help with something else? Ask me a question!
:pushpin: Find Tips & Tricks Discover more ways to use Dropbox here!
:arrows_counterclockwise: Interested in Community Groups? Click here to join

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Walter Dropbox Staff
What do Dropbox user levels mean?