nate locklin ◦ database analyst, ppg industries ◦ [email protected]@locklin.org steve tirone...

26
Three Best Practices with SSIS

Upload: gwendolyn-jennings

Post on 28-Dec-2015

223 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Nate Locklin ◦ Database Analyst, PPG Industries ◦ nate@locklin.orgnate@locklin.org Steve Tirone ◦ Data Warehouse Analyst, Amerinet ◦ stephen.tirone@gmail.comstephen.tirone@gmail.com

Three Best Practices with SSIS

Page 2: Nate Locklin ◦ Database Analyst, PPG Industries ◦ nate@locklin.orgnate@locklin.org Steve Tirone ◦ Data Warehouse Analyst, Amerinet ◦ stephen.tirone@gmail.comstephen.tirone@gmail.com

Nate Locklin◦ Database Analyst, PPG Industries◦ [email protected]

Steve Tirone◦ Data Warehouse Analyst, Amerinet◦ [email protected]

About Us

Page 3: Nate Locklin ◦ Database Analyst, PPG Industries ◦ nate@locklin.orgnate@locklin.org Steve Tirone ◦ Data Warehouse Analyst, Amerinet ◦ stephen.tirone@gmail.comstephen.tirone@gmail.com

Survey:◦ What is SSIS?◦ Use it occasionally◦ Use it every day◦ I wrote the book on advanced SSIS

Given that we didn’t know, we wanted to present something generally useful, hence◦ “Three best practices to keep in mind when

developing and deploying SSIS packages”

SSIS Experience?

Page 4: Nate Locklin ◦ Database Analyst, PPG Industries ◦ nate@locklin.orgnate@locklin.org Steve Tirone ◦ Data Warehouse Analyst, Amerinet ◦ stephen.tirone@gmail.comstephen.tirone@gmail.com

Open BIDS (Business Intelligence Development Studio)

Available in VS2005, VS2008, but not VS2010 (yet)

Incidentally, the Import/Export wizard in Management Studio runs SSIS under the hood

First, a Baseline Intro

Page 5: Nate Locklin ◦ Database Analyst, PPG Industries ◦ nate@locklin.orgnate@locklin.org Steve Tirone ◦ Data Warehouse Analyst, Amerinet ◦ stephen.tirone@gmail.comstephen.tirone@gmail.com

Several tabs at the top◦ Control Flow: your top level workflow workspace◦ Data Flow: details of data transfer operations◦ Event Handlers: where you can handle raised

events ◦ Package Explorer: like a site map of your package

Start by dragging Tasks to your Control tab Most commonly used tasks are probably:

◦ Data Flow◦ Execute SQL

Constructing your Package

Page 6: Nate Locklin ◦ Database Analyst, PPG Industries ◦ nate@locklin.orgnate@locklin.org Steve Tirone ◦ Data Warehouse Analyst, Amerinet ◦ stephen.tirone@gmail.comstephen.tirone@gmail.com

Let’s import the DJIA stock prices◦ downloaded from Yahoo Finance into an Excel

spreadsheet

Quick Example

Page 7: Nate Locklin ◦ Database Analyst, PPG Industries ◦ nate@locklin.orgnate@locklin.org Steve Tirone ◦ Data Warehouse Analyst, Amerinet ◦ stephen.tirone@gmail.comstephen.tirone@gmail.com

Demo: Quick Package

Page 8: Nate Locklin ◦ Database Analyst, PPG Industries ◦ nate@locklin.orgnate@locklin.org Steve Tirone ◦ Data Warehouse Analyst, Amerinet ◦ stephen.tirone@gmail.comstephen.tirone@gmail.com

Two often used log providers◦ Text Files◦ SQL Server (sysssislog in 2008, sysdtslog90 in

2005) – created when first used Many events possible to log

◦ OnError and OnTaskFail events most common◦ Can reduce detail to Computer, Source, and

Message◦ Here you will find all the error messages:

http://msdn.microsoft.com/en-us/library/ms345164.aspx

