Haloo all,
I am having couple of windows services running at different Servers which will execute at predefined set of time periods.
Some times it may happen that service is not functioning as desired, then I will go and restart that particular service. After that it will start functioning.
Currently using SQL Stored Procedure and SQL Jobs every 30 mins system will be checking whether the service is functioning or not and if it is not functioning then it will trigger a dbmail to my ID as a notification. (There is a table in my data base in that I will be getting the last executed date and time).
My question is, is there any way like.....using the SQL job I can restart these windows service directly...using a batch file or something...Please note that the SQL database is not on the same server in which the Windows service is running....But all these servers are connected by WAN.
Yes, create a bat file that does a "stop" or "restart" or "start" for the services you want . "sc \servername stop servicename" or "sc \servername start servicename" or "sc \servername restart servicename". This bat file can be executed remotely or directly on the server, you can then call this bat file using a sql job or using a windows task scheduler. Back in the day, all of our server management was done using VBScript or DOS, via bat files.
Related
I am running SQL Server Standard (linux) in a docker container and the Agent is not working to any schedule (recurring, one time).
The agent itself works, I have programmed a couple jobs which are completing successfully. However, the jobs do not even start when I activate the schedule meaning there isn't even an error message to review or record in the job activity monitor. Below is my configuration:
sql server job properties
I corrected the timezone issue by passing the proper environment variable, America/Toronto did not not pass properly, so I used America/New_York.
I'm encountering a problem on Microsoft SQL Server. SQL Server Agent is not running, when I tried to start it and refresh the services.msc the SQL Server Agent is not running anymore. When I see the logs on event viewer. There are no errors but a message "SQLServerAgent service successfully stopped"
Here is the log.
SQLServerAgent service successfully started
SQLServerAgent service successfully stopped.
SQLEXPRESS does not include the SQL Server Agent aspect of the product.
You need to have SQL Server Standard Edition (or greater) to get the SQL Server Agent functionality.
That said, there may be other ways to achieve the results you desire. You could build a simple .NET app or PowerShell script to execute your query or stored procedure, and schedule that to execute via Windows own task scheduler. It is in many ways not as robust as SQL Server Agent, but it is also not as restrictive (you're running under a Windows process as opposed to SQL Server, so you have more options as to how the application may work).
I have a CI environment set up that build my project. It creates a set of sql server files, that i want to to send to my windows server. For that im looking into using scp, by installing copssh.
scp -r /file_in_unix/ user#windows_hostname:/cygdrive/c/
I want to execute a batch file on the windows server, but dont know how to do this?
any ideas?
Quite fast workaround is just to connect your Windows machine to Jenkins as another node. Your current unix job can trigger this job after successful execution.
My question is more specific to a feature in our application. Our environment is currently a dedicated hosting. There is an initiative to move everything to cloud.
There is a data replication scheduler job (this job will trigger copy scripts saved in .bat files) configured in a SQL Server. This job runs every night and copies data in a few tables from one database instance (live) to another (duplicate) on the same server. The idea behind doing the data copy to a duplicate DB is to execute complex application specific reporting queries in an additional DB without interrupting main (live) DB.
Since we are moving to the cloud, we won't get access to Windows servers having SQL Server installed. And we cannot configure Windows scheduler jobs which trigger scripts in .bat files to do DB copy.
Do you have any suggestion to handle this?
Appreciate your help!
I am writing PowerShell scripts to control SQL Server agent start/stop to ensure all the contained jobs runs according to defined schedule. I want to make sure that the only thing I need to do is to start the SQL Server Agent Windows Service, and then all the contained SQL Server Jobs will run automatically according to defined schedule? No need to control each job's start/stop specifically?
I am using SQL Server 2008 on Windows Server 2003.
thanks in advance,
George
When you start SQL Server Agent all jobs (if they are not disabled) will run automatically and it's no need to control each job. Just make sure that jobs are enabled.