0

What is the alternative for running jobs when the hosting company that provides shared SQL Server services blocks access to SQL Server Agent?

Aaron Bertrand
  • 272,866
  • 37
  • 466
  • 490
hassona
  • 27
  • 1
  • 9
  • use a batch script... but why not just use agent? What's the *problem* you mentioned and didn't elaborate on? [**Check this post out**](https://stackoverflow.com/help/how-to-ask) – S3S Jun 25 '18 at 18:06
  • @scsimon Quite simply, many hosting companies that offer shared SQL Server services block access to SQL Server Agent and don't provide an alternative. – Aaron Bertrand Jun 25 '18 at 18:07
  • Fair point @AaronBertrand I didn't correlate the word hosting with web hosting. I guess the problem is, then, that they can't use agent. – S3S Jun 25 '18 at 18:09
  • Powershell can help with this. [This example is for Azure SQL DB](https://azure.microsoft.com/en-us/blog/azure-automation-your-sql-agent-in-the-cloud/) but the only thing that would be different for you is connection method / credentials. – Aaron Bertrand Jun 25 '18 at 18:12

2 Answers2

1

All windows machines have a built in tool, "Windows Task Scheduler" which can run jobs on a schedule determined by you. Its an easy tool to learn and you probably will have to run your jobs using SQLCMD.

benjamin moskovits
  • 5,261
  • 1
  • 12
  • 22
  • Except the OP is at a shared host, if the host has denied them access to SQL Server Agent, I doubt they give free reign on the OS. – Aaron Bertrand Jun 25 '18 at 18:38
  • Your right. This is a user being told no and the user will be forced to spend big bucks getting internal support to do something that should be easy and free. – benjamin moskovits Jun 25 '18 at 18:40
  • if i use this, can i run the job repeatlly ? – hassona Jun 25 '18 at 18:41
  • @hassona If you use what, windows task scheduler? You can use it on your own machine as often as you like, assuming the commands it calls can access your shared hosting server (and with the disclaimer that this is very brittle). If you mean running task scheduler on the hosting server, you might want to check with them if you have access to this functionality before getting too excited about it. My guess is that you won't (for the same reasons they won't let you have Agent). – Aaron Bertrand Jun 25 '18 at 18:45
  • You have to dance with the person who bought you. What Mr. Bertrand is trying to say is that if Agent is locked down probably any other tool is locked down too. Before you try to get a technical solution see if any technical solution involving running software will be acceptable to the owners of the resource. – benjamin moskovits Jun 25 '18 at 18:50
0

If you don't have access to agent, then you wont get access to Window Scheduler for sure. Request access to the agent or at least have them create a job for you that runs at a specific time. If not the alternative is pretty ugly.

  1. 1.What is purpose of the job to be run by the Agent job?
  2. How often did you want it to run (Schedule) ?

If you can answer those two then maybe, we can have an alternative..

Rahim
  • 186
  • 1
  • 7