SQL Server: Receive notifications when Job Schedule is completed - sql-server

We have a Job Schedule with 5 steps that runs daily overnight and we want to know whether it succeded or not as well as how many rows were updated and inserted.
Is there a way we can do this?

Related

Query runs for hours

Some of the queries that execute overnight run for exactly 5 hours before logging a failure message. These queries retrieve records from a linked server which is also a SQL server. When I run the same query in the morning it executes in a minute. The timeout property in both servers is set to 1 hour. So I'm trying to understand how it can execute for more than an hour and how it can stop after 5 hours every time. Please help me understand what I'm missing.
Thanks.
It might be possible for that particular query which runs on that particular session/ window, if you are using transaction methodology in your queries, transaction had not been in committed state so it should be rollback before executing again.
Reason 2 - Linked server functionality had not been working at that time when you were executed the query.

SQL Server agent job recreated

I stuck in a issue from last 6 months. I had a SQL Servre job SALES lOAD which is created with a T-SQL script. This job is being recreated every month automatically. How we know which job affected or recreated my SALES lOAD load every month. I checked each and every job but no job is affecting this job
You may check if there is any process scheduled to run every month (BAT file,Task scheduler job, etc...)

trigger SSRS report when finishing a SSIS job

A number of SSIS packages have been deployed to the SSI-catalog and are scheduled through SQL Agent jobs.
On the SSRS-server I have created a report that gives me insight in the executions of all SSIS-packages run on the SSIS-server.
I have created a job (Send me report) that, when executed, sends me this report.
I know how to create a jobstep that fires this SQL Agent Job.
I add this jobstep to all the jobs that execute SSIS packages.
However, I am not the only one scheduling packages and not all of my colleagues add this jobstep. The jobs are scheduled and created irregularly. So sending the report every day would be nonsense because sometimes the jobs don't run for a month. Other times, 5 jobs a day are executed.
Is there a way to trigger the job 'Send me report' whenever a SSIS-package finishes running? Regardless of how it was started? Regardless of what the outcome was?
Create a data driven subscription to the report that execute a stored procedure that check if any jobs was executed the day (probably the previous day or running 24 hours, etc.)

How do you run SQL Server Merge Replication Jobs sequentially?

I work with an environment that uses Merge Replication to publish a dozen publications to 6 a dozen subscribers every 10 minutes. When certain jobs are running simultaneously, deadlocks and blocking is encountered and the replication process is not efficient.
I want to create a SQL Server Agent Job that runs a group of Merge Replication Jobs in a particular order waiting for one to finish before the next starts.
I created an SSIS package that started the jobs in sequence, but it uses sp_start_job and when run it immediately starts all the jobs so they are running together again.
A side purpose is to be able to disable replication to a particular server instead of individually disabling a dozen jobs or temporarily disabling replication completely to avoid 70+ individual disablings.
Right now, if I disable a Merge Replication job, the SSIS package will still start and run it anyway.
I have now tried creating an SSIS package for each Replication Job and then creating a SQL Server Agent job that calls these packages in sequence. That job takes 8 seconds to finish while the individual packages it is calling (starting a replication job) takes at least a minute to finish. In other words, that doesn't work either.
The SQL Server Agent knows when a Replication job finishes! Why doesn't an SSIS package or job step know? What is the point of having a control flow if it doesn't work?
Inserting waits is useless. the individual jobs can take anywhere from 1 second to an hour depending on what needs replicating.
May be I didn't see real problem but it is naturally that you need synchronization point and there are many ways to create it.
For example you could still run jobs simultaneously but let first job lock a resource that is needed for second, that will wait till resource will be unlocked. Or second job can listen log table in loop (with wait for a "minute" and self cancel after "an hour")...

Execute long running jobs in SQL Server

I am working with SQL Server 2008. Using the Agent, I have created a job and scheduled it to execute every minute.
The job executes a stored procedure that moves data from table XXX, to a temp table, and then eventually into table YYY.
The execution of the job may take more than one minute - since the data is rather large.
Will a second instance of the job be started even though the first instance is still running?
If so, should I mark records in temp table (status = 1) to indicate that those records are being processed by a previous instance of the job?
Is there a way for me to check that an instance of the job is currently running, so that I don't initiate a second instance of the job?
Is there another solution for this that I am unaware of? (throughput is important)
Only one instance of a particular job can run at any one time.
So there is no need to take any particular precautions against another execution of the same job beginning before the first one has stopped.
check this post
How to Prevent Sql Server Jobs to Run simultaneously
How to Prevent Sql Server Jobs to Run simultaneously
As Well HERE
Running Jobs
http://technet.microsoft.com/en-us/library/aa213815(v=sql.80).aspx
If a job has started according to its schedule, you cannot start another instance of that job on the same server until the scheduled job has completed. In multiserver environments, every target server can run one instance of the same job simultaneously.

Resources