Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Change Management for Oracle Database with SQLcl

662 views

Published on

Liquibase and SQLcl to mange changes/upgrades in your application schemas for Oracle Database.

Published in: Technology
  • Be the first to comment

Change Management for Oracle Database with SQLcl

  1. 1. Copyright © 2019 Oracle and/or its affiliates. All rights reserved. | Jeff Smith Master Product Manager Jeff.d.smith@oracle.com || @thatjeffsmith Database Tools, Oracle Corp 1 Application Schema Lifecycle Management with Oracle SQLcl
  2. 2. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Not Just THAT SQLDev Guy… • Database Development Tools team • Product manager/story teller • I bother help people online, everywhere • Contact me for a free remote presentation for your group/company – Jeff.d.smith@oracle.com – @thatjeffsmith – https://www.thatjeffsmith.com
  3. 3. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | thatJeffSmith on • 60+ Videos • Feature demos • Tips & Tricks • Short & Long Form – SQL Developer – SQLcl – Data Modeler – ORDS
  4. 4. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
  5. 5. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Safe Harbor Statement The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle. 5
  6. 6. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | v3..vNUpgrade v2Deploy v1 Back to v2 ??? Rollback! Problem: App Schema Lifecyle Management …
  7. 7. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | 1. Home grown solution 2. Hand-crafted scripts 3. Liquibase|Flyway 4. Something else? Poll: How are you doing this today?
  8. 8. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | For Free • less code • familiar, friendly interface • we’ll handle dependency ordering • track changes for downgrades Our Solution: Leverage Liquibase & make it easy
  9. 9. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Liquibase – “Source Control for your Database” • open source • deploy versions for your Oracle schema • go forwards or backwards • ‘changesets’
  10. 10. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Liquibase – changesets • XML • JSON • YAML • SQL
  11. 11. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Liquibase – controller/master => lots of changelogs
  12. 12. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Liquibase – DATABASECHANGELOG TABLE “Liquibase uses the DATABASECHANGELOG table to track which changeSets have been ran.”
  13. 13. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | • Executable via command line, • Apache Ant, • Apache Maven, • servlet container, • Spring Framework. Liquibase – How it runs
  14. 14. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Liquibase – Built into Developer Cloud Service
  15. 15. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Liquibase – Gives you a lot, for FREE, but… • …you write the upgrade AND rollback code for each db changelog • You worry about the order of changelogs to be applied
  16. 16. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | 16 The SQL Developer Family Time Tested Launched in 2005 An Industry Standard 5M+ Oracle DBAs & Developers Always Improving Quarterly Releases 4
  17. 17. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | SQLcl – a Modern CLI for Oracle Database • 25MB download, only requires a JRE • SQL*Plus features, but much, much more • Updated quarterly • 11gR2 & Higher • Avail in OCI YUM, OTN, and DB $ORACLE_HOME
  18. 18. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Liquibase – “Source Control for your Database” • An Open Source project – made easy with SQLcl, for free • GEN schema/object as LB changelogs (XML via DBMS_METADATA) • Objects automatically sorted for creation/updates • Easily rollback to previous state • Preview proposed DDL for an UPDATE • NEW for v19.2
  19. 19. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Help & Documentation Examples
  20. 20. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | How it works • Liquibase (lb) command is built into SQLcl • Use DBMS_METADATA to generate XML used in changelogs • Collects for connected USER, writes to $SQL_PATH • On deployment: – we capture current status and write to table for a rollback – use our parser to scrape the XML and determine creation order
  21. 21. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Let’s do a demo: capture and deploy • Create a directory to hold our changelogs • Login as the schema we want to capture • >lb genschema • Login as the schema we want to deploy to • >lb update <file.xml> false
  22. 22. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Scenario: Adding a Column for v2
  23. 23. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Scenario: Adding a Column > Changelog
  24. 24. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Scenario: Adding a Column > Push It
  25. 25. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Scenario: Adding a Column > Rollback! • No code written to handle rollback! • ‘5’ arbitrary large number – I want everything undone • DESC > INFO when you need terse screenshots 
  26. 26. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Real Scenario: Capture, Destroy, Deploy ORDS + APEX • Stood up APEX and ORDS 19.x • LB GENSCHEMA for both • DROP USER APEX_... CASCADE; • LB UPDATE to bring them back!
  27. 27. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | You don’t have to use SQLcl, just stick this in your classpath
  28. 28. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Application Express (APEX) / RESTful Services?
  29. 29. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Availability • LB command scheduled for SQLcl version 19.2 • Coming to you, SOON • Follow @oraclesqlcl for updates & product news

×