Schedule a job on success of other in SQL Server 2014 - sql-server

I want to Schedule to run ETL_Job2 no Success of ETL_Job1 and on Success of ETL_Job2 has to start ETL_Job3.
Jobs are to be created in the SQL Server Agent and the SSIS packages associated with the respective job are from the separate solutions.
Appreciate any help on this.

One way is, you can maintain a table and at the end of the entire package process, the Execute SQL Task in SSIS Package should update the status of it. (Make sure that Error Handling should be done for that and in case of error it should update failure.)
And on another hand, another job should trigger itself to check the status of that table, once it gets status successful it can be started. All checking you can do in SSIS Package.

There is no built-in way to make a job run based on the success of another job.
The usual way to do this is to make all three "jobs" be different steps in the same job.

Related

SSIS and SQL Server Agent Job Notification duplicates the error mail

I have an interesting issue. I will try to keep it simple as explanation.
I have a SSIS package which has an Event Handler (OnError, including some extra logging info) with Send Mail Task which is working just fine when the package fails
Database Mail is configured and Job Failure notifications are enabled in SQL Server Agent.
The idea behind that is because I use proxy to run the SSIS package and when the proxy is not working I need to receive email with error (which is now working). When the job starts it cannot go to SSIS OnError handler and if I'm not checking the jobs I will never know If the job is working or not.
Now when I have proxy problem I receive only one mail which is fine but when something in the SSIS package fails I receive 2 mails: one from SQL Server Agent notification, and another one from the OnError event handler from SSIS, which is something I'm trying to avoid.
I need only 1 email when an error occurs. Is it possible to prioritize it somehow and when the SQL job notification is sending mail another one from SSIS to be ignored?
I'm thinking to create one sample SSIS package only with one SQL Task and include it before all the SSIS steps just to check If the job is able to start. I don't know. I don't like the idea.
Do you have any ideas? Thanks.
Best regards.
What do you mean by the Proxy isn't working?
If you can define and test that, add a job step that does proxy test, and emails with send_dbmail as step 1. Keep the SSIS package as step 2 with it's inbuilt error notification, and disable the job notifications.

How do I cancel SSIS jobs in Created Execution status

I have two SSIS jobs that are stuck in Created Execution status. They cannot run since the package version has changed (I get Error Msg 27150: The version of the project has changed since the instance of the execution has been created. Create a new execution instance and try again.) I do not want to run this anymore, just delete it.
How can I remove these from the execution log? catalog.stop_operation does not work since there is no active operation for this job.
Note: the job does not appear in Active Operations, since it never started.
SSISDB keeps track of all operations that are currently active/executing. In order to retrieve a list of all active operations, you need to right-click SSISDB and choose Active Operations
You can then click the Stop button located at the bottom right of the window
It’s also possible to do the same process via T-SQL. You can stop a package by calling the stored procedure catalog.stop_operation passing the operation ID as a parameter
Use this query to retrieve all currently running packages in the SSIS. Catalog and their IDs:
SELECT * FROM SSISDB.catalog.executions WHERE end_time IS NULL
The statement below stops the execution of the SSIS package with operation_id=65
EXEC SSISDB.catalog.stop_operation #operation_id = 65

SQL Server Agent Job stops SSIS Step with "unexpected error" and without any error informations

I am dealing with my problem on some Windows Server 2019 (Core) with one running SQL Server 2019 CU4 instance each.
What we try to do
We are currently building a data warehouse with distributed databases. The individual layers of the DWH are located on one database server each. The data exchange between the layers/servers takes place via SSIS ETLs, which use Linked Servers to reach the other layers and drag and drop data. Each layer also has its own SSIS service instance and executes the corresponding SSIS packets.
The SSIS packages are called by SQL Server Agent jobs. We have a job that executes the SSIS packets (#1), which in turn calls another job (#2) as the last step, which after a short wait time executes the calling job (#1). Thus, controlled by schedules, a loop is created and data is continuously transferred with ETLs.
I hope this was not too much unnecessary background
The error
Basically the job is running and there are numerous successful executions. However, we are observing interruptions at job #1 without helpful information regarding the error. This means that the job history log refers to the SSIS log, which again only contains an "unexpected termination". In the SSIS log, we only see behavior that indicates that the ETL packet active at that time stopped after validation. Depending on the log level, nothing is logged at all, not even the execution of single packages of the project. The package where this error occurs is different and not limited to a specific one.
What I have already tried
Re-create the jobs and SSIS Enviroments by hand (scripted before)
Using the 32Bit Runtime
Upgrade the SSIS project/package version to
2019
Increase the log level to "verbose"
Patching the SQL Server to CU4
Save ssis dump files (couldn't find them or they weren't created)
Search Windows and SQL Server Logfiles
Does anyone have some suggestions or some ideas how to become more error specific informations?
Thank you very much and take care :)
UPDATE We have an error message (OLE DB 0xC0202009 and 0X80004005)!
In order to exclude the use of environments as a cause, I manually set the parameters in the SSIS job step instead of overwriting them by selecting an environment.
Long story short: Today it turns out that the parameter for an OLE DB Connection String is not passed correctly.
The following is specified as a parameter in the job step:
However, the following connection string is specified in the context of the error message:
Please note that some arguments are added twice to the parameter (red).
What could have caused that?

