SlideShare a Scribd company logo
1 of 34
Download to read offline
Howdy, I’m Blaine CarterHowdy, I’m Blaine Carter
Oracle Corporation
Developer Advocate for Open Source
Email: blaine.carter@oracle.com
Blog: learncodeshare.net
Twi er: @OraBlaineOS
YouTube: www.youtube.com/blainecarter
Team: community.oracle.com/docs/DOC-
917690
MasterCreate directory:
RunAllVer5.sql
CreateLB_Groups.sql
CreateLB_People.sql
LoadLB_GroupsData.sql
Update4to5 directory:
UpdateAllVer4to5.sql
AddColGroupsRules.sql
AddColPeopleFavorite_color.sql
Database Change ManagementDatabase Change Management
The Hard WayThe Hard Way
ProblemsProblems
Which script has been run?
Update or Rollback to a specific version?
Test data? → LoadTestData.sql
Leveraging Open Source for Oracle Database DevelopmentLeveraging Open Source for Oracle Database Development
Cross platform database change management.
h p://www.liquibase.org/
h ps://github.com/liquibase/liquibase
Version Control / Change ManagementVersion Control / Change Management
The BasicsThe Basics
Track changes
Rollback / Switch to a specific revision
Branch / Merge
Diffs
What is Liquibase?What is Liquibase?
Liquibase is change management for your database.
Database changes are made using changeSets.
When you run an update, the changeSets are run in order.
Liquibase tracks what has been run, when and who ran it.
You can roll back to a specific version.
Populate default and/or test data.
Contexts -
Diffs -
Documentation -
SQL Output -
Offline -
h p://www.liquibase.org/documentation/contexts.html
h p://www.liquibase.org/documentation/diff.html
h p://www.liquibase.org/documentation/dbdoc.html
h p://www.liquibase.org/documentation/sql_output.html
h p://www.liquibase.org/documentation/offline.html
How Does It Work?How Does It Work?
Changelog Master
Change Sets
XML
JSON
SQL*
Groovy
Others..
Changelog MasterChangelog Master
{"databaseChangeLog": [
{"include": {"file": "runOnce/DD_DEQUEUE_ERRORS_T.createTable.json"}},
{"include": {"file": "runOnce/DD_DINOSAURS_T.createTable.json"}},
{"include": {"file": "runOnce/DD_LOCATIONS_T.createTable.json"}},
{"include": {"file": "runOnce/DD_MEMBERS_T.createTable.json"}},
{"include": {"file": "runOnce/DD_MESSAGES_T.createTable.json"}},
{"include": {"file": "runOnce/DD_SEED_DATA_T.createTable.json"}},
{"include": {"file": "runOnce/DD_SETTINGS_T.createTable.json"}},
{"include": {"file": "runOnce/DD_TEMPLATES_T.createTable.json"}},
{"include": {"file": "runOnChange/views/viewsMaster.json"}},
{"include": {"file": "runOnce/DD_USER_PAYMENT_TYPE.createSynonym.json"}},
{"include": {"file": "runOnChange/triggers/triggersMaster.json"}},
{"include": {"file": "runOnChange/functions/functionsMaster.json"}},
{"include": {"file": "runOnChange/procedures/proceduresMaster.json"}},
{"include": {"file": "runOnChange/packages/packagesMaster.json"}},
{"include": {"file": "runOnce/DD_Load_Data.json"}},
{"include": {"file": "runOnce/DD_Setup_Text_Search.json"}}
]}
ChangesetChangeset
{
"databaseChangeLog": [{
"preConditions": [{
"runningAs": {
"username": "dd"
}
}]
}, {
"changeSet": {
"id": "1507062717550-4",
"author": "bcarter (generated)",
"changes": [{
"createTable": {
"tableName": "DD_MEMBERS_T",
"columns": [{
"column": {
"name": "MEMBER_ID",
"type": "NUMBER(, 0)",
"autoIncrement": true,
"constraints": {
Java Command LineJava Command Line
java $JAVA_OPTS -jar /opt/liquibase/liquibase.jar 
--driver=oracle.jdbc.OracleDriver 
--classpath="/usr/lib/oracle/12.1/client64/lib/ojdbc7.jar" 
--url=jdbc:oracle:thin:lb_demo/dd@dbatp_medium 
--changeLogFile=changelog/db.changelog-master.json updateSQL >> output.sql
options
--logLevel=DEBUG
--logFile=liquibase.logFile
$JAVA_OPTS is used for my Oracle Autonomous Transaction Processing cloud connection.
Properties FileProperties File
(liquibase.properties)(liquibase.properties)
driver: oracle.jdbc.OracleDriver
classpath: /usr/lib/oracle/12.1/client64/lib/ojdbc7.jar
url: jdbc: oracle:thin:lb_demo/dd@dbatp_medium
changeLogFile: changelog/db.changelog-master.json
LiquibaseLiquibase BestBest Recommended PracticesRecommended Practices
Ignore the directory structure I’m using in the demo’s.
h p://www.liquibase.org/bestpractices.html
So ware We’ll Be UsingSo ware We’ll Be Using
DinoDate
SQL Developer
Oracle Autonomous Transaction Processing Cloud Database or Virtual Box
Atom Text Editor
Liquibase -
h ps://github.com/oracle/dino-date
h p://www.liquibase.org
InstallInstall
Download -
It's just Java, extract it and go.
h p://www.liquibase.org/download/index.html
Enough blah blah, let's see it.Enough blah blah, let's see it.
Create Changelog and ChangeSet FilesCreate Changelog and ChangeSet Files
Changelog Example:
- step 1
Changeset Example:
- step 2
Recommended to only perform one change per Change set, but you can
do more if you need.
h p://www.liquibase.org/quickstart.html
h p://www.liquibase.org/quickstart.html
Run ItRun It
- step 3
Jar File: java $JAVA_OPTS -jar /opt/liquibase/liquibase.jar updateSQL
Shell Script: liquibase updateSQL
Batch File: liquibase.bat updateSQL
Put the Liquibase directory in your path and run it: liquibase update
The shell script / batch files use the same JAVA_OPTS environment variable for my
Autonomous Transaction Processing Cloud connection.
h p://www.liquibase.org/quickstart.html
Rollback X Number of Change SetsRollback X Number of Change Sets
Warning: Rolling back anything in the database can be tricky.
Be very careful if you do this in Production.
liquibase rollbackCount 1
Tag a ChangesetTag a Changeset
You can tag a changeset in the file:
You can also use the command line:
"changeSet": {
"id": "1",
"author": "BlaineCarter",
"tagDatabase": {"tag":"ver-1"},
"changes": [
liquibase tag ver-1
Rollback to TagRollback to Tag
Other Options:
h p://www.liquibase.org/documentation/rollback.html
liquibase rollback ver-1
h p://www.liquibase.org/documentation/command_line.html
Load Data From a FileLoad Data From a File
groups.csv
"changes": [
{
"loadData": {
"file": "changelog/groups.csv",
"schemaName": "lb_demo",
"tableName": "lb_groups"
}
}]
name,description
Trucks,People who like trucks
Rockets,People who like rockets
Horses,People who like horses
Snakes,People who like snakes
Insert DataInsert Data
"changes": [
{
"insert": {
"schemaName": "lb_demo",
"tableName": "lb_people",
"columns": [
{
"column": {
"name": "firstname",
"value": "Bob"
}
}, {
"column": {
"name": "group_id",
"valueComputed": "(SELECT id FROM lb_groups where name = 'Trucks')"
}
}
...
Context: TestContext: Test
In the change set:
Liquibase.properties
Command Line overrides the properties file:
Context vs Labels
"changeSet": {
"id": "loadData-example",
"author": "liquibase-docs",
"context": "test",
contexts: !test
liquibase --contexts=test update
h p://www.liquibase.org/2014/11/contexts-vs-labels.html
Data Changes Are NOT Automatically RolledData Changes Are NOT Automatically Rolled
Back.Back.
Define your own Rollback
{
"rollback": {
"delete": {
"tableName": "lb_people"
}
}
}
DiffDiff
Command Line:
Liquibase.properties:
h p://www.liquibase.org/documentation/diff.html
liquibase.sh --url=jdbc:oracle:thin:lb_demo/dd@unknownDB 
diff 
--referenceUrl=jdbc:oracle:thin:lb_demo/dd@goodDB
referenceUrl: jdbc:oracle:thin:lb_diff_demo/dd@dbatp_medium
Generate Changelog (Reverse Engineer)Generate Changelog (Reverse Engineer)
Note that this command currently has some limitations.
It does not export the following types of objects:
Stored procedures, functions, packages & Triggers
h p://www.liquibase.org/documentation/generating_changelogs.html
liquibase --changeLogFile=generated.json generateChangeLog
Review The OutputReview The Output
The output won’t be perfect.
Generated by update:
Generated by generateChangeLog:
id INTEGER GENERATED BY DEFAULT AS IDENTITY NOT NULL
ID NUMBER(*, 0) DEFAULT "LB_DEMO"."ISEQ$$_69966".nextval NOT NULL
DBDocDBDoc
liquibase DBDoc docs
h p://www.liquibase.org/documentation/dbdoc.html
Extensions / PluginsExtensions / Plugins
h ps://liquibase.jira.com/wiki/display/CONTRIB/LiquiBase+Extensions+Portal
We Can Make It Be erWe Can Make It Be er
h p://www.liquibase.org/
GitHub Repo:
Fork
Change
Pull Request
h ps://github.com/liquibase/liquibase
There are many ways to contribute.
Enhance code
Add tests
Improve documentation
Submit / review issues
Howdy, I’m Blaine CarterHowdy, I’m Blaine Carter
Oracle Corporation
Developer Advocate for Open Source
Email: blaine.carter@oracle.com
Blog: learncodeshare.net
Twi er: @OraBlaineOS
YouTube: www.youtube.com/blainecarter
Team: community.oracle.com/docs/DOC-
917690
#11
liquibase updateSQL
liquibase update
#12
liquibase rollbackCount 1
liquibase update
#13
liquibase update
liquibase tag myCoolTag
#14
liquibase rollback ver-1
liquibase update
#15
liquibase update
#17
liquibase --contexts=test update
#18
liquibase rollbackCount 2
liquibase rollbackCount 1
liquibase --contexts=test rollbackCount 2
liquibase --contexts=test update
#19
liquibase diff
liquibase --diffTypes=tables,columns diff
liquibase diffChangeLog
#20
liquibase --changeLogFile=generated.json generateChangeLog
#22
liquibase dropAll
liquibase DBDoc docs
liquibase update
liquibase DBDoc docs
Commands Used For The Demo (by slide number)Commands Used For The Demo (by slide number)

More Related Content

What's hot

Advance java session 5
Advance java session 5Advance java session 5
Advance java session 5Smita B Kumar
 
Oracle database 12.2 new features
Oracle database 12.2 new featuresOracle database 12.2 new features
Oracle database 12.2 new featuresAlfredo Krieg
 
Oracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c  - New Features for Developers and DBAsOracle Database 12c  - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAsAlex Zaballa
 
Database Automation with MySQL Triggers and Event Schedulers
Database Automation with MySQL Triggers and Event SchedulersDatabase Automation with MySQL Triggers and Event Schedulers
Database Automation with MySQL Triggers and Event SchedulersAbdul Rahman Sherzad
 
Performance Management in Oracle 12c
Performance Management in Oracle 12cPerformance Management in Oracle 12c
Performance Management in Oracle 12cAlfredo Krieg
 
Oracle Database 12c Release 2 - New Features On Oracle Database Exadata Expr...
Oracle Database 12c Release 2 - New Features On Oracle Database Exadata  Expr...Oracle Database 12c Release 2 - New Features On Oracle Database Exadata  Expr...
Oracle Database 12c Release 2 - New Features On Oracle Database Exadata Expr...Alex Zaballa
 
Oracle 21c: New Features and Enhancements of Data Pump & TTS
Oracle 21c: New Features and Enhancements of Data Pump & TTSOracle 21c: New Features and Enhancements of Data Pump & TTS
Oracle 21c: New Features and Enhancements of Data Pump & TTSChristian Gohmann
 
JPA and Hibernate Performance Tips
JPA and Hibernate Performance TipsJPA and Hibernate Performance Tips
JPA and Hibernate Performance TipsVlad Mihalcea
 
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should KnowDBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should KnowAlex Zaballa
 
Crating a Robust Performance Strategy
Crating a Robust Performance StrategyCrating a Robust Performance Strategy
Crating a Robust Performance StrategyGuatemala User Group
 
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...Alex Zaballa
 
Awesome SQL Tips and Tricks - Voxxed Days Cluj - 2019
 Awesome SQL Tips and Tricks - Voxxed Days Cluj - 2019 Awesome SQL Tips and Tricks - Voxxed Days Cluj - 2019
Awesome SQL Tips and Tricks - Voxxed Days Cluj - 2019Vlad Mihalcea
 
Oracle Database 12c "New features"
Oracle Database 12c "New features" Oracle Database 12c "New features"
Oracle Database 12c "New features" Anar Godjaev
 
Oracle 12c New Features for Developers
Oracle 12c New Features for DevelopersOracle 12c New Features for Developers
Oracle 12c New Features for DevelopersCompleteITProfessional
 
3.2\9 SSIS 2008R2_Training - ControlFlow Tasks
3.2\9 SSIS 2008R2_Training - ControlFlow Tasks3.2\9 SSIS 2008R2_Training - ControlFlow Tasks
3.2\9 SSIS 2008R2_Training - ControlFlow TasksPramod Singla
 
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should KnowOTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should KnowAlex Zaballa
 
Oracle 12.2 sharded database management
Oracle 12.2 sharded database managementOracle 12.2 sharded database management
Oracle 12.2 sharded database managementLeyi (Kamus) Zhang
 
Collaborate 2019 - How to Understand an AWR Report
Collaborate 2019 - How to Understand an AWR ReportCollaborate 2019 - How to Understand an AWR Report
Collaborate 2019 - How to Understand an AWR ReportAlfredo Krieg
 

What's hot (20)

LiquiBase
LiquiBaseLiquiBase
LiquiBase
 
Advance java session 5
Advance java session 5Advance java session 5
Advance java session 5
 
Oracle database 12.2 new features
Oracle database 12.2 new featuresOracle database 12.2 new features
Oracle database 12.2 new features
 
Oracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c  - New Features for Developers and DBAsOracle Database 12c  - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAs
 
Database Automation with MySQL Triggers and Event Schedulers
Database Automation with MySQL Triggers and Event SchedulersDatabase Automation with MySQL Triggers and Event Schedulers
Database Automation with MySQL Triggers and Event Schedulers
 
Performance Management in Oracle 12c
Performance Management in Oracle 12cPerformance Management in Oracle 12c
Performance Management in Oracle 12c
 
Oracle Database 12c Release 2 - New Features On Oracle Database Exadata Expr...
Oracle Database 12c Release 2 - New Features On Oracle Database Exadata  Expr...Oracle Database 12c Release 2 - New Features On Oracle Database Exadata  Expr...
Oracle Database 12c Release 2 - New Features On Oracle Database Exadata Expr...
 
Oracle 21c: New Features and Enhancements of Data Pump & TTS
Oracle 21c: New Features and Enhancements of Data Pump & TTSOracle 21c: New Features and Enhancements of Data Pump & TTS
Oracle 21c: New Features and Enhancements of Data Pump & TTS
 
Postgresql
PostgresqlPostgresql
Postgresql
 
JPA and Hibernate Performance Tips
JPA and Hibernate Performance TipsJPA and Hibernate Performance Tips
JPA and Hibernate Performance Tips
 
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should KnowDBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
 
Crating a Robust Performance Strategy
Crating a Robust Performance StrategyCrating a Robust Performance Strategy
Crating a Robust Performance Strategy
 
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
 
Awesome SQL Tips and Tricks - Voxxed Days Cluj - 2019
 Awesome SQL Tips and Tricks - Voxxed Days Cluj - 2019 Awesome SQL Tips and Tricks - Voxxed Days Cluj - 2019
Awesome SQL Tips and Tricks - Voxxed Days Cluj - 2019
 
Oracle Database 12c "New features"
Oracle Database 12c "New features" Oracle Database 12c "New features"
Oracle Database 12c "New features"
 
Oracle 12c New Features for Developers
Oracle 12c New Features for DevelopersOracle 12c New Features for Developers
Oracle 12c New Features for Developers
 
3.2\9 SSIS 2008R2_Training - ControlFlow Tasks
3.2\9 SSIS 2008R2_Training - ControlFlow Tasks3.2\9 SSIS 2008R2_Training - ControlFlow Tasks
3.2\9 SSIS 2008R2_Training - ControlFlow Tasks
 
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should KnowOTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know
 
Oracle 12.2 sharded database management
Oracle 12.2 sharded database managementOracle 12.2 sharded database management
Oracle 12.2 sharded database management
 
Collaborate 2019 - How to Understand an AWR Report
Collaborate 2019 - How to Understand an AWR ReportCollaborate 2019 - How to Understand an AWR Report
Collaborate 2019 - How to Understand an AWR Report
 

Similar to Liquibase - Open Source version control for your database

Leveraging Open Source for Database Development: Database Version Control wit...
Leveraging Open Source for Database Development: Database Version Control wit...Leveraging Open Source for Database Development: Database Version Control wit...
Leveraging Open Source for Database Development: Database Version Control wit...All Things Open
 
Evolutionary Database Design
Evolutionary Database DesignEvolutionary Database Design
Evolutionary Database DesignAndrei Solntsev
 
Agile Database Modeling with Grails - Preview of GORM 1.4 - SF Grails Meetup ...
Agile Database Modeling with Grails - Preview of GORM 1.4 - SF Grails Meetup ...Agile Database Modeling with Grails - Preview of GORM 1.4 - SF Grails Meetup ...
Agile Database Modeling with Grails - Preview of GORM 1.4 - SF Grails Meetup ...Philip Stehlik
 
Oracle olap-installation
Oracle olap-installationOracle olap-installation
Oracle olap-installationAmit Sharma
 
Configuration Management in Drupal 8: A preview (DrupalCamp Alpe Adria 2014)
Configuration Management in Drupal 8: A preview (DrupalCamp Alpe Adria 2014)Configuration Management in Drupal 8: A preview (DrupalCamp Alpe Adria 2014)
Configuration Management in Drupal 8: A preview (DrupalCamp Alpe Adria 2014)Nuvole
 
XFILES, The APEX 4 version - The truth is in there
XFILES, The APEX 4 version - The truth is in thereXFILES, The APEX 4 version - The truth is in there
XFILES, The APEX 4 version - The truth is in thereMarco Gralike
 
Database Change Management as a Service
Database Change Management as a ServiceDatabase Change Management as a Service
Database Change Management as a ServiceAndrew Solomon
 
Handling Database Deployments
Handling Database DeploymentsHandling Database Deployments
Handling Database DeploymentsMike Willbanks
 
Fargate 를 이용한 ECS with VPC 1부
Fargate 를 이용한 ECS with VPC 1부Fargate 를 이용한 ECS with VPC 1부
Fargate 를 이용한 ECS with VPC 1부Hyun-Mook Choi
 
Liquibase migration for data bases
Liquibase migration for data basesLiquibase migration for data bases
Liquibase migration for data basesRoman Uholnikov
 
Take your database source code and data under control
Take your database source code and data under controlTake your database source code and data under control
Take your database source code and data under controlMarcin Przepiórowski
 
Obevo Javasig.pptx
Obevo Javasig.pptxObevo Javasig.pptx
Obevo Javasig.pptxLadduAnanu
 
Migrating Legacy Data (Ruby Midwest)
Migrating Legacy Data (Ruby Midwest)Migrating Legacy Data (Ruby Midwest)
Migrating Legacy Data (Ruby Midwest)Patrick Crowley
 
Apache Calcite Tutorial - BOSS 21
Apache Calcite Tutorial - BOSS 21Apache Calcite Tutorial - BOSS 21
Apache Calcite Tutorial - BOSS 21Stamatis Zampetakis
 
Play Framework: async I/O with Java and Scala
Play Framework: async I/O with Java and ScalaPlay Framework: async I/O with Java and Scala
Play Framework: async I/O with Java and ScalaYevgeniy Brikman
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDBJustin Smestad
 
Apache Calcite (a tutorial given at BOSS '21)
Apache Calcite (a tutorial given at BOSS '21)Apache Calcite (a tutorial given at BOSS '21)
Apache Calcite (a tutorial given at BOSS '21)Julian Hyde
 
[SSA] 03.newsql database (2014.02.05)
[SSA] 03.newsql database (2014.02.05)[SSA] 03.newsql database (2014.02.05)
[SSA] 03.newsql database (2014.02.05)Steve Min
 
Liquibase – a time machine for your data
Liquibase – a time machine for your dataLiquibase – a time machine for your data
Liquibase – a time machine for your dataNeev Technologies
 

Similar to Liquibase - Open Source version control for your database (20)

Leveraging Open Source for Database Development: Database Version Control wit...
Leveraging Open Source for Database Development: Database Version Control wit...Leveraging Open Source for Database Development: Database Version Control wit...
Leveraging Open Source for Database Development: Database Version Control wit...
 
Evolutionary Database Design
Evolutionary Database DesignEvolutionary Database Design
Evolutionary Database Design
 
Agile Database Modeling with Grails - Preview of GORM 1.4 - SF Grails Meetup ...
Agile Database Modeling with Grails - Preview of GORM 1.4 - SF Grails Meetup ...Agile Database Modeling with Grails - Preview of GORM 1.4 - SF Grails Meetup ...
Agile Database Modeling with Grails - Preview of GORM 1.4 - SF Grails Meetup ...
 
Oracle olap-installation
Oracle olap-installationOracle olap-installation
Oracle olap-installation
 
Configuration Management in Drupal 8: A preview (DrupalCamp Alpe Adria 2014)
Configuration Management in Drupal 8: A preview (DrupalCamp Alpe Adria 2014)Configuration Management in Drupal 8: A preview (DrupalCamp Alpe Adria 2014)
Configuration Management in Drupal 8: A preview (DrupalCamp Alpe Adria 2014)
 
XFILES, The APEX 4 version - The truth is in there
XFILES, The APEX 4 version - The truth is in thereXFILES, The APEX 4 version - The truth is in there
XFILES, The APEX 4 version - The truth is in there
 
Database Change Management as a Service
Database Change Management as a ServiceDatabase Change Management as a Service
Database Change Management as a Service
 
Handling Database Deployments
Handling Database DeploymentsHandling Database Deployments
Handling Database Deployments
 
Fargate 를 이용한 ECS with VPC 1부
Fargate 를 이용한 ECS with VPC 1부Fargate 를 이용한 ECS with VPC 1부
Fargate 를 이용한 ECS with VPC 1부
 
Liquibase migration for data bases
Liquibase migration for data basesLiquibase migration for data bases
Liquibase migration for data bases
 
Take your database source code and data under control
Take your database source code and data under controlTake your database source code and data under control
Take your database source code and data under control
 
Obevo Javasig.pptx
Obevo Javasig.pptxObevo Javasig.pptx
Obevo Javasig.pptx
 
Play framework
Play frameworkPlay framework
Play framework
 
Migrating Legacy Data (Ruby Midwest)
Migrating Legacy Data (Ruby Midwest)Migrating Legacy Data (Ruby Midwest)
Migrating Legacy Data (Ruby Midwest)
 
Apache Calcite Tutorial - BOSS 21
Apache Calcite Tutorial - BOSS 21Apache Calcite Tutorial - BOSS 21
Apache Calcite Tutorial - BOSS 21
 
Play Framework: async I/O with Java and Scala
Play Framework: async I/O with Java and ScalaPlay Framework: async I/O with Java and Scala
Play Framework: async I/O with Java and Scala
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
Apache Calcite (a tutorial given at BOSS '21)
Apache Calcite (a tutorial given at BOSS '21)Apache Calcite (a tutorial given at BOSS '21)
Apache Calcite (a tutorial given at BOSS '21)
 
[SSA] 03.newsql database (2014.02.05)
[SSA] 03.newsql database (2014.02.05)[SSA] 03.newsql database (2014.02.05)
[SSA] 03.newsql database (2014.02.05)
 
Liquibase – a time machine for your data
Liquibase – a time machine for your dataLiquibase – a time machine for your data
Liquibase – a time machine for your data
 

Recently uploaded

Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionOnePlan Solutions
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...SelfMade bd
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park masabamasaba
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfkalichargn70th171
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfonteinmasabamasaba
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...masabamasaba
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastPapp Krisztián
 
%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durbanmasabamasaba
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Hararemasabamasaba
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024Mind IT Systems
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfproinshot.com
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 

Recently uploaded (20)

Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 

Liquibase - Open Source version control for your database

  • 1.
  • 2. Howdy, I’m Blaine CarterHowdy, I’m Blaine Carter Oracle Corporation Developer Advocate for Open Source Email: blaine.carter@oracle.com Blog: learncodeshare.net Twi er: @OraBlaineOS YouTube: www.youtube.com/blainecarter Team: community.oracle.com/docs/DOC- 917690
  • 4. ProblemsProblems Which script has been run? Update or Rollback to a specific version? Test data? → LoadTestData.sql
  • 5. Leveraging Open Source for Oracle Database DevelopmentLeveraging Open Source for Oracle Database Development Cross platform database change management. h p://www.liquibase.org/ h ps://github.com/liquibase/liquibase
  • 6. Version Control / Change ManagementVersion Control / Change Management The BasicsThe Basics Track changes Rollback / Switch to a specific revision Branch / Merge Diffs
  • 7. What is Liquibase?What is Liquibase?
  • 8. Liquibase is change management for your database. Database changes are made using changeSets. When you run an update, the changeSets are run in order. Liquibase tracks what has been run, when and who ran it. You can roll back to a specific version. Populate default and/or test data. Contexts - Diffs - Documentation - SQL Output - Offline - h p://www.liquibase.org/documentation/contexts.html h p://www.liquibase.org/documentation/diff.html h p://www.liquibase.org/documentation/dbdoc.html h p://www.liquibase.org/documentation/sql_output.html h p://www.liquibase.org/documentation/offline.html
  • 9. How Does It Work?How Does It Work? Changelog Master Change Sets XML JSON SQL* Groovy Others..
  • 10. Changelog MasterChangelog Master {"databaseChangeLog": [ {"include": {"file": "runOnce/DD_DEQUEUE_ERRORS_T.createTable.json"}}, {"include": {"file": "runOnce/DD_DINOSAURS_T.createTable.json"}}, {"include": {"file": "runOnce/DD_LOCATIONS_T.createTable.json"}}, {"include": {"file": "runOnce/DD_MEMBERS_T.createTable.json"}}, {"include": {"file": "runOnce/DD_MESSAGES_T.createTable.json"}}, {"include": {"file": "runOnce/DD_SEED_DATA_T.createTable.json"}}, {"include": {"file": "runOnce/DD_SETTINGS_T.createTable.json"}}, {"include": {"file": "runOnce/DD_TEMPLATES_T.createTable.json"}}, {"include": {"file": "runOnChange/views/viewsMaster.json"}}, {"include": {"file": "runOnce/DD_USER_PAYMENT_TYPE.createSynonym.json"}}, {"include": {"file": "runOnChange/triggers/triggersMaster.json"}}, {"include": {"file": "runOnChange/functions/functionsMaster.json"}}, {"include": {"file": "runOnChange/procedures/proceduresMaster.json"}}, {"include": {"file": "runOnChange/packages/packagesMaster.json"}}, {"include": {"file": "runOnce/DD_Load_Data.json"}}, {"include": {"file": "runOnce/DD_Setup_Text_Search.json"}} ]}
  • 11. ChangesetChangeset { "databaseChangeLog": [{ "preConditions": [{ "runningAs": { "username": "dd" } }] }, { "changeSet": { "id": "1507062717550-4", "author": "bcarter (generated)", "changes": [{ "createTable": { "tableName": "DD_MEMBERS_T", "columns": [{ "column": { "name": "MEMBER_ID", "type": "NUMBER(, 0)", "autoIncrement": true, "constraints": {
  • 12. Java Command LineJava Command Line java $JAVA_OPTS -jar /opt/liquibase/liquibase.jar --driver=oracle.jdbc.OracleDriver --classpath="/usr/lib/oracle/12.1/client64/lib/ojdbc7.jar" --url=jdbc:oracle:thin:lb_demo/dd@dbatp_medium --changeLogFile=changelog/db.changelog-master.json updateSQL >> output.sql options --logLevel=DEBUG --logFile=liquibase.logFile $JAVA_OPTS is used for my Oracle Autonomous Transaction Processing cloud connection.
  • 13. Properties FileProperties File (liquibase.properties)(liquibase.properties) driver: oracle.jdbc.OracleDriver classpath: /usr/lib/oracle/12.1/client64/lib/ojdbc7.jar url: jdbc: oracle:thin:lb_demo/dd@dbatp_medium changeLogFile: changelog/db.changelog-master.json
  • 14. LiquibaseLiquibase BestBest Recommended PracticesRecommended Practices Ignore the directory structure I’m using in the demo’s. h p://www.liquibase.org/bestpractices.html
  • 15. So ware We’ll Be UsingSo ware We’ll Be Using DinoDate SQL Developer Oracle Autonomous Transaction Processing Cloud Database or Virtual Box Atom Text Editor Liquibase - h ps://github.com/oracle/dino-date h p://www.liquibase.org
  • 16. InstallInstall Download - It's just Java, extract it and go. h p://www.liquibase.org/download/index.html
  • 17. Enough blah blah, let's see it.Enough blah blah, let's see it.
  • 18. Create Changelog and ChangeSet FilesCreate Changelog and ChangeSet Files Changelog Example: - step 1 Changeset Example: - step 2 Recommended to only perform one change per Change set, but you can do more if you need. h p://www.liquibase.org/quickstart.html h p://www.liquibase.org/quickstart.html
  • 19. Run ItRun It - step 3 Jar File: java $JAVA_OPTS -jar /opt/liquibase/liquibase.jar updateSQL Shell Script: liquibase updateSQL Batch File: liquibase.bat updateSQL Put the Liquibase directory in your path and run it: liquibase update The shell script / batch files use the same JAVA_OPTS environment variable for my Autonomous Transaction Processing Cloud connection. h p://www.liquibase.org/quickstart.html
  • 20. Rollback X Number of Change SetsRollback X Number of Change Sets Warning: Rolling back anything in the database can be tricky. Be very careful if you do this in Production. liquibase rollbackCount 1
  • 21. Tag a ChangesetTag a Changeset You can tag a changeset in the file: You can also use the command line: "changeSet": { "id": "1", "author": "BlaineCarter", "tagDatabase": {"tag":"ver-1"}, "changes": [ liquibase tag ver-1
  • 22. Rollback to TagRollback to Tag Other Options: h p://www.liquibase.org/documentation/rollback.html liquibase rollback ver-1 h p://www.liquibase.org/documentation/command_line.html
  • 23. Load Data From a FileLoad Data From a File groups.csv "changes": [ { "loadData": { "file": "changelog/groups.csv", "schemaName": "lb_demo", "tableName": "lb_groups" } }] name,description Trucks,People who like trucks Rockets,People who like rockets Horses,People who like horses Snakes,People who like snakes
  • 24. Insert DataInsert Data "changes": [ { "insert": { "schemaName": "lb_demo", "tableName": "lb_people", "columns": [ { "column": { "name": "firstname", "value": "Bob" } }, { "column": { "name": "group_id", "valueComputed": "(SELECT id FROM lb_groups where name = 'Trucks')" } } ...
  • 25. Context: TestContext: Test In the change set: Liquibase.properties Command Line overrides the properties file: Context vs Labels "changeSet": { "id": "loadData-example", "author": "liquibase-docs", "context": "test", contexts: !test liquibase --contexts=test update h p://www.liquibase.org/2014/11/contexts-vs-labels.html
  • 26. Data Changes Are NOT Automatically RolledData Changes Are NOT Automatically Rolled Back.Back. Define your own Rollback { "rollback": { "delete": { "tableName": "lb_people" } } }
  • 27. DiffDiff Command Line: Liquibase.properties: h p://www.liquibase.org/documentation/diff.html liquibase.sh --url=jdbc:oracle:thin:lb_demo/dd@unknownDB diff --referenceUrl=jdbc:oracle:thin:lb_demo/dd@goodDB referenceUrl: jdbc:oracle:thin:lb_diff_demo/dd@dbatp_medium
  • 28. Generate Changelog (Reverse Engineer)Generate Changelog (Reverse Engineer) Note that this command currently has some limitations. It does not export the following types of objects: Stored procedures, functions, packages & Triggers h p://www.liquibase.org/documentation/generating_changelogs.html liquibase --changeLogFile=generated.json generateChangeLog
  • 29. Review The OutputReview The Output The output won’t be perfect. Generated by update: Generated by generateChangeLog: id INTEGER GENERATED BY DEFAULT AS IDENTITY NOT NULL ID NUMBER(*, 0) DEFAULT "LB_DEMO"."ISEQ$$_69966".nextval NOT NULL
  • 30. DBDocDBDoc liquibase DBDoc docs h p://www.liquibase.org/documentation/dbdoc.html
  • 31. Extensions / PluginsExtensions / Plugins h ps://liquibase.jira.com/wiki/display/CONTRIB/LiquiBase+Extensions+Portal
  • 32. We Can Make It Be erWe Can Make It Be er h p://www.liquibase.org/ GitHub Repo: Fork Change Pull Request h ps://github.com/liquibase/liquibase There are many ways to contribute. Enhance code Add tests Improve documentation Submit / review issues
  • 33. Howdy, I’m Blaine CarterHowdy, I’m Blaine Carter Oracle Corporation Developer Advocate for Open Source Email: blaine.carter@oracle.com Blog: learncodeshare.net Twi er: @OraBlaineOS YouTube: www.youtube.com/blainecarter Team: community.oracle.com/docs/DOC- 917690
  • 34. #11 liquibase updateSQL liquibase update #12 liquibase rollbackCount 1 liquibase update #13 liquibase update liquibase tag myCoolTag #14 liquibase rollback ver-1 liquibase update #15 liquibase update #17 liquibase --contexts=test update #18 liquibase rollbackCount 2 liquibase rollbackCount 1 liquibase --contexts=test rollbackCount 2 liquibase --contexts=test update #19 liquibase diff liquibase --diffTypes=tables,columns diff liquibase diffChangeLog #20 liquibase --changeLogFile=generated.json generateChangeLog #22 liquibase dropAll liquibase DBDoc docs liquibase update liquibase DBDoc docs Commands Used For The Demo (by slide number)Commands Used For The Demo (by slide number)