[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 214
  • Last Modified:

Automate SQL Express back up

I am trying to automate a sql back up using a script that I found on here from this link below.
http://www.mssqltips.com/tip.asp?tip=1486
When I run the script it does not do the back up.  However if I load the sql script into sql after connecting to sql express it does the back up perfect.  I do have a password set to the database and I am wondering if this may have something to do with this?
0
thomashospital
Asked:
thomashospital
  • 4
  • 2
1 Solution
 
tigin44Commented:
can you provide your batch file? I think the problem in there...
0
 
thomashospitalAuthor Commented:
REM Run TSQL Script to backup databases
sqlcmd -S<INSTANCENAME>-E -i"C:\LocalProjects\HomeTimeSports\SqlScripts\SqlBKup\backupDB.sql"
REM Run database backup cleanup script
C:\LocalProjects\HomeTimeSports\SqlScripts\SqlBKup\deleteBAK.vbs
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
tigin44Commented:
is the <INSTANCENAME> parameter correct? its should be like  "MachineName\SQLEXPRESS"
0
 
thomashospitalAuthor Commented:
Ok I changed it to machine name and SqlExpress and still does not work.:
REM Run TSQL Script to backup databases
sqlcmd -S ISPROGRAMMERXP\SQLExpress -E -i"C:\LocalProjects\HomeTimeSports\SqlScripts\SqlBKup\backupDB.sql"
REM Run database backup cleanup script
C:\LocalProjects\HomeTimeSports\SqlScripts\SqlBKup\deleteBAK.vbs
0
 
tigin44Commented:
there should be no space after the -S parameter...

REM Run TSQL Script to backup databases
sqlcmd -SISPROGRAMMERXP\SQLExpress -E -i"C:\LocalProjects\HomeTimeSports\SqlScripts\SqlBKup\backupDB.sql"
REM Run database backup cleanup script
C:\LocalProjects\HomeTimeSports\SqlScripts\SqlBKup\deleteBAK.vbs
0
 
tigin44Commented:
also the account under which the process runs should have enough privilages to run that sql command.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now