Learn SQLcl Liquibase in 6 Minutes and Save Time in Your Software Development DevOps
Time is something we can all use more of. The more you need it the less you have to waste. In the spirit of this, in less than 6 minutes I’m going to introduce you to and explain an entire free technology that can save you time during your software development process.
There are a lot of fun toys that we make for our customers here at Oracle. My job is great because the tools our team specifically makes are all completely free. This means we just have to show you why it’s worth using, not convince you to buy it. Our biggest fear is that people simply aren’t aware of features they would find really helpful.
One of these tools that I’m going to give some love to today is SQLcl Liquibase. I think a lot of people will find it useful. We’ve been working on this one a lot lately and I’m very excited about it.
So let’s get into it.
What is SQLcl Liquibase?
SQLcl Liquibase is a database change management tool that allows you to capture, version, and deploy database changes. It does this through automation, so less manual tedious work in your life and it’s done in a way that makes the process extremely simple.
Why Are We Talking About Database Right Now? I Thought We Were Going to be Talking About Software Development?
Developers need databases. These databases need to be properly configured so that you have the data objects you need for your work. One of the major challenges we’ve found in the software development process is that a lot of time and resources go into just getting development environments set up properly.
Code is constantly getting committed to new software builds so databases need to be consistent and up to date for teams to stay in sync with the environments they need. This process requires a lot of manual work, is tedious, and error prone. SQLcl Liquibase can help with this problem.
Got It. Could You Explain a Little More What SQLcl Liquibase Is?
So with SQLcl Liquibase all the manual work you do like recreating tables, making sure your database object change scripts are properly working, and rolling back unwanted alterations can all be automated making your life a whole lot easier.
You capture database objects such as tables, procedures, and constraints with one of the liquibase generate commands which then saves these objects to files called changelogs.
Within changelogs are changesets which are the set of instructions for the actual database changes being applied. This is what is being read when you run the liquibase update command to recreate the database objects you saved in your changelogs.
With SQLcl Liquibase you can capture database objects on one user schema and use the changelogs to recreate these objects on a different user or Oracle Database entirely.
How is SQLcl Liquibase Different from Open-Source Liquibase?
SQLcl Liquibase is built on top of the open-source Liquibase platform and contains all of its great capabilities with much more extended functionality.
We’ve added commands optimized for:
Capturing the entire Oracle Database schema
Individual objects
We’ve also added extra capabilities such as:
Dynamic Object Transformation - which allows you to alter pre-existing objects in your database.
An example would be applying a changelog that adds or drops columns from a table. This scenario fails in open-source Liquibase because it cannot handle object alterations and will give you a “name is already used by an existing object” error.
The ability to read changelogs in the open-source Liquibase format
Great for carrying projects over from open-source Liquibase to SQLcl Liquibase
The ability to generate changelogs in the open-source Liquibase format
This is perfect if you want to work with Liquibase inside SQLcl but have environments you can’t migrate off open-source Liquibase yet
SQLcl Liquibase is exclusively for the Oracle Database and included under Oracle Support.
What Is SQLcl?
SQLcl (Structured Query Language command line) is a free tool for the Oracle Database that lets you connect to your database and execute SQL, PL/SQL, and SQL*Plus commands directly from the command line.
It’s a modern replacement to SQL*Plus, our legacy command line interface solution for working with the Oracle Database. SQLcl contains all of SQL*Plus’s commands and more.
SQLcl comes packed with a lot of goodies including:
Query History
Formatting Options
Code Completion
Customizable Status Bar
vi & EMACS Text Editor Support
Oracle Data Pump - our data transfer tool
It’s available on Windows, Mac, Linux, and is also automatically embedded in Cloud Shell, our command prompt for Oracle Cloud Infrastructure (OCI). You can download it directly from our website
What Are the Most Important SQLcl Liquibase Commands I Need to Know?
In SQLcl all the Liquibase commands are accessed in the format liquibase [command name]
You can access the help command which gives you a list of all Liquibase commands with descriptions with liquibase help.
If you want help for a specific command and a list of its optional parameters use liquibase help [command name]
The major commands you will come across are:
The Generate Commands - commands for capturing database objects into files called changelogs. They include:
generate-schema - capture an entire Oracle Database schema
generate-object - capture an individual database object
generate-ords-schema - capture all Oracle REST Data Service (ORDS) modules
generate-apex object - capture an Oracle APEX object
The Update Commands - read changelogs to create the database objects specified within them
update - run a changelog and create the database objects in it
update-sql - review the SQL that will execute before running a changelog
The Rollback Commands - Undo changelog changes
tag - bookmarks the current state of the database. Used to rollback changelogs applied to the database after the point marked.
rollback - undoes the changelogs applied after the tag specified
See here for the full command list for SQLcl 22.4.
What is DevOps and CI/CD?
The main objective of SQLcl Liquibase is to help you save time, energy, and money by freeing yourself of repetitive, tedious, and error prone tasks so that your DevOps and CI/CD processes are more efficient.
DevOps is a combination of software development (Dev) and IT operations (Ops). It is a philosophy aimed at seeking to shorten the software development lifecycle through the investigation and application of tools and practices. Traditionally, a DevOps centered mindset seeks to erode the silos between development and operations teams so that better communication, collaboration, and automation can be achieved.
Continuous Integration/Continuous Delivery (CI/CD) falls within the umbrella of DevOps and specifically focuses on the combined practices of continuous integration and continuous delivery.
Continuous Integration (CI) is the act of regularly and frequently integrating your code changes into the main branch of your team’s shared code repository.
Continuous Integration done efficiently and effectively seeks to automate the tasks of:
Creating new builds when you merge your code changes to your team’s repository
Running tests against these builds
While Continuous Integration focuses on automatically creating software builds from your team’s changes and testing them, Continuous Delivery (CD) by extension focuses on streamlining the software release process and seeks to deploy changes to production as early as possible and frequently. This breaks up released software changes into smaller batches making it easier to identify, troubleshoot, and address bugs.
The CD in CI/CD along with referring to Continuous Delivery, can additionally (and less frequently) refer to Continuous Deployment. While groups might vary on their specific interpretations of the difference between Continuous Delivery and Continuous Deployment, it is generally considered that Continuous Delivery is focused on creating simple and repeatable delivery steps to release software, which often includes automating elements of this process, whereas Continuous Deployment is about intentionally seeking to automate the entire release process or as much of it as possible.
We’re Considering Oracle Database But Don’t Have It Yet. Any Way We Can Try SQLcl Liquibase?
Oracle offers OCI Cloud Free Tier which allows you to create a database and try SQLcl and Liquibase on our cloud platform for free.
Additionally, I’m currently creating a free hands-on walkthrough of SQLcl Liquibase on our LiveLabs platform. I’ll update this page when it is live.