Sign in to follow this  
Followers 0
BillNewB

SQL DB Backup

5 posts in this topic

#1 ·  Posted

Hello All,

I'm totally new to AutoIT, and I've tried to make this function work somehow, with AutoIT. This is what I've used in a dos batch file, but want to create an AutoIT script. Any help would be appreciated.

set BACKUPFILENAME1=c:\ck\dbbackups\ServerTT.bak

sqlcmd -S localhost -U sa -P ?????? -d tora -Q "BACKUP DATABASE test TO DISK = N'%BACKUPFILENAME1%' WITH INIT , NOUNLOAD , NAME = 'test_backup', NOSKIP , STATS = 10, NOFORMAT"
 

Share this post


Link to post
Share on other sites



#2 ·  Posted

This should work

 

$BACKUPFILENAME1 = "c:\ck\dbbackups\ServerTT.bak"

Run(@ComSpec & ' /c ' & "sqlcmd -S localhost -U sa -P ?????? -d tora -Q 'BACKUP DATABASE test TO DISK = N'" & $BACKUPFILENAME1 & "' WITH INIT , NOUNLOAD , NAME = 'test_backup', NOSKIP , STATS = 10, NOFORMAT'"

 

Share this post


Link to post
Share on other sites

#3 ·  Posted

Floops,

 

Thanks for the reply. I was getting errors at first, but I added a ) at the end, and now I get no errors, but the backup doesn't work.

Share this post


Link to post
Share on other sites

#4 ·  Posted

#RequireAdmin

$BACKUPFILENAME1 = "c:\ck\dbbackups\ServerTT.bak"

Run(@ComSpec & ' /c ' & "sqlcmd -S localhost -U sa -P ?????? -d tora -Q 'BACKUP DATABASE test TO DISK = N'" & $BACKUPFILENAME1 & "' WITH INIT , NOUNLOAD , NAME = 'test_backup', NOSKIP , STATS = 10, NOFORMAT'",@ScriptDir,@SW_SHOW)

 

Share this post


Link to post
Share on other sites

#5 ·  Posted

rootx,

 

Thanks for the reply, but I still can't get it to work. No errors, but no backup either.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0