Comments
Sort by recent activity
I still can't get the command line MAILTO option to work. I'm calling the restore query from VB. It gets stored in a variable, and then later I call SQLBackupC with the variable as the parameter. Here's the line of code:
query10 = "-SQL ""RESTORE DATABASE " & myString6 & " FROM DISK = 'G:\myFiles\CompressedBackups" & myFile6 & "' WITH MOVE '" & myString6 & "' TO 'G:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data" & myString6 & ".mdf', MOVE '" & myString6 & "_LOG' TO 'G:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data" & myString6 & ".ldf' WITH MAILTO='myemail@mydomain.com'"" -I sql -U user -P password THREADPRIORITY=6"
The problem must be with where the mailto option is placed, because the restore works. Here I get a syntax error. I've also tried putting it right before the -I and I don't get an error, but I don't get the mail either. Test emails from the GUI work fine. The mail server doesn't require authentication, so credentials shouldn't be an issue.
petey wrote:
The command line interface uses the settings you specified using the GUI, thus you do not need to provide the mail server settings.
One difference when using the command line interface is that all the work will be performed using the credentials of the logged-on user. When using the extended stored procedure, all work is performed using the credentials of the SQL Backup service startup user.
/ comments
I still can't get the command line MAILTO option to work. I'm calling the restore query from VB. It gets stored in a variable, and then later I call SQLBackupC with the variable as the parameter. H...
Fred,
email me and I can send you a script that might be similar to the one you are looking for. I have a script that queries a folder to get a list of database backups, stores the list in a recordset, and loops through the recordset, using SQLBackupC to restore the databases. It also runs scripts to change some tables because the databases are being restored on a different server, and uses the "With Move" option for that same reason. I'd post it here, but it is long.
Aaron / comments
Fred,
email me and I can send you a script that might be similar to the one you are looking for. I have a script that queries a folder to get a list of database backups, stores the list in a record...
Ok. Let me just change some database names and I'll send it in.
Daniel Handley wrote:
If you send the script in to support(at)red-gate.com i can always post it on our ftp site for retrieval.
It would also be useful for us to have to give out to other cutomers.
Thanks
Dan
/ comments
Ok. Let me just change some database names and I'll send it in.
Daniel Handley wrote:
If you send the script in to support(at)red-gate.com i can always post it on our ftp site for retrieval.
It wo...
Great, thanks!
petey wrote:
I'll add it to the feature request list for future consideration. Thanks for letting us know.
/ comments
Great, thanks!
petey wrote:
I'll add it to the feature request list for future consideration. Thanks for letting us know.
Thanks, you answered it for me. Basically, I have a script that uses SQLCMD to restore databases, and then uses SQLCMD to call .SQL files that make updates to the databases. The .SQL files aren't just simple SQL commands, they're complex scripts that are about 100 lines of code each. That's why they're stored in .SQL files rather than just executing the commands directly with SQLCMD - there is a lot of processing that goes on in the scripts as well. I was easily able to replace the restore part with SQLBackupC. I was hoping to call the .SQL files with SQLBackupC as well, so I would only have to use one program. It's not a big deal though. SQLBackupC does the restore and SQLCMD calls the scripts.
eddie davis wrote:
Hi
Sorry I am a little confused with your question.
Red Gate SQL Backup provides a comand line utility so you can perform back and restore operations in any SQL Script or batch files that you create.
The SQL Backup command line executable is call SQLBackupC. It is located in the folder in which you installed the SQL Backup Server Components, by default this is C:\Program Files\Red Gate\SQL Backup\<instance name>.
The SQL Backup command line interface uses a subset of the T-SQL Backup and Restore statements.
Further advice on using the SQL Backup Command Line Interface can be found in the SQL Backup Help file.
If I have understood your post correctly, the answer is no you cannot use the SQL Backup Command Line Interface to call other .SQL Scripts.
However you can include SQL Backup Command Line Interface into any .SQL Scripts that you create.
Eddie Davis
Red Gate Software Ltd
Technical Support Engineer
/ comments
Thanks, you answered it for me. Basically, I have a script that uses SQLCMD to restore databases, and then uses SQLCMD to call .SQL files that make updates to the databases. The .SQL files aren't j...