Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Bat script for submitting SQL 2005 backups and sto

Author  Topic 

HenkTrumpie
Starting Member

3 Posts

Posted - 2008-10-14 : 07:29:12
Hi there,

I am very new in this. I do work with SQL databases a lot, especially in the filed I am working with. I am a BMC Control-M Consultant, and one problem that I have found is to run and submit MSSQL packages/Stored Procedures and backups with Control-M.
Here is a command line interface to do this:
osql -S SMIN7ND01 -U user -P pass -d msdb -Q "EXEC dbo.sp_start_job N'SystemDB Backups'"

The biggest problem with this is, that when it is submitted from BMC COntrol-M the task within Control-M ends, and is successful, for it does not know what the package/Stored Procedure or backup is doing within MSSQL. At the moment we are sending a condition using a utility of Control-M in the backup to send us a failure or success.

Does anyone have a script which we can use to do this and submit the backup, and it will wait for the return of the success or failure of the backup before it actually ends?

This is urgent for we are busy rolling out a very large orginization which half of the tasks are based within MSSQL.

Kind Regards
Henk Trumpie

CDP
Starting Member

2 Posts

Posted - 2008-10-14 : 15:22:53
Hi,

Change the -Q to a -q and osql will wait for the backup command to complete.



quote:
Originally posted by HenkTrumpie

Hi there,

I am very new in this. I do work with SQL databases a lot, especially in the filed I am working with. I am a BMC Control-M Consultant, and one problem that I have found is to run and submit MSSQL packages/Stored Procedures and backups with Control-M.
Here is a command line interface to do this:
osql -S SMIN7ND01 -U user -P pass -d msdb -Q "EXEC dbo.sp_start_job N'SystemDB Backups'"

The biggest problem with this is, that when it is submitted from BMC COntrol-M the task within Control-M ends, and is successful, for it does not know what the package/Stored Procedure or backup is doing within MSSQL. At the moment we are sending a condition using a utility of Control-M in the backup to send us a failure or success.

Does anyone have a script which we can use to do this and submit the backup, and it will wait for the return of the success or failure of the backup before it actually ends?

This is urgent for we are busy rolling out a very large orginization which half of the tasks are based within MSSQL.

Kind Regards
Henk Trumpie




Chris.
DBA @ The Pythian Group
www.pythian.com
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-10-14 : 15:41:22
CDP, that won't work since he is just starting a job.

Henk, rather than starting a job, just run the actual backup command. osql will not complete until the command completes. You can use my backup script too which is used around the world: http://weblogs.sqlteam.com/tarad/archive/2008/08/19/Backup-SQL-Server-Databases.aspx

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

HenkTrumpie
Starting Member

3 Posts

Posted - 2008-10-15 : 03:45:45
Hi there Chris and Tara,

Thank you so much for your input...
I will definitly use them and test them...
I am sure it will work 100%

henk
Go to Top of Page

HenkTrumpie
Starting Member

3 Posts

Posted - 2008-10-15 : 06:39:47
Hi there Tara and Chris,

I have tried the -q option instead of the -Q option, which submit the backup, and it stay there...
The problem is now that it does not end when the backup ends...
Any ideas why t would happen?

Henk
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-10-15 : 12:41:46
Like I said, -q will not work here.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -