July 13, 2008 at 5:41 am
Hi, I was thinking if there is a way to call a batch job in windows scheduler?
or can a batch job that runs on a differnet server and domain be called and ran using SQL Server jobs on another server and domain? if so how can this be made...any suggestions please??
July 13, 2008 at 6:31 am
Do you mean that you want start a command file or program on one server that will run on a different server?
Windows does not include such a capability but there are solutions available.
1) Third party software that are installed on the remote server and run as a service that accept the remote command and perform the execution.
2) MS Sysinternals has PsExec located at
http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx
SQL = Scarcely Qualifies as a Language
July 13, 2008 at 6:47 am
thanks Carl!, we have a batch file that runs in the command prompt, I want to schedule the batch job to run automatically at a specific time, that time would vary, it depends upon the data that comes to a database, once the data is loaded into the database, we need to run the batch. At present we are running it manually. So its a bit cumbersome task to do it daily.
Could PsExec be able to do that?
or any other suggestions/methods?
thanks
July 14, 2008 at 7:51 am
I am not sure exactly what you are after, but if you have network permissions for your SQL Agent account then you can create a SQL Server Job that runs something like "AT \\RemoteComputerName time "command"". See the "AT" command for reference. As long as you have only one "AT" you could then delete it either before creating it or later after it has ran. This will not run something immediately, but you could use a database to store a set of commands to execute and various computers and schedule them to run.
July 15, 2008 at 5:10 am
Thank you...Let me explain the scenario....I have a batch job that runs on a virtual server..
I have to run the batch automatically, whenever I am asked to do it(that is once the load to a database is complete).
My plan is : Once the load to the database is complete, a trigger job should trigger the batch job to run automatically on the virtual server.
Can this be made possible? any ways? to do it?
The database server is : sql 2005
The batch job is run through the command prompt.
July 15, 2008 at 5:45 am
Again, just trying to clarify:
ServerA has SQL Server. ServerB does not(?) You want to run a command line on ServerB after ServerA finishes restoring a database. Is this correct?
July 15, 2008 at 6:08 am
Can you give more details on how the data is being loaded to the database?
If it comes in through SSIS, you might add a last step to start the batch you want.
If it's not through SSIS, how do you know when the load is completed?
Depending on those answers, different strategies may apply.
Peter Rijs
BI Consultant, The Netherlands
July 15, 2008 at 6:13 am
Hi,
Yes you are right ServerA has SQL Server. ServerB does not .
Yes want to run a command line on ServerB after ServerA finishes restoring a database.
The load to database at present is done manually through restore process, as we are still in the phase of testing.
Once the testing is over , the data into the database will be loaded into through , yes probably through SSIS packages.
thanks
🙂
July 15, 2008 at 10:42 am
There is an executable, "WaitFor.exe", that will either wait until a specific string is sent or until a time out (where it will error) or send a string. If you add a scheduled task on ServerB that listens for "ContinueServeB" (or some such string) before continuing with the process, you could start it at the same time the SSIS package is supposed to run. Then, once the SSIS package completes, you could send "ContinueServerB" to ServerB from the package.
July 15, 2008 at 10:38 pm
thanks!! could you tell me where to get 'WaitFor.exe', (any website where I can download) and how to implement?
July 16, 2008 at 5:27 am
I do not have the link that I used to download it. You can either google it, or search Microsoft for a downloadable version, or send me an email and I will be happy to zip up the one I have and send it to you. It is a Microsoft executable, and I believe is available in several of the resource kits.
July 16, 2008 at 5:42 am
thanks alot! let me search the web. Appreciate if you could also email it to: rinugp@gmail.com..:)
July 16, 2008 at 6:06 am
thank you..got your email and downloaded it..!!
July 16, 2008 at 6:09 am
No problem!
July 16, 2008 at 3:31 pm
Another possibility, and keeping it in the SQL Server family, would be through using OSQL. I use that technique to run my DBCCs every night using this CMD file:
osql -S"(your server name)" -E -id:\dbccs\ightlydbcc.sql -od:\dbccs\dbccresult.txt
(in all fairness, I'm not running this between servers, just against the local server)
In this case, I have a text file containing my TSQL DBCC commands, along with some additional work that I don't want to have in my actual scheduled job step. The results of the run go to the file specified in -o. Typing osql -? will give you a list of options, and there's always BOL.
If you could install the SQL Server tools to get OSQL on your B server (the one without SQL Server), as long as the permissions between the two servers are good, B should be able to fire off a task on A.
-----
[font="Arial"]Knowledge is of two kinds. We know a subject ourselves or we know where we can find information upon it. --Samuel Johnson[/font]
Viewing 15 posts - 1 through 15 (of 15 total)
You must be logged in to reply to this topic. Login to reply