Your SlideShare is downloading. ×
0
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
SQL Azure and Data-tier Applications (DACPAC)
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

SQL Azure and Data-tier Applications (DACPAC)

2,831

Published on

An overview of how Data-tier Applications (DACPACs) work with SQL Azure and SQL Server 2008. Also included is how this Microsoft technology fits in with a continuous integration (CI) process. Visit my …

An overview of how Data-tier Applications (DACPACs) work with SQL Azure and SQL Server 2008. Also included is how this Microsoft technology fits in with a continuous integration (CI) process. Visit my blog for more details: http://andrewmatthewthompson.blogspot.com/

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
2,831
On Slideshare
0
From Embeds
0
Number of Embeds
8
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • \n
  • RESAAS: Social platform for real estate professionals to connect and communicate in real time\nElectrical and Computer Engineering Degree from UBC\nMedical robotics research (Cancer Agency), Advanced visualization at Toshiba Medical (EU), WebApps at Blast Radius\n
  • \n
  • May 7, 2011 just before I joined RESAAS as the first full-time engineer\n\nCEO’s daughter, so it started as a playground for barbies\n
  • Now look at us...\n\n0 to 8 engineers in 6 months... no more barbies\n
  • RESAAS is building a platform, by their very nature platforms needs to scale.\n
  • How could we scale effectively without first provisioning all the hardware?\n\nWe could use Windows Azure\n\nLot’s of other technologies but these are the bear minimum\n
  • \n
  • The transition took us approx. 3 months\n
  • \n
  • Developer’s were trying to understand and fix things but were breaking things at the same time (affecting everybody)\n
  • And if you have one that’s working think about the productivity you might be losing\n
  • The problem gets worse as our team grows\n
  • Simple everyone develops on their own database...\n\nBut then we have another problem... how do we sync & merge together DB changes?\n
  • SQL: There has got to be a better way\nLiquibase: Stored procs are not supported\nRedgate would work fine but costs extra ($695)\nVS2010 Database tools are only available in Premium or Ultimate versions\n
  • SQL: There has got to be a better way\nLiquibase: Stored procs are not supported\nRedgate would work fine but costs extra ($695)\nVS2010 Database tools are only available in Premium or Ultimate versions\n
  • SQL: There has got to be a better way\nLiquibase: Stored procs are not supported\nRedgate would work fine but costs extra ($695)\nVS2010 Database tools are only available in Premium or Ultimate versions\n
  • SQL: There has got to be a better way\nLiquibase: Stored procs are not supported\nRedgate would work fine but costs extra ($695)\nVS2010 Database tools are only available in Premium or Ultimate versions\n
  • \n
  • We pick the SQL Server 2008 Database Project...\n
  • Not a good idea... SQL Azure’s subset of supported schema objects doesn’t work nicely with database projects.\n\nWe were told to use Data-tier applications\n
  • Contains all database schema objects AND when compiled produces a DACPAC\n
  • Individual SQL create scripts under each folder\n
  • DAC: The general brand that encompasses all subsequent names and concepts\nDACFx: The actual framework consisting of several DLL files\nDACPAC: The file format used by DACFx to represent the full definition of an application (usually schema only). Best analogy: an MSI.\nBACPAC: The file format used by DACFx to contain the definition of an application as well as its (table) data.\n
  • DAC: The general brand that encompasses all subsequent names and concepts\nDACFx: The actual framework consisting of several DLL files\nDACPAC: The file format used by DACFx to represent the full definition of an application (usually schema only). Best analogy: an MSI.\nBACPAC: The file format used by DACFx to contain the definition of an application as well as its (table) data.\n
  • DAC: The general brand that encompasses all subsequent names and concepts\nDACFx: The actual framework consisting of several DLL files\nDACPAC: The file format used by DACFx to represent the full definition of an application (usually schema only). Best analogy: an MSI.\nBACPAC: The file format used by DACFx to contain the definition of an application as well as its (table) data.\n
  • DAC: The general brand that encompasses all subsequent names and concepts\nDACFx: The actual framework consisting of several DLL files\nDACPAC: The file format used by DACFx to represent the full definition of an application (usually schema only). Best analogy: an MSI.\nBACPAC: The file format used by DACFx to contain the definition of an application as well as its (table) data.\n
  • Deep integration: DACPAC can be used in both SSMS & VS\n\nWorks with SQL Server & SQL Azure\n
  • \n
  • \n
  • \n
  • data-tier application == database\n\nDevelopers will want to make changes and test them out\nAlso for sync’ing DB changes across the dev team\n
  • \n
  • data-tier application == database\n\nDevelopers will want to make changes and test them out\nAlso for sync’ing DB changes across the dev team\n
  • \n
  • \n
  • \n
  • \n
  • PowerShell script\n\nGetting the options right and then upgrading are the most crucial parts\n
  • \n
  • This is currently a manual process for us. (Extra protection)\n
  • \n
  • \n
  • \n
  • This saves a lot of time for CI builds (if you don’t need to sync the DB then don’t)\n
  • When using PowerShell to upgrade the database used by the CI build (i.e for tests)...\n... check whether to upgrade or not based on the version #\n
  • \n
  • \n
  • Minor learning curve (most people are used to SSMS)\n\n
  • Minor learning curve (most people are used to SSMS)\n\n
  • Minor learning curve (most people are used to SSMS)\n\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Options: Dataloss, Drift, Policy Validation\n\nYou can apply the exact same DACPAC and it does nothing\n
  • Options: Dataloss, Drift, Policy Validation\n\nYou can apply the exact same DACPAC and it does nothing\n
  • Options: Dataloss, Drift, Policy Validation\n\nYou can apply the exact same DACPAC and it does nothing\n
  • Continuous Deployment - DACPAC being one technology at the heart of this\n
  • RESAAS will grow so get in touch.\n
  • Transcript

    • 1. SQL AZURE AND DATA-TIER APPLICATIONS Vancouver Windows Azure Meetup Group
    • 2. ANDREW THOMPSON Senior Software Engineer @
    • 3. Some Background First...
    • 4. WE WERE BUILDING THIS Presentation tier Middle tier Data tier
    • 5. BUT WE THOUGHT ABOUT THIS Presentation tier Middle Middle Middle Middle tier tier tier tier Data tier Data tier Data tier
    • 6. SO WE MOVED TO THE CLOUD Presentation tier Middle tier } Web Roles Data tier } SQL Azure
    • 7. 3 Months
    • 8. The Problem...
    • 9. EVERYTHING WAS ALWAYS BROKEN Alter Table Alter Procedure SQL ServerCreate Procedure Drop Table
    • 10. A single development database doesnt work for long.
    • 11. Difficulty # Developers
    • 12. How can we scale database modifications?
    • 13. POSSIBILITIES
    • 14. POSSIBILITIES• Hand rolled SQL scripts
    • 15. POSSIBILITIES• Hand rolled SQL scripts• Liquibase
    • 16. POSSIBILITIES• Hand rolled SQL scripts• Liquibase• Redgates SQL tools
    • 17. POSSIBILITIES• Hand rolled SQL scripts• Liquibase• Redgates SQL tools• Visual Studio’s database tools
    • 18. What database project do we use?
    • 19. Uh oh... we’re using the database project
    • 20. What is a Data-tier Application?
    • 21. TERMINOLOGYhttp://dacguy.wordpress.com/2011/09/09/dac-concepts
    • 22. TERMINOLOGY• DAC http://dacguy.wordpress.com/2011/09/09/dac-concepts
    • 23. TERMINOLOGY• DAC• DACFx http://dacguy.wordpress.com/2011/09/09/dac-concepts
    • 24. TERMINOLOGY• DAC• DACFx• DAC Package (DACPAC) http://dacguy.wordpress.com/2011/09/09/dac-concepts
    • 25. TERMINOLOGY• DAC• DACFx• DAC Package (DACPAC)• BACPAC http://dacguy.wordpress.com/2011/09/09/dac-concepts
    • 26. DACPAC
    • 27. HOW DO YOU INTERACT WITH IT?
    • 28. HOW DO YOU INTERACT WITH IT?• Right-click menus (SSMS or VS2010)
    • 29. HOW DO YOU INTERACT WITH IT?• Right-click menus (SSMS or VS2010)• .NET
    • 30. HOW DO YOU INTERACT WITH IT?• Right-click menus (SSMS or VS2010)• .NET• PowerShell
    • 31. GETTING STARTEDExtract a data-tier application from your existing database
    • 32. USE CASEUpgrade data-tier application locally
    • 33. USE CASEUpgrade data-tier application on CI
    • 34. }[Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.Smo")[Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.Management.Sdk.Sfc")[Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.Management.Dac")[Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.ConnectionInfo") Dependencies$sqlConnection = new-object System.Data.SqlClient.SqlConnection($connectionString) }$serverConnection = new-object Microsoft.SqlServer.Management.Common.ServerConnection( $sqlConnection)$serverConnection.Connect();$sqlStoreConnection = New-Object Microsoft.SqlServer.Management.Sdk.Sfc.SqlStoreConnection( Connections $serverConnection.SqlConnectionObject)$connectSuccessful = $sqlStoreConnection.Connect()$dacStore = New-Object Microsoft.SqlServer.Management.Dac.DacStore($serverConnection)$upgradeOptions = New-Object Microsoft.SqlServer.Management.Dac.DacUpgradeOptions$upgradeOptions.BlockOnChanges = $false$upgradeOptions.IgnoreDataLoss = $true$upgradeOptions.RollbackonFailure = $true$upgradeOptions.SkipPolicyValidation = $false } Options$dacChanges = $dacStore.GetDatabaseChanges($dataTierAppNameToUpgrade) | Out-File -Filepath .DatabaseChanges.txt$dacStore.GetIncrementalUpgradeScript($dataTierAppNameToUpgrade, $nextDacType) | Out-File -Filepath .DatabaseUpgrade.sql } Review$dacStore.IncrementalUpgrade($dataTierAppNameToUpgrade, $nextDacType, $upgradeOptions) } Upgrade
    • 35. USE CASEUpgrade data-tier application on Production
    • 36. Continuous Integration (CI)
    • 37. TIP Use the DACPAC version # toavoid pushing unnecessary changes
    • 38. TIPWatch out for previous DACFx versions
    • 39. Pros & Cons...
    • 40. CONS
    • 41. CONS• All schema modifications should occur within Visual Studio
    • 42. CONS• All schema modifications should occur within Visual Studio• Online documentation is a bit scarce
    • 43. CONS• All schema modifications should occur within Visual Studio• Online documentation is a bit scarce• Deployments to SQL Azure can take a while (5 - 30 mins)
    • 44. CONS
    • 45. CONS• Many questions around how this works with Azure Data Sync
    • 46. CONS• Many questions around how this works with Azure Data Sync• It won’t do everything for you
    • 47. PROS
    • 48. PROS• Developers can seamlessly sync database changes
    • 49. PROS• Developers can seamlessly sync database changes• Dev-ops or DBAs can feel comfortable with DACPACs
    • 50. PROS• Developers can seamlessly sync database changes• Dev-ops or DBAs can feel comfortable with DACPACs• Code analysis
    • 51. PROS
    • 52. PROS• Options to stop deployments under certain conditions
    • 53. PROS• Options to stop deployments under certain conditions• Schema/SQL change tracking
    • 54. PROS• Options to stop deployments under certain conditions• Schema/SQL change tracking• You define the schema and it figures out how to apply it
    • 55. What will the future hold?
    • 56. Questions?andrew.thompson@resaas.com

    ×