If you asked me to pick a favorite of these three, I’d HAVE to pick SQLcl, but all make a very compelling case.

Liquibase is an open source project for controlling/managing database updates. We’ve enhanced it for Oracle Database in SQLcl. All of my Liquibase posts can be found here.

OCI Cloud Shell is a Shell prompt built into the web console for Oracle Cloud Infrastructure (OCI).

In a previous post, I talked about running SQLcl in OCI CLoud Shell.

We try to make it as painless as possible to get a working SQL prompt for your database.

In this post, I want to combine all three to demonstrate something very cool!

Generating SQL files and comparing them

A somewhat recent edition to our ‘generate-schema’ command in SQLcl, is the ability to both put the resulting files in different directories, grouped by object type, AND to generate corresponding SQL files.

By default, the Liquibase command will generate only XML files, all in one directory together.

liquibase generate-schema -split -sql

The ‘-split’ is pretty obvious, and the ‘-sql’ is too, but let’s visit the help topic anyways.

-sql {true|false}

Generate a SQL file along with the changelog showing the DDL for the object. This SQL is not intended for anything other than review.

The SQL files won’t be used for updates, but they WILL be available for developers to review and to quickly perform DIFFs to see how their objects are evolving over time.

In most cases, comparing XML side by side isn’t as illustrative as comparing two text-based SQL files.

Once the file has completed, in my CWD, I’ll see my controller.xml file, and a few directories. If I look inside the ‘table’ directory, I see both an XML and SQL file for each table.

‘customer_table.xml’ is a changeSet for my CUSTOMER table.

Now, in addition to using Cloud Shell’s terminal prompt, I want to use the new ‘Code Editor.’

Click there.

In a few moments, you’ll now have two panels open in the footer of your browser.

I can now open files, use the file explorer…and do DIFFs!

Whiz bang!

How to compare files in OCI Code Editor?

  1. View Explorer
  2. Navigate your directory structure, find both files, open
  3. In Open Editors, select file one, choose ‘Select for Compare’
  4. Select second file, choose ‘Compare with Selected’

And that’s it!

Here’s a better look.

If you think that looks like VS Code, you’d be close. It’s the Eclipse Theia framework.

I'm a Distinguished Product Manager at Oracle. My mission is to help you and your company be more efficient with our database tools.

Write A Comment