Why did my SSIS package complete with an error while there seems to be no errors?

I have a package with one data flow task. In the data flow task it copies data from one database to another archive database.
I linked two precedence constraints. If it's successful it should go on and start a certain job in SQL Server (delete records from the original database). If the task fails, it should return a script task saying that it failed.
When I run this, the data flow task is successful (every record gets copied). The data flow task gets a green tick. The "execute SQL Server Agent Job Task" also gets a green tick. Yet after completing the package it says
"Package execution completed with error. Click here to switch to design mode, or select Stop Debugging from the Debug menu."
I included a screenshot of it:
The output basically only says:
SSIS package "c:\Users\Kim\Documents\Visual Studio 2012\Projects\POC\POC\Archive.dtsx" finished: Failure.
So:
Where can I find the error? There is no indication at all what went wrong. Both show green ticks and the migration of data did went well indeed. The SQL Server job didn't do its job. The records are still there. So I have a feeling that the error has to do with the job. I have to mention it is the Change Data Capture cleanup job which was automatically made when I turned on CDC on this table. I did this because I only want this job to happen when the data flow task is successful (instead of running the schedule by default).
If it failed, why didn't it follow the precedence constraint for failure (showing the script)?
SQL Server agent is turned on by the way.
Can someone please help me? I googled "Package execution completed with error" and I literally get only 68 results which are not helping.
Kim
I recreated the entire package and it completed with success. I'm still wondering what the difference is with my original package, but I'm guessing it might have something to do with non-corresponding meta-data. When making the original package I had copied a few tasks and then made new tasks and deleted the copied ones (because it was easier to look between them instead of switching between SSIS projects). I deleted all the old copied tasks, but possibly something went wrong there and that something is still linked to old metadata. All the tasks are performing though.
Mike en Ennor thanks for looking into the problem. If anyone has any clue what it could be, please reply anyway, because my solution to recreate the package again was not a satisfying solution.
Kim
Did you look at the Event Handlers? Also, any other failed configurations or Loggings in the background? These three could be possible culprits. Any other Tasks that are disabled and are using an old connection string that no longer resides on the package?
I got the same issue.
Try going through each event handler tab, data flow tab for Evey executable while in the execution / run mode. You would be able to see red Cross marks where the error is.
Run the workflow > click the "Progress" button to see red X's.

Exception handling in SSIS Package Dynamic Connection

SSIS Scenario
I have a SQL variable of type object. It contains all the connection to different servers/databases. I want to connect to those databases one by one and run a query.
Expected Exception Handling
If the SSIS Connection manager(Dynamic connection manger) is unable to find the connection to the server (probably the server is down) I want to Skip that connection (Database/server) and log that into the table and move onto the next Connection (Database/Server). The SSIS package should not crash.
My Implementation
I have Successfully Configured the SSIS package to Use Connection Manager (Dynamic Connection Manager) and Foreach loop to loop through the SSIS variable of type object. but I am not able to skip the Connection if the server/database is not found. it generates error that the server/databsse not found / problem with the connection and the SSIS package fails.
my experience in SSIS is one week old
Any help will be appreciated.
How about setting --> Force execution Result property of the task to success
I was looking for the same fix too. Seems the normal OnError Eventhandling does not work for issues that arise when connecting to a source DB.
There is another workaround I wanted to mention. You can handle the error in the Data Flow Task (OnError Eventhandler, set the System-Variable "Propagate" in that Eventhandler to false). I think this is still required, but not sure. I use it also to log the exception.
Afterwards you can set MaximumErrorCount in ForEachLoop to "0" (which means unlimited). I'm not exactly sure why it works, but trying to find a way to handle the scenario you described, I found this.
==
Just as an interesting observation: For debugging purposes I added an OnError Eventhandler to the ForEachLoop and set a breakpoint there in a dummy script. It was never reached. Nonetheless the ForEachLoop failed all the time until I set MaximumErrorCount to 0.
I dont think its possible to continue the package execution once it encounters an error. You need to control this behavior through a SQL Server table (or any other table for that matter).
Once the package fails, you can set a flag in the table saying that the package failed. The next time the package runs, you can start from this point on and continue the execution. But automatically skipping the down server is kinda pulling a rabbit out of a hat.
Another way you can do this is to ping each server before hand in a separate package and store the ping results in a table. Only pick those records (servers) whose ping results were positive. Otherwise just skip the server.

Resources