![Page 1: Automate Database Deployment - SQL In The City Workshop](https://reader033.vdocuments.mx/reader033/viewer/2022052905/5583cdb9d8b42a7c758b5268/html5/thumbnails/1.jpg)
Automate Your Database DeploymentsContinuous delivery for databases
Grant FritcheyRed Gate Software
![Page 4: Automate Database Deployment - SQL In The City Workshop](https://reader033.vdocuments.mx/reader033/viewer/2022052905/5583cdb9d8b42a7c758b5268/html5/thumbnails/4.jpg)
Development
Continuous integration
Build Test
Publish Sync
ALTERTABLEfoo…
Deployment script
Release management
Artifact repository
Production
Trigger
Review, Backup & deploy
Source control
QA / Test / Pre-production
Continuous delivery for databases
Database release pipeline
Continuous IntegrationDevelopment ProductionTesting
OperationsDatabase development
and change management
![Page 5: Automate Database Deployment - SQL In The City Workshop](https://reader033.vdocuments.mx/reader033/viewer/2022052905/5583cdb9d8b42a7c758b5268/html5/thumbnails/5.jpg)
Development
Continuous integration
Build Test
Publish Sync
ALTERTABLEfoo…
Deployment script
Release management
Artifact repository
Production
Trigger
Review, Backup & deploy
Source control
QA / Test / Pre-production
Continuous delivery for databases
In this presentation
Database release pipelineContinuous IntegrationDevelopment ProductionTesting
![Page 6: Automate Database Deployment - SQL In The City Workshop](https://reader033.vdocuments.mx/reader033/viewer/2022052905/5583cdb9d8b42a7c758b5268/html5/thumbnails/6.jpg)
Goals
• Understand the patterns and practices for
automating database deployments.
• Learn about the advantages continuous integration
brings to a release pipeline.
• Understand the challenges databases present for
continuous delivery.
![Page 7: Automate Database Deployment - SQL In The City Workshop](https://reader033.vdocuments.mx/reader033/viewer/2022052905/5583cdb9d8b42a7c758b5268/html5/thumbnails/7.jpg)
Continuous delivery – what it is and isn’t
Common misconception:
Continuous delivery = Continuous deployment
But in fact:Continuous delivery means making sure your database changes are always production-ready.
![Page 8: Automate Database Deployment - SQL In The City Workshop](https://reader033.vdocuments.mx/reader033/viewer/2022052905/5583cdb9d8b42a7c758b5268/html5/thumbnails/8.jpg)
Recap: Continuous Delivery
Development Test Production
Continuous integration
Continuous deployment
Continuous delivery
Release pipeline
Approvalgate
![Page 9: Automate Database Deployment - SQL In The City Workshop](https://reader033.vdocuments.mx/reader033/viewer/2022052905/5583cdb9d8b42a7c758b5268/html5/thumbnails/9.jpg)
Four key stages of the deployment pipeline
SOURCECONTROL
CONTINUOUS INTEGRATION
AUTOMATED TESTING
AUTOMATED DEPLOYMENT
![Page 10: Automate Database Deployment - SQL In The City Workshop](https://reader033.vdocuments.mx/reader033/viewer/2022052905/5583cdb9d8b42a7c758b5268/html5/thumbnails/10.jpg)
Get your database under control
• Use version control for all code (including tests)
• Commit early, commit often• Use tools
o If it’s hard, people don’t do it• Train people• Build often
SOURCECONTROL
![Page 11: Automate Database Deployment - SQL In The City Workshop](https://reader033.vdocuments.mx/reader033/viewer/2022052905/5583cdb9d8b42a7c758b5268/html5/thumbnails/11.jpg)
Continuous Integration
• Requires• Code repository• Build automation
• Delivers• Functional testing• Delivery testing• Artifact generation
CONTINUOUS INTEGRATION:
FUNDAMENTALS
![Page 12: Automate Database Deployment - SQL In The City Workshop](https://reader033.vdocuments.mx/reader033/viewer/2022052905/5583cdb9d8b42a7c758b5268/html5/thumbnails/12.jpg)
Database Deployments in CI
• Complete deployment• Fast• Partial build validation• Functional validation• No artifact
• Incremental deployment• Longer• Harder• Complete build validation• Generates artifact
CONTINUOUS INTEGRATION:
FUNDAMENTALS
![Page 13: Automate Database Deployment - SQL In The City Workshop](https://reader033.vdocuments.mx/reader033/viewer/2022052905/5583cdb9d8b42a7c758b5268/html5/thumbnails/13.jpg)
Demo
![Page 14: Automate Database Deployment - SQL In The City Workshop](https://reader033.vdocuments.mx/reader033/viewer/2022052905/5583cdb9d8b42a7c758b5268/html5/thumbnails/14.jpg)
Development
Continuous integration
Build Test
Publish Sync
ALTERTABLEfoo…
Deployment script
Release management
Artifact repository
Production
Trigger
Review, Backup & deploy
Source control
QA / Test / Pre-production
Continuous delivery for databases
Focus here
Build out your release strategyContinuous IntegrationDevelopment ProductionTesting
![Page 15: Automate Database Deployment - SQL In The City Workshop](https://reader033.vdocuments.mx/reader033/viewer/2022052905/5583cdb9d8b42a7c758b5268/html5/thumbnails/15.jpg)
Automation
![Page 16: Automate Database Deployment - SQL In The City Workshop](https://reader033.vdocuments.mx/reader033/viewer/2022052905/5583cdb9d8b42a7c758b5268/html5/thumbnails/16.jpg)
Automation
Deploymentpackage
![Page 17: Automate Database Deployment - SQL In The City Workshop](https://reader033.vdocuments.mx/reader033/viewer/2022052905/5583cdb9d8b42a7c758b5268/html5/thumbnails/17.jpg)
deployment package1
2
3Back to
Development
FAIL
![Page 18: Automate Database Deployment - SQL In The City Workshop](https://reader033.vdocuments.mx/reader033/viewer/2022052905/5583cdb9d8b42a7c758b5268/html5/thumbnails/18.jpg)
Development
Continuous integration
Build Test
Publish Sync
ALTERTABLEfoo…
Deployment script
Release management
Artifact repository
Production
Trigger
Review, Backup & deploy
Source control
QA / Test / Pre-production
Continuous delivery for databases
Repository might be separate piece of software or part of release management software
Continuous IntegrationDevelopment ProductionTesting
OperationsDatabase development
and change management
![Page 19: Automate Database Deployment - SQL In The City Workshop](https://reader033.vdocuments.mx/reader033/viewer/2022052905/5583cdb9d8b42a7c758b5268/html5/thumbnails/19.jpg)
Demo
![Page 20: Automate Database Deployment - SQL In The City Workshop](https://reader033.vdocuments.mx/reader033/viewer/2022052905/5583cdb9d8b42a7c758b5268/html5/thumbnails/20.jpg)
Pre-production is a dry-run
• Staging matches production• As close as possible• Can use diff tool • Or backup and restore AUTOMATED
DEPLOYMENT
![Page 21: Automate Database Deployment - SQL In The City Workshop](https://reader033.vdocuments.mx/reader033/viewer/2022052905/5583cdb9d8b42a7c758b5268/html5/thumbnails/21.jpg)
Development
Continuous integration
Build Test
Publish Sync
ALTERTABLEfoo…
Deployment script
Release management
Artifact repository
Production
Trigger
Review, Backup & deploy
Source control
QA / Test / Pre-production
Continuous delivery for databases
Continuous IntegrationDevelopment ProductionTesting
OperationsDatabase development
and change management
![Page 22: Automate Database Deployment - SQL In The City Workshop](https://reader033.vdocuments.mx/reader033/viewer/2022052905/5583cdb9d8b42a7c758b5268/html5/thumbnails/22.jpg)
Wait…
![Page 23: Automate Database Deployment - SQL In The City Workshop](https://reader033.vdocuments.mx/reader033/viewer/2022052905/5583cdb9d8b42a7c758b5268/html5/thumbnails/23.jpg)
Check for database drift
• Last-minute hotfix• Manual emergency fixes• Unknown changes
AUTOMATED DEPLOYMENT
![Page 24: Automate Database Deployment - SQL In The City Workshop](https://reader033.vdocuments.mx/reader033/viewer/2022052905/5583cdb9d8b42a7c758b5268/html5/thumbnails/24.jpg)
Ready to go now?…
![Page 25: Automate Database Deployment - SQL In The City Workshop](https://reader033.vdocuments.mx/reader033/viewer/2022052905/5583cdb9d8b42a7c758b5268/html5/thumbnails/25.jpg)
Plan for things to go wrong
…you need a rollback and recovery strategy
AUTOMATED DEPLOYMENT
![Page 26: Automate Database Deployment - SQL In The City Workshop](https://reader033.vdocuments.mx/reader033/viewer/2022052905/5583cdb9d8b42a7c758b5268/html5/thumbnails/26.jpg)
Protection
• Backups• Snapshots• Rollback scripts• A/B or blue/green deployments• Roll forward scripts
AUTOMATED DEPLOYMENT
![Page 27: Automate Database Deployment - SQL In The City Workshop](https://reader033.vdocuments.mx/reader033/viewer/2022052905/5583cdb9d8b42a7c758b5268/html5/thumbnails/27.jpg)
Demo
![Page 28: Automate Database Deployment - SQL In The City Workshop](https://reader033.vdocuments.mx/reader033/viewer/2022052905/5583cdb9d8b42a7c758b5268/html5/thumbnails/28.jpg)
Recap: Continuous Delivery
Development Test Production
Continuous integration
Continuous deployment
Continuous delivery
Release pipeline
Approvalgate
![Page 29: Automate Database Deployment - SQL In The City Workshop](https://reader033.vdocuments.mx/reader033/viewer/2022052905/5583cdb9d8b42a7c758b5268/html5/thumbnails/29.jpg)
Documentation and resources
• Continuous Delivery by Jez Humble and David Farley (Addison Wesley)• The Phoenix Project: A Novel About IT, DevOps, and Helping Your Business Win by Gene Kim,
Kevin Behr and George Spafford (IT Revolution Press)• The Goal: A Process of Ongoing Improvement by Eliyahu M. Goldratt and Jeff Cox (Gower
Publishing Ltd.)• Agile Organization by the agile admin (theagileadmin.com)
Further resources:• Database Delivery Learning program: www.red-gate.com/delivery
• Patterns and practices on Simple-Talk• Tutorials in Red Gate training academy
• www.youtube.com/user/RedGateVideos - for recorded seminars
![Page 30: Automate Database Deployment - SQL In The City Workshop](https://reader033.vdocuments.mx/reader033/viewer/2022052905/5583cdb9d8b42a7c758b5268/html5/thumbnails/30.jpg)
Want to try the tools you’ve just seen? Come to our Hands-on Labs
![Page 31: Automate Database Deployment - SQL In The City Workshop](https://reader033.vdocuments.mx/reader033/viewer/2022052905/5583cdb9d8b42a7c758b5268/html5/thumbnails/31.jpg)
Image sourcesAuthor Source Information
William Warby Flickr Glass Man - Flickr. This file is licensed under the Creative Commons Attribution 2.0 Generic license.
Perry McKenna Flickr Headless Horse – Flickr. This file is licensed under the Creative Commons Attribution 2.0 Generic license.
William Warby Flickr Gears – Flickr. This file is licensed under the Creative Commons Attribution 2.0 Generic license.
Ross Harmes Flickr Gear for lightweight snow camping – Flickr. This file is licensed under the Creative Commons Attribution 2.0 Generic license.
Val Gardena – Gröden Marketing
FlickrFis Ski World Cup Val Gardena Gröden – Flickr. This file is licensed under the Creative Commons Attribution 2.0 Generic license
Paul Pehrson Flickr Ice cream sundae - Flickr. This file is licensed under the Creative Commons Attribution 2.0 Generic license