Best Practice #1: Logging

Page 9: Nate Locklin ◦ Database Analyst, PPG Industries ◦ nate@locklin.orgnate@locklin.org Steve Tirone ◦ Data Warehouse Analyst, Amerinet ◦ stephen.tirone@gmail.comstephen.tirone@gmail.com

Demo: Logging

Page 10: Nate Locklin ◦ Database Analyst, PPG Industries ◦ nate@locklin.orgnate@locklin.org Steve Tirone ◦ Data Warehouse Analyst, Amerinet ◦ stephen.tirone@gmail.comstephen.tirone@gmail.com

Properties of objects can be changed at run-time

No need to change the package itself to promote from test to production◦ Connection string is all that’s needed to change

Several formats:◦ XML configuration file most commonly used

Best Practice #2: Configurations

Page 11: Nate Locklin ◦ Database Analyst, PPG Industries ◦ nate@locklin.orgnate@locklin.org Steve Tirone ◦ Data Warehouse Analyst, Amerinet ◦ stephen.tirone@gmail.comstephen.tirone@gmail.com

Demo: Configurations

Page 12: Nate Locklin ◦ Database Analyst, PPG Industries ◦ nate@locklin.orgnate@locklin.org Steve Tirone ◦ Data Warehouse Analyst, Amerinet ◦ stephen.tirone@gmail.comstephen.tirone@gmail.com

Checkpoints let a package start where it left off previously, such as when an error occurs in the middle of your package◦ Lets you fix the error, then restart the package,

without it re-running the parts already done

Best Practice #3: Checkpoints

Page 13: Nate Locklin ◦ Database Analyst, PPG Industries ◦ nate@locklin.orgnate@locklin.org Steve Tirone ◦ Data Warehouse Analyst, Amerinet ◦ stephen.tirone@gmail.comstephen.tirone@gmail.com

Set the following properties of the Package◦ CheckpointFileName = <some name>◦ CheckpointUsage = IfExists◦ SaveCheckpoints = True

Set the following properties on all the tasks:◦ FailPackageOnFailure = True

Setting up for Checkpoints

Page 14: Nate Locklin ◦ Database Analyst, PPG Industries ◦ nate@locklin.orgnate@locklin.org Steve Tirone ◦ Data Warehouse Analyst, Amerinet ◦ stephen.tirone@gmail.comstephen.tirone@gmail.com

Demo: Checkpoints

Page 15: Nate Locklin ◦ Database Analyst, PPG Industries ◦ nate@locklin.orgnate@locklin.org Steve Tirone ◦ Data Warehouse Analyst, Amerinet ◦ stephen.tirone@gmail.comstephen.tirone@gmail.com

Most importantly: ◦ “A package can be restarted only at the control

flow level. You cannot restart a package in the middle of a data flow.”

Also:◦ “When a package is restarted the Foreach Loop

containers and its child containers are run again. If a child container in the loop runs successfully, it is not recorded in the checkpoint file, instead it is rerun.”

Checkpoint Caveats

Page 16: Nate Locklin ◦ Database Analyst, PPG Industries ◦ nate@locklin.orgnate@locklin.org Steve Tirone ◦ Data Warehouse Analyst, Amerinet ◦ stephen.tirone@gmail.comstephen.tirone@gmail.com

RetainSameConnection◦ Using lots of connections? Use this, please!◦ Can be found as a property of the Connection Mgr

Packet size◦ Consider increasing (32,767) for larger data

Row Per Batch Size◦ Sometimes speed is enhanced when setting the

“Rows per batch” to something other than blank, like 1000, 5000 or 10,000 (particularly when run through BIDS over the network)

Other Design Considerations

Page 17: Nate Locklin ◦ Database Analyst, PPG Industries ◦ nate@locklin.orgnate@locklin.org Steve Tirone ◦ Data Warehouse Analyst, Amerinet ◦ stephen.tirone@gmail.comstephen.tirone@gmail.com

