A Session in Informatica is a set of instructions that tells the Informatica Integration Service when and how to move data from source to target.
In Informatica, we have to create a session task for each and every mapping because the mapping is just a structural definition and session will actually move data from source to destination. There are two types of sessions in Informatica:
- Non-reusable Session Task: Session Task that we created in Workflow Designer is non-reusable.
- Reusable Session Task: Session Task that we created in Task Developer is reusable
NOTE: Before you create a Non-reusable Session in Informatica, we must configure the Workflow manager to communicate with databases and Integration services.
In this article, we will show you, How to create Non-reusable Session in Informatica with an example. For this example, we are going to use the Mapping that we created in our previous article. You can refer to the Informatica Mapping article for further reference
Create Session in Informatica
Creating Non-reusable Session in Informatica follows three steps so you have to follow the same procedure:
- Step 1: Configuring the Source and Destination connection. In this example, we are a connection to SQL Server Relational Database.
- Step 2: Creating a Workflow manager to communicate with Informatica integration services
- Step 3: Creating Session in Informatica
First, connect to the Informatica repository service. In order to connect with Repository service we have to provide the Informatica Admin Console credentials so, Please provide the appropriate Username and Password and click on Connect button as shown below.
From the below screenshot you can observe that we are in the Task Developer.
Configuring the Source and Destination connection
Before we start creating Session in Informatica we have to configure the relational database connections. In order to do this, Please navigate to Connections Menu and select the Relational option as shown below.
Once you select on the Relational option, a new window called Relational Connection Browser will be opened as shown below. This will help us to create a connection to our relational database.
For this example, we are using the SQL as our source database that’s why we are selecting the Microsoft SQL Server as the Select Type
From the below screenshot you can observe that currently, we don’t have any relational connections. In order to create a new one, please click on the New button as we shown below.
Once you click on the New button, a new window called Connection Object Definition will be opened as shown below.
- Name: Please specify the unique name for this connection.
- Username: You have to specify the username to connect with database.
- Password: Here you have to provide the password of the above-mentioned user.
- Database Name: Please specify the name of a database you are going to use. For this example, we are using AdventureWorksDW2014.
- Server name: Here you have to write your server instance name.
Click Ok button after you fill the details
We need to create one more connection string for our target database. Although we can create using the above-mentioned steps we want to copy the above connection using the Copy As.. option.
This will open the connection Object definition window for the target so, please specify the connection name, database name and the remaining details.
NOTE: Once we configured the database connections, we have to create a workflow within the workflow manager. We will explain this in our next article.
Non-reusable Session in Informatica
In order to create Non-reusable Session in Informatica, Please navigate to Tasks Menu and select the Create option as shown below.
Next, you have to enter a New name for this non-reusable session task. Here we assigned the name as s_DimProducts_from_SQL_to_SQL
Once you click on the Create button, a new window called Mappings will be opened. Here we have to select the mapping you want to associate with this session. From the below screenshot you can observe that currently, we have only one mapping so we are selecting it.
TIP: Please refer Informatica Mapping article to understand the data transformation in below specified mapping m_DimProducts_from_SQL_to_SQL
Our newly created session task is added to the Workflow Manager. Before we adding or linking to the Informatica Workflow, we have to change few properties and configure the connection strings of a Source and target. In order to do so, Please double-click on our session task
Double click on the Session task will open the following window. Within the General Tab, we can rename the Session Task to a more meaningful name. Please do not forget to provide a valid description of the Task.
Fail Parent if this task fails: Please check mark this option. if this session task fails then it will fail the workflow.
Within Properties Tab, we have three common properties that we have to configure for the relational databases.
$Source connection value: This property will store the relational source information in $Source variable. So, we have to configure the source connection by clicking on the Arrow we marked below.
Once you click on the Arrow, a new window called Connection Browser will be opened as shown below. Since we are using the SQL as our source database, we are selecting the Microsoft SQL Server as the Select Type. Next, we are selecting the already created connection i.e, AdventureWorksDW
TIP: If you want to create a new connection before then, you can use the New button.
$Target connection value: This property will store the relational target information in $Target variable. So, we have to configure the target connection by clicking on the Arrow we marked below.
For this example, we are using the SQL database as the destination so, we selected the Microsoft SQL Server as the Select Type and Informatica target as the Destination database name
Write backward Compatible Session Log File: If you check mark this option then, Informatica will generate the session file in text format so that we can review it later otherwise, it will generate only binary format.
Within the Config Object, we have to configure the Log options and Error handling. Although we have many properties, we are discussing and configuring the most common properties within this window.
- Save Session log for these runs: Please specify the integer number here. For example, if you specify 3 then last three sessions will be saved to our session log file
- Stop on Errors: Please specify, how many errors you want the session to tolerate. For example, if you specify 3 then the session will run until it encounters three errors.
Within the mappings tab, we have to configure the Source, target Connections and some common properties. First, let us configure the source connections by clicking on the Dimproducts source present in the Sources folder.
Within the Connections, select the Arrow button beside the relational type to open the Relational Connection Browser as shown below. This window will help you to configure the source connections (creating new, modifying etc).
Here, we are using the Connection variable that we created in our previous step i.e., $Source
Now, let us configure the target connections by clicking on the Target_Dimproducts present in the Targets folder.
Within the Connections, select the Arrow button beside the relational type to open the Relational Connection Browser as shown below. Here, we are using the Connection variable that we created in our previous step i.e., $Target
TIP: You can also select the Use Object option and select the Database name also.
Within the Target properties, we have to configure two common properties and they are:
Target Load Type: If your target table has indexes then use the Normal type otherwise, Bulk type. Remember, the bulk type will insert the data faster than Normal but it does not work on indexed tables.
Truncate target table option: By check marking this option will truncate the existing data from the destination table. This will help us to insert fresh data for every successful run.
Once you finished creating the Informatica session task, we have to Link the workflow with the Session Task.
Thank You for Visiting Our Blog