Checkpoints in SSIS

The SQL Server Integration Services includes the most powerful and useful feature called Checkpoints. You can use this SSIS checkpoints to restart packages from the point of failure, instead of rerun the whole package (all tasks). SSIS checkpoints are beneficial while we are loading large data or importing or exporting an image.

This article shows the steps involved in configuring the Checkpoints in SSIS package with an example. For this SSIS checkpoints demo, we are going to use the below shown data.

Checkpoints in SSIS 0

Checkpoints in SSIS Example

To explain the Checkpoints in SSIS concept, Drag and drop the data flow task from the toolbox to control flow and rename it to SSIS Checkpoint.

Checkpoints in SSIS Example 1

Double click on the SSIS Data Flow Task will open the data flow tab. Drag and drop OLE DB Source and OLE DB destination on to the data flow region.

Checkpoints in SSIS Example 2

Double click on OLE-DB source will open the Source Editor. From the below screenshot, you can see that we are selecting the [Employee] table present in the SQL Tutorial database. Please refer to OLE DB Source in the SSIS article.

Checkpoints in SSIS Example 3

Next, Double-click on the OLE DB Destination to open the to open the Destination Editor. For the time being, we are selecting the existing table Table called [SSIS Checkpoint Example] table. Please refer to OLE-DB Destination in the SSIS article.

Checkpoints in SSIS Example 4

Click on the Mappings tab to check whether the source columns accurately mapped to the destination columns.

Checkpoints in SSIS Example 5

Click OK to close the OLE DB Destination editor. Next, Drag the Execute SQL Task from SSIS Toolbar and drop it into the Control Flow region

Checkpoints in SSIS Example 6

Now, Double click on the Execute SQL Task will open the Editor to configure it. Let me select the Connection Type as OLE DB Connection, which is connecting to the SQL Tutorial database. Next, we are using the Direct Input as the SQL statement, so click the … button.

Checkpoints in SSIS Example 7

Please write your custom SQL statement here. As you can from the below screenshot, we are writing an UPDATE statement to update the EmpId with 5, and Education to Masters for Employee whose ID is 1.

-- SQL statement for Checkpoints in SSIS example
USE [SQL Tutorial]
UPDATE [dbo].[SSIS Transactions Example]
   SET   [EmpID] = 5 
        ,[Education] = 'Masters'
WHERE [EmpID] = 1
Checkpoints in SSIS Example 8

Let me run the SSIS checkpoints package. From the below screenshot, you can see that the Execute SQL Task failed because we can not update the Identity column (i.e., EmpID)

Checkpoints in SSIS Example 9

but we successfully inserted the 14 records into the Destination table.

Checkpoints in SSIS Example 10

Somehow you realized the mistake you have done and removed the EmpID = 5 from the Update statement. Now you can see, both Data Flow Task, and Execute SQL Task has successfully executed.

Checkpoints in SSIS Example 11

Here you are rerunning the whole package, which is OK for these 14 records, but it becomes costlier for a large amount of data. In this situation, you can use the SSIS checkpoints to start the package from the point of failure (i.e., Execute SQL Task).

Configuring Checkpoints in SSIS

Please select the package in which you want to set the checkpoints and go to its properties windows to find the SSIS Checkpoint property.

  • CheckpointFileName: Please select the file name. SSIS will use this file to save the information related to a checkpoint. By clicking the .. beside this option, it will open the file system to select or create a new file.
  • CheckpointUsage: This property has three options:
    • Never: Package will not use the Checkpoint.
    • IfExists: Package will look for the checkpoint information, and if there is any information, it uses that information. If not, it skips using it. It is a common option in most cases.
    • Always: Package will always look for the checkpoint information, and use that information. If it doesn’t have the information, it will throw an error.
  • SaveCheckpoint: Choose whether you want to save the checkpoint or not.
Checkpoints in SSIS Example 12

We are creating a new file called SSIS Checkpoints in the D folder to save the checkpoint information.

Checkpoints in SSIS Example 13

Next, we selected the most common CheckpointUsage property, i.e., IfExists.

Checkpoints in SSIS Example 14

Next, we changed the Save Checkpoints option from default False to True.

Checkpoints in SSIS Example 15

Before we start executing the SSIS checkpoints package, we have to change one more property called FailPackgaeOnFailure of all the tasks in the Control Flow region. First, let me select the Data Flow Task and change the property value from False to True.

Checkpoints in SSIS Example 16

Next, select the Execute SQL Task and change the property value from False to True.

Checkpoints in SSIS Example 17

Now let me run the SSIS checkpoints package.

Checkpoints in SSIS Example 18

As you see, SSIS has created a file with checkpoint information

Checkpoints in SSIS Example 19

Next, let me correct the query in Execute SQL Task

Checkpoints in SSIS Example 20

Let me run the SSIS checkpoints package. As you can see from the below screenshot, executed started directly at the Execute SQL Task (Previously stopped position)

Checkpoints in SSIS Example 21

Let me show you the Data Flow region as well.

Checkpoints in SSIS Example 22

Lastly, Please open the SQL Server Management Studio to check the result.

Checkpoints in SSIS Example 23

Comments are closed.