17 May 2014

SSIS (Sql Server Integration Service)

SSIS Package Stands for Sql server Integration service and is part of the Microsoft Business Intelligence Stack. It is included in version 2005,2008 and 2008 r2 .Previous version of SSIS  was called as DTS Package which was included in sql server 2000

This  is a tool to create ETL (Extract, Transform, Load) process and as the name suggest the purpose of it is to extract data from source system (or multiple source systems) this can database, excel files, text files. Then it performs transformation which just means you can apply certain business rules to the data or clean it

for instance you can clean customer address or group together customers which are the same person. The final step is load and it is loading the data into final destination which is usually a data warehouses database.

So the package contains all the information (in XML format with file extension .dtsx) which are then used my SQL Server Integration Service Engine which perform the actual actions specified. (You can also run it using SSIS designer which I will discuss next).
 
To  develop a package to move data than in most cases you will use Visual Studio more precisely BIDS (Business Intelligence Development Studio). In BIDS you will be able to create new SSIS Project and create a package. 


You can execute SSIS package from BIDS (usually for testing or one-off tasks), you can also execute it as a job (or scheduled job) and execute it from stored procedure or another file (using dtexec.exe)



Connection Managers

SSIS uses connection managers to integrate different data sources into packages. SSIS includes a wide variety of different connection managers that allow you to move data around from place to place. Table 16-1 lists the available connection managers.



Connection Manager
Handles
ADO
Connecting to ADO objects such as a Recordset.
ADO.NET
Connecting to data sources through an ADO.NET provider.
CACHE
Connects to a cache either in memory or in a file
MSOLAP100
Connecting to an Analysis Services database or cube.
EXCEL
Connecting to an Excel worksheet.
FILE
Connecting to a file or folder.
FLAT FILE
Connecting to delimited or fixed width flat files.
FTP
Connecting to an FTP data source.
HTTP
Connecting to an HTTP data source.
MSMQ
Connecting to a Microsoft Message Queue.
MULTI FILE
Connecting to a set of files, such as all text files on a particular hard drive.
MULTIF LATFILE
Connecting to a set of flat files.
ODBC
Connecting to an ODBC data source.
OLEDB
Connecting to an OLE DB data source.
SMOSever
Connecting to a server via SMO.
SMTP
Connecting to a Simple Mail Transfer Protocol server.
Sql Mobile
Connecting to a SQL Server Mobile database.
WMI
Connecting to Windows Management Instrumentation 

To create a Connection Manager, you right-click anywhere in the Connection Managers area of a package in BIDS and choose the appropriate shortcut from the shortcut menu. Each Connection Manager has its own custom configuration dialog box with specific options that you need to fill out.


Steps to Use Connection Manager 

Control Flow:


The Control Flow tab of the Package Designer is where you tell SSIS what the package will do. You create your control flow by dragging and dropping items from the toolbox to the surface, and then dragging and dropping connections between the objects. The objects you can drop here break up into four different groups:

Tasks are things that SSIS can do, such as execute SQL statements or transfer objects from one SQL Server to another. Table 16-2 lists the available tasks.

Maintenance Plan tasks are a special group of tasks that handle jobs such as checking database integrity and rebuilding indexes. Table 16-3 lists the maintenance plan tasks.

The Data Flow Task is a general purpose task for ETL (extract, transform, and load) operations on data. There's a separate design tab for building the details of a Data Flow Task.
Containers are objects that can hold a group of tasks.

                                       Lists the available containers.



         Task
