Greetings, all.
I'm using SQL Server 2005 as a small data warehouse for storing and processing information derived from our trading system and other sources (HR, Excel, csv), such operations being run from DTS jobs (dating from inception on SQL Server 2005) on a schedule starting at 5 a.m. and running for about four hours. The server reboots daily at 3 a.m., so no job will run over 24 hours.
I know that I should be migrating these jobs to SSIS, but there's a combination of "if it ain't broke" and lack of knowledge (self-taught SQL & SQL server admin).
Whilst things run mostly without hiccups, we're about to do a disaster recovery (DR) exercise with servers; restoring from tape-backups. This has resulted in the consideration of how to perform a forced re-run of jobs if the server has been inoperative over the time of 'reads' of the trading system.
I'm trying to compile a DTS job for DR that can be run at any time in the day, which will perform the following.
1) stop any running jobs
2) disable any jobs scheduled to run later that day
3) run all jobs not run that day consecutively in order
I think I can see how data extracted from msdb tables sysjobs, sysjobschedules, sysjobhistory and sysjobactivity will let me compile such a sequence, but what I want to check is the way to identify running jobs.
Since sysjobhistory does not log a job until it has completed (stopped, failed or succeeded), then it is better to use sysjobactivity, and test for jobs that have started today (run_requested_date or start_execution_date) but not stopped (NULL in stop_execution_date or job_history_id).
Does that sound the best way or have I overlooked something?
Apologies for the long question.
thanks,
lex
soi la, soi carré
I'm using SQL Server 2005 as a small data warehouse for storing and processing information derived from our trading system and other sources (HR, Excel, csv), such operations being run from DTS jobs (dating from inception on SQL Server 2005) on a schedule starting at 5 a.m. and running for about four hours. The server reboots daily at 3 a.m., so no job will run over 24 hours.
I know that I should be migrating these jobs to SSIS, but there's a combination of "if it ain't broke" and lack of knowledge (self-taught SQL & SQL server admin).
Whilst things run mostly without hiccups, we're about to do a disaster recovery (DR) exercise with servers; restoring from tape-backups. This has resulted in the consideration of how to perform a forced re-run of jobs if the server has been inoperative over the time of 'reads' of the trading system.
I'm trying to compile a DTS job for DR that can be run at any time in the day, which will perform the following.
1) stop any running jobs
2) disable any jobs scheduled to run later that day
3) run all jobs not run that day consecutively in order
I think I can see how data extracted from msdb tables sysjobs, sysjobschedules, sysjobhistory and sysjobactivity will let me compile such a sequence, but what I want to check is the way to identify running jobs.
Since sysjobhistory does not log a job until it has completed (stopped, failed or succeeded), then it is better to use sysjobactivity, and test for jobs that have started today (run_requested_date or start_execution_date) but not stopped (NULL in stop_execution_date or job_history_id).
Does that sound the best way or have I overlooked something?
Apologies for the long question.
thanks,
lex
soi la, soi carré