Using Liquibase with Oracle

Creating New Liquibase projects with Oracle – Windows

The purpose of this document is to guide you through the process of creating a new Liquibase project with Oracle on a Windows machine. In this tutorial, you will generate an example project and follow the instructions to apply and learn concepts associated with creating new Liquibaseprojects with Oracle.


Note: Place the ojdbc jar driver file in a known directory so you can locate it easily.

Example: C:\Users\Liquibase_Drivers\ojdbc8.jar


To create a Liquibase project with Oracle on your Windows machine, begin with the following steps:

  • Create a new project folder and name it LiquibaseProj.
  • In your LiquibaseProj folder, right-click and select New > Text Document to create an empty text file.
  • Rename the text file to dbchangelog.xml. changelog files contain a sequence of changesets, each of which make small changes to the structure of your database. Instead of creating an empty changelog file, you can also use an existing database to generate a changelog. In this tutorial, you will manually add a single change. To add this change:
  • Open the dbchangelog.xml file and update the changelog file with the following code snippet:
<?xml version="1.0" encoding="UTF-8"?>	
  • In your LiquibaseProj folder, right-click and select New > Text Document to create a new text file.
  • Rename the text file to
  • Edit the file to add the following properties:
changeLogFile: dbchangelog.xml
url: jdbc:oracle:thin:@localhost:1521/ORCL
username: MYSCHEMA
password: password
classpath: ../path/to/Liquibase_Drivers/ojdbc8.jar

Because you are creating this project on Windows OS, you must specify the path with double slashes in the changeLogFile property. You must also use a relative path from your project directory to the driver ojdbc jar file location in the classpath property.

Note: If you already have a Liquibase Pro key and want to apply it to your project, add the following property to your file: liquibaseProLicenseKey: <paste license key>.

  • Adding a changeset to the changelogchangesets are uniquely identified by “author” and ”id” attributes. Liquibase attempts to execute each changeset in a transaction that is committed at the end. In the dbchangelog.xml file, add a new “department” create table changeset as follows:
<?xml version="1.0"  encoding="UTF-8"?>
<databaseChangeLog xmlns=""

    <changeSet id="1"  author="bob">
        <createTable tableName="department">
            <column name="id"  type="int">
                <constraints primaryKey="true"  nullable="false"/>            
	    <column name="name"  type="varchar(50)">
                <constraints nullable="false"/>            
	    <column name="active"  type="boolean" defaultValueBoolean="true"/>        

Note: This create table cchangeset is XML format. The corresponding SQL statement should look like the following:

CREATE TABLE "department" 
(  	"id" number(*,0),
	"name" VARCHAR2(50 BYTE),
	"active" NUMBER(1,0) DEFAULT 1
  • Open the command prompt. Navigate to the LiquibaseProj directory.
    Run the following command:

liquibase update
  • From SQL Developer Tool, check your database changes under MYSCHEMA. You should see a new department table added to the database. For example:

SELECT * FROM my_schema.department;

Also, you should see two more tables:

  • DATABASECHANGELOG tracking table – This table keeps a record of all the changesets that were deployed. This way, next time when you deploy again, the changesets in the changelog will be compared with the DATABASECHANGELOG tracking table and only the new changesets that were not found in the DATABASECHANGELOG will be deployed. You will notice that a new row was created in that table with the changeset information we have just deployed. For this example:
1 bob dbchangelog.xml date&time 1 EXECUTED checksumvalue
  • DATABASECHANGELOGLOCK – This table is used internally by Liquibase to manage access to the changelog table during deployment.