In this article, we will show you, How to Move Data from SQL Server to another in Informatica with an example. For this example, we are going to use the below show data (Customers table)
and the Destination table is Duplicate Cust. As you can see, it is an Empty table
Move Data from SQL Server to another in Informatica
Before we start configuring the Informatica to Move Data from one SQL Server Database to another database. First, connect to Informatica repository service by providing the Informatica Admin Console credential.
TIP: Here you have to provide the Admin Username and password that you specified while installing the Informatica Server.
Step 1: Create a Source Definition
Once you connected successfully, Please navigate to Source Analyzer to define your Sources. As we said before, we are using Customers table from SQL Server database as our source definitions. So, go to the Source menu and select the Import from Database.. option as shown below.
Please select the ODBC connection that will connect the Informatica with the SQL Tutorial Database. In order to create a new one, please refer Informatica ODBC Connection article.
From the below screenshot you can observe that we are selecting the Customers table from our SQL Tutorial database.
This will add the table definition (Column Names and appropriate data types) inside our workspace under the Source Analyzer. Please refer Database Source to understand the creation of source definition
Step 2: Create Target Definition
Please navigate to Target Designer to define the Target. In this example, we are using the existing SQL table as our target definition. So, go to the Targets menu and select the Import from Database.. option as shown below.
Please select the ODBC connection that will connect the Informatica with the SQLTest Database. In order to create a new one, please refer the Informatica ODBC Connection article.
From the below screenshot you can observe that we are selecting the DeplicateCust table from our SQLTest database. You can refer to Create Target table using Source Definition to understand the process of creating a target definition
Step 3: Create Mapping to move data from one Database to another
To create a new mapping, Please navigate to Mappings menu in Menu Bar and select the Create.. option.
This will open the Mapping Name window to write a unique name for this mapping. Let me write m_move_data_from_SQL_to_sql and click OK button.
TIP: Please refer Informatica Mapping article to understand the procedure for creating Mapping
Drag and drop the Customers source definitions from Sources folder to the mapping designer. Once you drag the source, Power Center designer will automatically create the source qualifier for you. I suggest you refer Source Qualifier Transformation article
Next, Drag and drop the target definition from Targets folder to the mapping designer. Next, connect the source qualifier with the target definition. Please use the Autolink.. option to connect them.
Before we close the Mapping, Let us Save, and Validate the mapping by going to Mapping Menu bar, and select the Validate option.
Step 4: Create a Workflow to move data from one SQL Server to another
After we finish creating the Mapping, we have to create the workflow for it. Power Center Workflow manager provides two approaches to create a workflow.
In this example, we will create the Workflow manually. To do so, Please navigate to Workflows Menu and select the Create option.
This will open Create Workflow window as shown below. Please provide the unique name (wf_move_from_SQL_to_SQL) and leave the default settings.
This will create a Workflow for you
Once we created the workflow, our next step is to create a session task for our mapping.
Step 4(a): Create Session to move data from one Database to another Database
There are two types of sessions in Informatica:
- Non-reusable Session Task: Please refer Session in Informatica article.
- Reusable Session in Informatica
For this example, we created a Non-reusable Session. In order to create Non-reusable Session, Please navigate to Tasks Menu and select the Create option as shown below.
Name it as s_move_data_from_sql_to_SQL.
Once you click on the Create button, a new window called Mappings will be opened. Here you have to select the mapping that you want to associate with this session.
Please link the Start Task, and the Session Task.
Double click on the Session task will open the Edit Tasks window. Within Properties Tab, we have two 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, click on the Arrow we marked below, and select the SQL Tutorial as the source information.
$Target connection value: This property will store the relational target information in $Target variable. So, click on the Arrow we marked below, and select the SQL Test target as the Target information.
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 SQ_Customers source present in the Sources folder.
Within the Connections, click on the Arrow button beside the Relational type, and use the Connection variable that we created in our previous step i.e., $Source
Now, we have to configure the Target Connection. So, let us configure the target connection by clicking on the DuplicateCust present in the Targets folder.
Within the Connections, click on the Arrow button beside the Relational type, and use the Connection variable that we created in our previous step i.e., $Target
We are changing the Target Load Type to Normal.
Next, navigate to Workflows Menu and select the Validate option to validate the Workflow. Now, Let me start the Workflow. To do so, navigate to the Workflows menu, and select the Start Workflow option.
Once you select the Start Workflow option, Informatica PowerCenter Workflow monitor will be opened to monitor the workflow. From the below screenshot you can observe that our workflow is executed without any errors.
Let us open the SQL Server Management Studio to check whether we successfully transfer the data from a source or not.
Thank You for visiting Our Blog