Dr Greg Low Senior Consultant – Readify Pty Ltd DAT302.
-
Upload
meryl-paul -
Category
Documents
-
view
221 -
download
0
Transcript of Dr Greg Low Senior Consultant – Readify Pty Ltd DAT302.
![Page 1: Dr Greg Low Senior Consultant – Readify Pty Ltd DAT302.](https://reader035.fdocuments.us/reader035/viewer/2022062304/56649d985503460f94a82b5d/html5/thumbnails/1.jpg)
![Page 2: Dr Greg Low Senior Consultant – Readify Pty Ltd DAT302.](https://reader035.fdocuments.us/reader035/viewer/2022062304/56649d985503460f94a82b5d/html5/thumbnails/2.jpg)
Database Schema Versioning with Microsoft Visual Studio Team System for Database Professionals
Dr Greg LowSenior Consultant – Readify Pty Ltd
DAT302
![Page 3: Dr Greg Low Senior Consultant – Readify Pty Ltd DAT302.](https://reader035.fdocuments.us/reader035/viewer/2022062304/56649d985503460f94a82b5d/html5/thumbnails/3.jpg)
Who am I?
Senior Consultant ReadifyHost of SQL Down Under PodcastMicrosoft MSDN Regional DirectorMicrosoft MVP for SQL ServerCo-organizer of CodeCampOzOrganizer of SQL Down Under CodeCampAuthor with Rational Press
![Page 4: Dr Greg Low Senior Consultant – Readify Pty Ltd DAT302.](https://reader035.fdocuments.us/reader035/viewer/2022062304/56649d985503460f94a82b5d/html5/thumbnails/4.jpg)
Introduction to Visual Studio Team Edition for Database Professionals (aka DataDude)
The Project System
Unit Tests
Session Objectives and Agenda
Building and Deploying
What’s Coming Next?
![Page 5: Dr Greg Low Senior Consultant – Readify Pty Ltd DAT302.](https://reader035.fdocuments.us/reader035/viewer/2022062304/56649d985503460f94a82b5d/html5/thumbnails/5.jpg)
Project Based Development
Disconnected Project ModelVisual Studio basedTeam Collaboration via TFS
Work Item TrackingProcess Integration
![Page 6: Dr Greg Low Senior Consultant – Readify Pty Ltd DAT302.](https://reader035.fdocuments.us/reader035/viewer/2022062304/56649d985503460f94a82b5d/html5/thumbnails/6.jpg)
Automated Change Support
Comparison ToolsSchemaData
Source/Version ControlRefactoring
Limited as yetRename ObjectPower Tools add more
![Page 7: Dr Greg Low Senior Consultant – Readify Pty Ltd DAT302.](https://reader035.fdocuments.us/reader035/viewer/2022062304/56649d985503460f94a82b5d/html5/thumbnails/7.jpg)
Unit Testing
VSTS Test Project InfrastructureData Generation
Auto-generationHistogram-basedUnderstands foreign key relationships
ExtensibleData GeneratorsTest Assertions
![Page 8: Dr Greg Low Senior Consultant – Readify Pty Ltd DAT302.](https://reader035.fdocuments.us/reader035/viewer/2022062304/56649d985503460f94a82b5d/html5/thumbnails/8.jpg)
Build / Deployment
MSBuild IntegrationCreate New DBUpdate an Existing Schema
![Page 9: Dr Greg Low Senior Consultant – Readify Pty Ltd DAT302.](https://reader035.fdocuments.us/reader035/viewer/2022062304/56649d985503460f94a82b5d/html5/thumbnails/9.jpg)
Introduction to Visual Studio Team Edition for Database Professionals (aka DataDude)
The Project System
Unit Tests
Session Objectives and Agenda
Building and Deploying
What’s Coming Next?
![Page 10: Dr Greg Low Senior Consultant – Readify Pty Ltd DAT302.](https://reader035.fdocuments.us/reader035/viewer/2022062304/56649d985503460f94a82b5d/html5/thumbnails/10.jpg)
What is the source of truth?
![Page 11: Dr Greg Low Senior Consultant – Readify Pty Ltd DAT302.](https://reader035.fdocuments.us/reader035/viewer/2022062304/56649d985503460f94a82b5d/html5/thumbnails/11.jpg)
Database Development Life Cycle
DatabaseProject
Import database schema
Reverse engineer existing .SQL script files
Create New Project
SQLScript
Database
ProjectTemplat
e
SQLServer
Database
Collection of .SQL file
containing T-SQL DDL fragments
![Page 12: Dr Greg Low Senior Consultant – Readify Pty Ltd DAT302.](https://reader035.fdocuments.us/reader035/viewer/2022062304/56649d985503460f94a82b5d/html5/thumbnails/12.jpg)
Offline Schema Model
Parsing = SqlCodeDombased on Abstract Syntax Trees
Interpretation of Schema ModelSymbol listObject References (hard and soft dependencies)
.SQL Source
Parse
SqlCodeDom
Interpret
Schema Model
![Page 13: Dr Greg Low Senior Consultant – Readify Pty Ltd DAT302.](https://reader035.fdocuments.us/reader035/viewer/2022062304/56649d985503460f94a82b5d/html5/thumbnails/13.jpg)
Database Development Life Cycle
DatabaseProject
Edit
Compare
Test
Build
Data Generation
Deploy
Refactor
Compare
![Page 14: Dr Greg Low Senior Consultant – Readify Pty Ltd DAT302.](https://reader035.fdocuments.us/reader035/viewer/2022062304/56649d985503460f94a82b5d/html5/thumbnails/14.jpg)
Database Development Life Cycle
DatabaseProject
Import database schema
Reverse engineer existing .SQL script files
Create New Project
SQLScript
Database
ProjectTemplat
e
SQLServer
Database
DeploySQL
Script
SQLServer
Database
Build project
Deploy project
![Page 15: Dr Greg Low Senior Consultant – Readify Pty Ltd DAT302.](https://reader035.fdocuments.us/reader035/viewer/2022062304/56649d985503460f94a82b5d/html5/thumbnails/15.jpg)
Project Model Summary
Database project = “truth” with regards to schema versioningCan be placed under source control.SQL script file is the canonical format usedChanges are tracked at object level
Indexes, constraints, triggers tracked independently of base tableProvides high granularity for change tracking
![Page 16: Dr Greg Low Senior Consultant – Readify Pty Ltd DAT302.](https://reader035.fdocuments.us/reader035/viewer/2022062304/56649d985503460f94a82b5d/html5/thumbnails/16.jpg)
Build and Deploy the Project
demo
![Page 17: Dr Greg Low Senior Consultant – Readify Pty Ltd DAT302.](https://reader035.fdocuments.us/reader035/viewer/2022062304/56649d985503460f94a82b5d/html5/thumbnails/17.jpg)
Introduction to Visual Studio Team Edition for Database Professionals (aka DataDude)
The Project System
Unit Tests
Session Objectives and Agenda
Building and Deploying
What’s Coming Next?
![Page 18: Dr Greg Low Senior Consultant – Readify Pty Ltd DAT302.](https://reader035.fdocuments.us/reader035/viewer/2022062304/56649d985503460f94a82b5d/html5/thumbnails/18.jpg)
Data Generation
Where does test data come from?Production data?Scrubbed production data?Typed in manually?Auto-generated?
![Page 19: Dr Greg Low Senior Consultant – Readify Pty Ltd DAT302.](https://reader035.fdocuments.us/reader035/viewer/2022062304/56649d985503460f94a82b5d/html5/thumbnails/19.jpg)
Unit Tests
Have been hard to do with databasesSQL 2k5 Database Snapshots helpfulLeverage VSTS Unit Test InfrastructureExtensible test assertions
![Page 20: Dr Greg Low Senior Consultant – Readify Pty Ltd DAT302.](https://reader035.fdocuments.us/reader035/viewer/2022062304/56649d985503460f94a82b5d/html5/thumbnails/20.jpg)
Data Generation and Unit Tests
demo
![Page 21: Dr Greg Low Senior Consultant – Readify Pty Ltd DAT302.](https://reader035.fdocuments.us/reader035/viewer/2022062304/56649d985503460f94a82b5d/html5/thumbnails/21.jpg)
Introduction to Visual Studio Team Edition for Database Professionals (aka DataDude)
The Project System
Unit Tests
Session Objectives and Agenda
Building and Deploying
What’s Coming Next?
![Page 22: Dr Greg Low Senior Consultant – Readify Pty Ltd DAT302.](https://reader035.fdocuments.us/reader035/viewer/2022062304/56649d985503460f94a82b5d/html5/thumbnails/22.jpg)
Build Cycle
DBA
DBDev
ProductionDatabase
StagingDatabase
SCM
Daily Build Test
Get Latest
TestDatabase
DailyBuild
Output
Can also beused in a “Continuous”build environment
Trust Boundary
![Page 23: Dr Greg Low Senior Consultant – Readify Pty Ltd DAT302.](https://reader035.fdocuments.us/reader035/viewer/2022062304/56649d985503460f94a82b5d/html5/thumbnails/23.jpg)
Deploy The Project Environment
DBA
Sync fro
m La
bel
DBDev
ProductionDatabase
StagingDatabase
SCM
SQLDeploy ScriptBuild
Deploy
Refine deploy scriptVerify
Trust Boundary
DatabaseProject
![Page 24: Dr Greg Low Senior Consultant – Readify Pty Ltd DAT302.](https://reader035.fdocuments.us/reader035/viewer/2022062304/56649d985503460f94a82b5d/html5/thumbnails/24.jpg)
Benefits of This Approach
Managed, project oriented evolution of
database schemaApplication and database schema are managed togetherWork in “isolation”, deploying only when changes verifiedLeverage VSTS work item tracking and process guidance increases team collaboration and unity
![Page 25: Dr Greg Low Senior Consultant – Readify Pty Ltd DAT302.](https://reader035.fdocuments.us/reader035/viewer/2022062304/56649d985503460f94a82b5d/html5/thumbnails/25.jpg)
Build & Deploy
DatabaseProject
TargetDatabas
e
SQLScript
Deploy
Build
Difference based build script
Project State“What you want”
Current State“How it is right
now”
Execute Incremental Update
Script
![Page 26: Dr Greg Low Senior Consultant – Readify Pty Ltd DAT302.](https://reader035.fdocuments.us/reader035/viewer/2022062304/56649d985503460f94a82b5d/html5/thumbnails/26.jpg)
Command Line Building
All steps are implemented as MSBuild tasks
SqlBuildTaskSqlDeployTaskDataGeneratorTask
More tasks coming in Power ToolsAll project properties can be overwritten at the command line
![Page 27: Dr Greg Low Senior Consultant – Readify Pty Ltd DAT302.](https://reader035.fdocuments.us/reader035/viewer/2022062304/56649d985503460f94a82b5d/html5/thumbnails/27.jpg)
Command Line Build
Using the project settings:msbuild NorthwindOnline.dbproj /t:build
Overwriting project settingsmsbuild NorthwindOnline.dbproj /t:build /p:TargetConnectionString="Data Source=(local)\sql80;Integrated Security=True;Pooling=False;" /p:TargetDatabase="NorthwindOnlineTestDB"
![Page 28: Dr Greg Low Senior Consultant – Readify Pty Ltd DAT302.](https://reader035.fdocuments.us/reader035/viewer/2022062304/56649d985503460f94a82b5d/html5/thumbnails/28.jpg)
Command Line Deployment
Using the project settings:msbuild NorthwindOnline.dbproj /t:deploy
Overwriting project settings:msbuild NorthwindOnline.dbproj /t:deploy /p:TargetConnectionString="Data Source=(local)\sql80;Integrated Security=True;Pooling=False;"/p:TargetDatabase="NorthWind"
![Page 29: Dr Greg Low Senior Consultant – Readify Pty Ltd DAT302.](https://reader035.fdocuments.us/reader035/viewer/2022062304/56649d985503460f94a82b5d/html5/thumbnails/29.jpg)
Provisioning Multiple Servers
How can I deploy to multiple targets?The Database Project only understand a single target server/database at the time
for each server+database combination in list{
SqlBuildTask SqlDeployTask
}
![Page 30: Dr Greg Low Senior Consultant – Readify Pty Ltd DAT302.](https://reader035.fdocuments.us/reader035/viewer/2022062304/56649d985503460f94a82b5d/html5/thumbnails/30.jpg)
Building from the Command Line
demo
![Page 31: Dr Greg Low Senior Consultant – Readify Pty Ltd DAT302.](https://reader035.fdocuments.us/reader035/viewer/2022062304/56649d985503460f94a82b5d/html5/thumbnails/31.jpg)
Team Foundation Build
Build Server infrastructureFully integrates with Team Foundation ServerExtensible
Based on MSBuildFully extensible XML-based scriptingRich Command-line supportRemote and Desktop build support
Have to install Team Build separatelyNot installed as part of Team Foundation Server
![Page 32: Dr Greg Low Senior Consultant – Readify Pty Ltd DAT302.](https://reader035.fdocuments.us/reader035/viewer/2022062304/56649d985503460f94a82b5d/html5/thumbnails/32.jpg)
Team Foundation Build ArchitectureTF Client
Team Build Client
Team Build
Team BuildStore
Build Server
Source Control
Build Configuration files - MSBuild Scripts
MSBuild Scripts
and targets
Build sources and scripts
Build Events
Build events
Build request and Reports
Team Build Service
Team Build logger Build and
Test data
Build start/stop
Work item Tracking
Open and Update bugs
BuildDrop site
TFS Data Tier
TF Warehouse
Static Analysis& Testing
TFS
![Page 33: Dr Greg Low Senior Consultant – Readify Pty Ltd DAT302.](https://reader035.fdocuments.us/reader035/viewer/2022062304/56649d985503460f94a82b5d/html5/thumbnails/33.jpg)
Introduction to Visual Studio Team Edition for Database Professionals (aka DataDude)
The Project System
Unit Tests
Session Objectives and Agenda
Building and Deploying
What’s Coming Next?
![Page 34: Dr Greg Low Senior Consultant – Readify Pty Ltd DAT302.](https://reader035.fdocuments.us/reader035/viewer/2022062304/56649d985503460f94a82b5d/html5/thumbnails/34.jpg)
Service Pack 1
Now downloadable
![Page 35: Dr Greg Low Senior Consultant – Readify Pty Ltd DAT302.](https://reader035.fdocuments.us/reader035/viewer/2022062304/56649d985503460f94a82b5d/html5/thumbnails/35.jpg)
Power Tools
New RefactoringsMove schemaDisambiguate (fully aliases references)Wild-card expansion (*)Generated schema deployment scripts based on refactoring logs (separates sp_name and TRANSFER SCHEMA)Strongly-typed dataset refactoring (if in same solution file)
![Page 36: Dr Greg Low Senior Consultant – Readify Pty Ltd DAT302.](https://reader035.fdocuments.us/reader035/viewer/2022062304/56649d985503460f94a82b5d/html5/thumbnails/36.jpg)
Power Tools
New MSBuild TasksSchema compareData Compare
Data GeneratorRegular expression string and data bound generatorsRegex editor has generator for check constraintsStream-based data-bound generator (pulls one row at a time)
![Page 37: Dr Greg Low Senior Consultant – Readify Pty Ltd DAT302.](https://reader035.fdocuments.us/reader035/viewer/2022062304/56649d985503460f94a82b5d/html5/thumbnails/37.jpg)
Power Tools
Dependency Tree ViewerT-SQL Static Code Analysis (ala FxCop)API Access to Schema View
Leveraged by CA Erwin R7.2 SQL Script Pre-Processor
Expands variables and include files
![Page 38: Dr Greg Low Senior Consultant – Readify Pty Ltd DAT302.](https://reader035.fdocuments.us/reader035/viewer/2022062304/56649d985503460f94a82b5d/html5/thumbnails/38.jpg)
Summary
Excellent addition to VSTSAllows database schemas and versioning to be managed along with application codeExtensible
![Page 39: Dr Greg Low Senior Consultant – Readify Pty Ltd DAT302.](https://reader035.fdocuments.us/reader035/viewer/2022062304/56649d985503460f94a82b5d/html5/thumbnails/39.jpg)
ResourcesMSDN Forum: Visual Studio Team System - Database Professionals
http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=725&SiteID=1
White papersWhat Microsoft Visual Studio 2005 Team Edition for Database Professionals Can Do for YouA Security Overview of Microsoft Visual Studio 2005 Team Edition for Database ProfessionalsDatabase Unit Testing with Team Edition for Database Professionals
Sampleshttp://www.codeplex.com/vsdbpro
Trial Editionhttp://www.microsoft.com/downloads/details.aspx?familyid=7de00386-893d-4142-a778-992b69d482ad&displaylang=en
Gert’s Bloghttp://blog.msdn.com/gertd
![Page 40: Dr Greg Low Senior Consultant – Readify Pty Ltd DAT302.](https://reader035.fdocuments.us/reader035/viewer/2022062304/56649d985503460f94a82b5d/html5/thumbnails/40.jpg)
SQL Down Under Code Camp
Biggest SQL Server community event in Australia14 SQL Server sessions over two daysSpecial guest presentation from Kevin Kline
President of PASS, Director of Technology – Quest Software
When?Weekend of the 13th and 14th of October
Where?Charles Sturt University, Wagga Wagga
What does it cost?This event is FREE
http://www.sqldownunder.com
![Page 41: Dr Greg Low Senior Consultant – Readify Pty Ltd DAT302.](https://reader035.fdocuments.us/reader035/viewer/2022062304/56649d985503460f94a82b5d/html5/thumbnails/41.jpg)
SQL Server User Groups
Best place to learn about SQL Server for FREEUser Groups in most capital citiesGreat networking opportunityhttp://www.sqlserver.org.au
![Page 42: Dr Greg Low Senior Consultant – Readify Pty Ltd DAT302.](https://reader035.fdocuments.us/reader035/viewer/2022062304/56649d985503460f94a82b5d/html5/thumbnails/42.jpg)
Evaluation Forms
![Page 44: Dr Greg Low Senior Consultant – Readify Pty Ltd DAT302.](https://reader035.fdocuments.us/reader035/viewer/2022062304/56649d985503460f94a82b5d/html5/thumbnails/44.jpg)
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.
The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after
the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.