Skip to content

2.2.1 Migrating from MS SQL to MongoDB using SSIS

Gs1TestTeam edited this page Jan 9, 2019 · 1 revision

2.2.1 Migrating from MS-SQl to MongoDB using SSIS.

Data Migration using SSIS

We can use SSIS to migrate data from SQL Server to MongoDB.

Steps to follow for Migration:

Prerequisite: Must have Visual Studio 2017 installed.

How to create a SSIS Package for Migration

  • Open Visual Studio.
  • Click on File > New > Project
  • Select Business Intelligence > Integration Services from the left Pane.

SSIS Package

  • Create a Data Flow. Add "OLE DB Source" from the left pane (Drag + Drop).

Data Flow

  • Add "ZS MongoDB Destination" from the left pane (Drag + Drop).

Data Flow Destination

  • Edit OLE DB Source properties and add source database/table to fetch data.

    • Add a "New" Server.
    • If it is a local server, hosted locally on your workstation use Windows Authentication else use SQL Server Authentication for different Accounts for remote connections.

    Add Server

Add Data Base

  • After we have completed adding the Server, Selecting the database and table from which the data has to be migrated, we can now feed the output to MongoDB destination as follows.

Feeding Output to Mongo

  • Editing ZS(Zappy's Sys) MongoDB Destination.
    • Add a "New Connection" for MongoDB.
      MongoDB Connection
    • Edit the Connction property Accordingly.
      Edit MongoDb Connection
    • Edit Connection properties. Select newly created MongoDb Connection from drop down.
      Add MongoDB
    • Edit Component properties and add the Mongo Table in which we want to Import the data.
      Add Table
    • Lastly, match/map the Source and Destination Columns.
      Map Columns

How to migrate Parent-Child data from RDB to MongoDB using ZappySys compents.

  • Contains folowing components:
    • Add Multiple RDBMS Source.
    • Add & Merge Join component for performing JOINS on the RDBMS tables.
    • Add a ZS JSON Generator Transform component for creating a JSON Document from the output of the Merge.
    • Finally, Add a MongoDB Component and Feed the Data to MongoDB Collection.

Layout of the Package.
SSIS Package

Step-by-Step Procedure to follow

  1. Create an Integration Services package using Visual Studio Follow How to create a SSIS Package for Migration.

  2. Do the following under the "Data Flow" tab in the Designer Pane:

    1. Add Parent and Child table Data Source - OLE DB Source.
      Parent/Child Data Source

    2. Right Click to view "Advance Editor" and edit the "Input/output Properties" and make the IsSorted field True for both Parent and Child.
      Edit Property 1 Edit Property 2

    3. Add a Merger Join Component. You can use anytype of joins to get the results.
      Merge Join

    4. Add a JSON Generator Transform component to convert the data into JSON format to later feed it to MongoDB Destination.

      JSON Generator Transform

      • Create Parent and Child elements. Remember to change Output Mode According to your need maerked with Number 1 on the screen shot.

      ADD JSON

    5. Finally, Add MongoDB Destination.