Purpose
ActiveX Script
Execute an ActiveX Script
Analysis Services Execute DDL
Execute DDL query statements against an Analysis Services server
Analysis Services Processing
Process an Analysis Services cube
Bulk Insert
Insert data from a file into a database
Data Mining Query
Execute a data mining query
Data Profiling Task
Generate a profile of sample data, determining distribution of values or percentage of NULLs, etc.
Execute DTS 2000 Package
Execute a Data Transformation Services Package (DTS was the SQL Server 2000 version of SSIS)
Execute Package
Execute an SSIS package
Execute Process
Shell out to a Windows application
Execute SQL
Run a SQL query
File System
Perform file system operations such as copy or delete
FTP
Perform FTP operations
Message Queue
Send or receive messages via MSMQ
Script
Execute a custom task
Send Mail
Send e-mail
Transfer Database
Transfer an entire database between two SQL Servers
Transfer Error Messages
Transfer custom error messages between two SQL Servers
Transfer Jobs
Transfer jobs between two SQL Servers
Transfer Logins
Transfer logins between two SQL Servers
Transfer Master Stored Procedures
Transfer stored procedures from the master database on one SQL Server to the master database on another SQL Server
Transfer SQL Server Objects
Transfer objects between two SQL Servers
Web Service
Execute a SOAP Web method
WMI Data Reader
Read data via WMI
WMI Event Watcher
Wait for a WMI event
XML
Perform operations on XML data
Table 16-2: SSIS control flow tasks
Task
Purpose
Back Up Database
Back up an entire database to file or tape
Check Database Integrity
Perform database consistency checks
Execute SQL Server Agent Job
Run a job
Execute T-SQL Statement
Run any T-SQL script
History Cleanup
Clean out history tables for other maintenance tasks
Maintenance Cleanup
Clean up files left by other maintenance tasks
Notify Operator
Send e-mail to SQL Server operators
Rebuild Index
Rebuild a SQL Server index
Reorganize Index
Compacts and defragments an index
Shrink Database
Shrinks a database
Update Statistics
Update statistics used to calculate query plans

SSIS maintenance plan tasks
Container
Purpose
For Loop
Repeat a task a fixed number of times
For-each Loop
Repeat a task by enumerating over a group of objects
Sequence
Group multiple tasks into a single unit for easier management

Creating Events handlers:
SSIS packages also support a complete event system. You can attach event handlers to a variety of events for the package itself or for the individual tasks within a package. Events within a package "bubble up." That is, suppose an error occurs within a task inside of a package. If you've defined an On Error event handler for the task, then that event handler is called. Otherwise, an On Error event handler for the package itself is called. If no event handler is defined for the package either, the event is ignored.
Event handlers are defined on the Event Handlers tab of the Package Designer. When you create an event handler, you handle the event by building an entire secondary SSIS package, and you have access to the full complement of data flows, control flows, and event handlers to deal with the original event.

Note: By adding event handlers to the On Error event that call the Send Mail task, you can notify operators by e-mail if anything goes wrong in the course of running an SSIS package.


Saving and Running Packages:
Now that you've created an entire SSIS package, you're probably ready to run it and see what it does. But first, let's look at the options for saving SSIS packages. When you work in BIDS, your SSIS package is saved as an XML file (with the extension dtsx) directly in the normal Windows files system. But that's not the only option. Packages can also be saved in the msdb database in SQL Server itself, or in a special area of the file system called the Package Store.
Storing SSIS packages in the Package Store or the msdb database makes it easier to access and manage them from SQL Server's administrative and command-line tools without needing to have any knowledge of the physical layout of the server's hard drive.

Steps for Running Package
Saving Packages to Alternate Locations
To save a package to the msdb database or the Package Store, you use the File > Save Package As menu item within BIDS.
To store copies of the package you've developed, follow these steps.
  • Select File > Save Copy of Package.dtsx As from the BIDS menus.
  • Select SSIS Package Store as the Package Location.
  • Select the name of your test server.
  • Enter /File System/ExportDepartments as the package path.
  • Click OK.
  • Select File > Save Copy of Package.dtsx As from the BIDS menus.
  • Select SQL Server as the Package Location.
  • Select the name of your test server and fill in your authentication information.
  • Enter ExportDepartments as the package path.
  • Click OK.

No comments:

Post a Comment