Property of the Connection Manager

Retain Same Connection

Page 18: Nate Locklin ◦ Database Analyst, PPG Industries ◦ nate@locklin.orgnate@locklin.org Steve Tirone ◦ Data Warehouse Analyst, Amerinet ◦ stephen.tirone@gmail.comstephen.tirone@gmail.com

On All page of the Connection Manager

Packet Size

Page 19: Nate Locklin ◦ Database Analyst, PPG Industries ◦ nate@locklin.orgnate@locklin.org Steve Tirone ◦ Data Warehouse Analyst, Amerinet ◦ stephen.tirone@gmail.comstephen.tirone@gmail.com

Package protection level

Default is Encrypt with User Key, but you want Encrypt with Password (all or sensitive)

Deployment Considerations

Page 20: Nate Locklin ◦ Database Analyst, PPG Industries ◦ nate@locklin.orgnate@locklin.org Steve Tirone ◦ Data Warehouse Analyst, Amerinet ◦ stephen.tirone@gmail.comstephen.tirone@gmail.com

Know your environment (64 bit vs 32 bit)◦ Might get

[Connection manager "Excel Connection Manager 1"] Error: SSIS Error Code DTS_E_OLEDB_EXCEL_NOT_SUPPORTED: The Excel Connection Manager is not supported in the 64-bit version of SSIS, as no OLE DB provider is available.

◦ Or Class not registered

The 64 bit issue may be addressed by telling Integration Services to use 32 bit runtime

Deployment Considerations

Page 21: Nate Locklin ◦ Database Analyst, PPG Industries ◦ nate@locklin.orgnate@locklin.org Steve Tirone ◦ Data Warehouse Analyst, Amerinet ◦ stephen.tirone@gmail.comstephen.tirone@gmail.com

In the SQL Agent job step:

64/32 bit Options

Page 22: Nate Locklin ◦ Database Analyst, PPG Industries ◦ nate@locklin.orgnate@locklin.org Steve Tirone ◦ Data Warehouse Analyst, Amerinet ◦ stephen.tirone@gmail.comstephen.tirone@gmail.com

Property of the PROJECT:

64/32 bit Options (BIDS)

Page 23: Nate Locklin ◦ Database Analyst, PPG Industries ◦ nate@locklin.orgnate@locklin.org Steve Tirone ◦ Data Warehouse Analyst, Amerinet ◦ stephen.tirone@gmail.comstephen.tirone@gmail.com

Great flexibility in error handling if you “program” the OnError handler

Error Handling

Page 24: Nate Locklin ◦ Database Analyst, PPG Industries ◦ nate@locklin.orgnate@locklin.org Steve Tirone ◦ Data Warehouse Analyst, Amerinet ◦ stephen.tirone@gmail.comstephen.tirone@gmail.com

Implement Logging Use Configuration Files for flexibility Checkpoints can be useful Know your environment Keep small design considerations in mind

Summary

Page 25: Nate Locklin ◦ Database Analyst, PPG Industries ◦ nate@locklin.orgnate@locklin.org Steve Tirone ◦ Data Warehouse Analyst, Amerinet ◦ stephen.tirone@gmail.comstephen.tirone@gmail.com

Nate Locklin◦ Database Analyst, PPG Industries◦ [email protected]

Steve Tirone◦ Data Warehouse Analyst, Amerinet◦ [email protected]

Slides are at http://tinyurl.com/SSISBestPractices

Questions?

Page 26: Nate Locklin ◦ Database Analyst, PPG Industries ◦ nate@locklin.orgnate@locklin.org Steve Tirone ◦ Data Warehouse Analyst, Amerinet ◦ stephen.tirone@gmail.comstephen.tirone@gmail.com

Future BI Topics?◦ Integration Services (SSIS)◦ Reporting Services (SSRS)◦ Analysis Services (SSAS)

SQL Saturday?◦ BI Edition?◦ Volunteers to help coordinate?

Email Gina or Steve

Another Survey! Yeah!