Though you may already be familiar with creating an automated SQL Server Agent Job utilizing a stored procedure, configuring it to work with a deployed SQL Server Integration Services (SSIS) requires a slightly different approach. The steps outlined in this article assume you have already deployed your integration services package onto the server. If this is not the case and you would like to learn more about how to do this, I have an excellent post that should get you started, A Guide To Creating A SQL Server Integration Services Catalog and Deploying An SSIS Package.
So let’s assume you have an SSIS package that has been deployed and you have created an SSIS catalog within SQL Server. Now you would like to schedule the package to run through a SQL Agent Job. The steps outlined below will walk you through the process of getting it configured and running on a schedule of your choice.
Before you can create a SQL Server Agent Job you need to make sure the SQL Server Agent service is installed and running on the server. You can verify that the service is installed and running by connecting to the server and looking at the SQL Server Agent drop-down at the bottom of the server list. If the icon shows a green arrow then you’re all set.
In most cases it should already be running. However, if it is not, you will need to open SQL Server Configuration Manager and locate the SQL Server Agent service on the SQL Server Services pane as shown below.
If the State of the service does not show Running then simply right-click the service and select Start.
If for some reason the service is not listed, then it was not selected when SQL Server was installed. You will need to launch the installation package again and choose to install the service.
Now that you have confirmed that the SQL Server Agent service is running it is time to create the agent job.
The first step is to locate the SQL Server Agent drop-down after connecting to the server through SQL Management Studio. Expand the drop-down and right-click Jobs. Select New Job… from the list.
The New Job window will be displayed. This window contains multiple pages which allow you to configure all aspects of the job. The initial page that will be displayed is the General page, shown below. Here is where you will name the job and set ownership.
Enter a name for the job. In this case I am creating a job to execute an SSIS package that loads data into a BI360 data warehouse. By default the owner will be set to the domain account that is creating the job. It is generally good practice to have a service account or commonly used account to own all jobs. In this case I will simply leave my account as the owner.
It is never a good idea to have the systems administrator (‘sa’) account as the owner.
The Category option is less important here. By default it may be set to [DB Maintenance]. You can leave it as that or change it to something more relevant if applicable. In the example above I have set it to [Uncategorized(Local)].
Once the steps above have been completed it is time to configure the actual steps that the job will perform. To do this, select the Steps page on the left hand side of the window.
To begin configuring each step of the job click the New… button.
An individual step will need to be created for each SSIS package within a project that you wish to call. If you have 5 SSIS packages that need to be called within the job, you will need 5 steps. Each step will, by default, be called in the order in which they are listed on the Steps page. You can change the order of the steps once they have been created using the up and down arrows above the New… button.
After clicking New… the New Job Step window will be displayed. Here you will name the step and configure the individual SSIS package that will be called.
I have found that a good practice, especially when dealing with an agent job that will call multiple packages, is to name the step based on the package that is being called.
In the example above I will be configuring the step to run the Dimension_Load.dtsx package so I have named the step Dimension Load.
By default the Type will show Transact-SQL script (T-SQL). Since we are going to utilize an SSIS package this needs to be changed to SQL Server Integration Services Package. Once the type has been changed the window will update to reflect the new options that are available based on this type.
From here I will be working under the assumption that the SSIS packages are contained within an SSIS Catalog on the server. If you do not already have an SSIS Catalog created, refer to the link at the top of the article related to creating an SSIS Catalog.
On the Package tab next to Package source, select SSIS Catalog and enter the server name next to Server. In the example above I am specifying the LAB-SQL2012 server..
The next step is where you will select the actual SSIS package to be used within the Job step. Click the ellipses at the bottom of the New Job Step window under Packages.
A new window will appear where you can select the SSIS package. Navigate down through the Integration Services Catalogs drop-down until you locate the applicable catalog. In the example above I am selecting the Dimension_Load.dtsx package in the BI360DW catalog.
Click OK once you have selected the package.
The Packages text box will now display the path to the SSIS package as shown below.
Before clicking OK to save the job step select Advanced from the page list on the left hand side of the window.
Depending on the number of job steps you will be creating within the SQL Agent Job the settings here may require modification. In this example I am only creating a single step to call a single SSIS package. If you are calling multiple SSIS packages within the job you would simply repeat the above steps for each SSIS package. Each step would have its own options here.
By default the On Success action: drop-down will display Go to the next step. If you are planning on having multiple steps within the job then this is the correct setting to have so that the job will immediately call the next step. However, in this example I am only creating a single step within the job. Since this is the case, I have changed this to Quit the job reporting success.
Once all applicable modifications have been made, click OK.
You should now see the newly created Step on the Steps page of the New Job window.
The next, and generally final step is to configure the schedule by which the job will run. Select the Schedules page from the left hand pane of the New Job window.
To create a new schedule click the New… button at the bottom of the Schedules window.
The New Job Schedule window will be displayed which will allow you to configure the schedule. In the example below I have set the schedule to run hourly every day from 6:00AM to 11:59:59PM.
As you configure the schedule the Description at the bottom will adjust to give you a specific outline of when the schedule will run. Once you have configured the schedule click OK to return to the New Job window.
At this point the job configuration is essentially complete. If you do not wish to configure any Notifications then simply click OK to save the job.
With that said, it is generally a good idea to configure a notification on all new SQL Agent Jobs. Typically it is best to configure a notification to go out when a job fails. To do this click on the Notifications page on the left hand side of the New Job window.
As shown below, I have configured an E-Mail notification to go out to me in the event that the job fails.
You will notice that the notification drop-down is not designed to allow free-form entry of contacts. This list pulls from the list of Agent Operators that have been configured on the server. If there are no operators currently configured refer to my post on Configuring SQL Server Agent Operators.
At this point you can simply click OK to save the Notification settings.
You should now see the newly created agent job listed under Jobs within the server drop-down. The job will begin running on the configured schedule immediately. If you wish to manually start the job in order to test it for the first time you can right-click the newly created job and select Start Job at Step…
If you have multiple steps within the job simply select the desired step and click Start. If only a single steps exists the job will start on it’s own.