Part 4. D.O.M.E & Oracle Database

In this article, I will give you a general idea and test the basic functionalities of a tool called D.O.M.E - Deployment Organization Made Easy. The tool was created by Zoran Tica, whom I met at the APEX Alpe Adria conference in 2023 (I promised him to test it then, but "better late than never").

Read more about test prerequisites in my "Introduction" blog post here.

What is D.O.M.E?

It's a shortcut from Deployment Organization Made Easy.

DOME for Oracle database and APEX is a utility, which helps developer teams developing in PL/SQL and APEX to organize and speed-up development and deployment processes and installation scripts production.

You can find the D.O.M.E code repository here and some tutorial videos from the author here.

D.O.M.E. is created for use with Oracle Database and Oracle APEX. It isn't a deployment tool—it tracks changes and creates installation scripts.

In my test I will cover it's basic functionality of tracking database schema changes (APEX tracking will not be covered in this blogpost)

Test

1.Installation, Configuration & Connection to the database

Installation

  • Download the newest version 6.0 into /dome/ folder.

  • Create a new DB user called DOME and add grants:

      --scripts for OCI
      CREATE USER DOME IDENTIFIED BY Qwerty12345$;
      GRANT DWROLE TO DOME;
      GRANT CONNECT to DOME;
      GRANT SELECT ON DBA_OBJECTS TO DOME;
      GRANT EXECUTE ON DBMS_CRYPTO TO DOME;
      GRANT SELECT ON DBA_TAB_COLUMNS TO DOME;
      GRANT APEX_ADMINISTRATOR_READ_ROLE TO DOME;
      ALTER USER DOME QUOTA UNLIMITED ON DATA;
      --for NON OCI, take scripts from /DOME/install/DOME_DB_user.sql
    
  • Create a new APEX workspace DOME and install the application using /dome/install/dome.sql. The installation wizard will guide you through all the steps.

  • There were some installation issues, but I could ignore them because they were only related to the order of objects.

  • Now, I can log into the D.O.M.E application using default admin/admin credentials.

  • Looks nice :)

Configuration & Connection

Add schema HR to monitored schemas

  • I want to track changes made in my HR schema, so I've added it to monitored schemas using the D.O.M.E. GUI interface:

  • Application guides me with all configuration and scripts I need to execute for configuration(thanks for the "copy" button :) )

  • I executed "A script for the schema where DOME is installed" as a DOME user and "A script for the monitored schema" as an HR user.

  • You also need to add "Database schemas":

Configure proxy users

  • The next step is to set up a proxy user to make changes in the HR schema. I created user RAFAL for that.

      --create user
      --run as ADMIN / SYS
      CREATE USER RAFAL IDENTIFIED BY Qwerty12345$;
      GRANT DWROLE TO RAFAL;
      GRANT CONNECT to RAFAL;
      ALTER USER RAFAL QUOTA UNLIMITED ON DATA;
      --set up proxy to connect HR using user RAFAL
      ALTER USER HR GRANT CONNECT THROUGH RAFAL;
    

Configure DOME users and link a DOME user with the proxy user.

  • I've created a new application user called RAFAL, which is connected to my proxy user called RAFAL.

    If there are more developers in the team, create proxy user and D.O.M.E. user for each of them.

Set up a connection in SQL Developer:

select sys_context('userenv','session_user') as session_user, 
       sys_context('userenv','session_schema') as session_schema,
       sys_context('userenv','current_schema') as current_schema,
       sys_context('userenv','proxy_user') as proxy_user
from   dual;

Everything is configured, and the D.O.M.E. is connected to my HR schema—from now on, all DDL changes in this schema will be tracked.

2. Tracking database schema changes using D.O.M.E.

As I mentioned in my introduction blog post, I will make some changes in my database schema in the DEV environment.

But first, there are some pre-steps to take in the D.O.M.E.

Steps to do using D.O.M.E

  • Log in to the D.O.M.E. app using RAFAL (I've created an RAFAL user in D.O.M.E. using a predefined admin account)

  • I will also use schema user RAFAL to change my HR objects (I've created it a few steps ago).

Create a project (Projects -> Create)

  • Add project database schema and set it as default:

  • Set project settings (will be auto-set from versions > 6.0)

  • Set project environments

Create task group (Task groups-> Create)

Create a task under the task group (Tasks->Create)

Start working on a patch

  • Click "Start"

Okay, now I will make some changes in the HR schema (in the DEV environment) using my proxy user RAFAL (directly in SQL developer)

  1. Insert a new row into the table COUNTRIES.
INSERT INTO HR.COUNTRIES (COUNTRY_ID, COUNTRY_NAME, REGION_ID) VALUES ('PL', 'Poland', '10');

This is DML, and it's not tracked automatically. So, I will add this script manually to D.O.M.E.

My DML is now added to the patch for FEATURE 1.

  1. Create a new table PARAMETERS

Now, being in the patch section, I clicked "refresh":

My new table was detected and automatically added to the D.O.M.E. patch - impressive.

Ok, it's time for the next changes.

  1. Add a new column to the existing table EMPLOYEES
  ALTER TABLE HR.EMPLOYEES 
  ADD (ADDRESS VARCHAR2(100) );
  1. Change existing procedure SECURE_DML

     create or replace procedure HR.SECURE_DML
     is
     begin
        if TO_CHAR(SYSDATE, 'HH24:MI') not between '08:00' and '18:00'
           or TO_CHAR(SYSDATE, 'DY') in ('SAT', 'SUN')
        then
           RAISE_APPLICATION_ERROR(-20205,
                                   'You may only make changes during normal office hours (this bracket is a change)');
        end if;
     end SECURE_DML;
     /
    

Refresh patch again:

And one last change that I will manually add to D.O.M.E. scripts

  1. Insert new rows into the newly created table PARAMETERS
INSERT INTO HR.PARAMETERS (name, value) VALUES ('MY_BLOG_URL','rafal.hashnode.dev');

Deploy DEV objects to PROD

I've made all the changes I wanted, and D.O.M.E. tracks them all in my patch for FEATURE1.

Now, I want to prepare a script that I could easily deploy to my PROD environment.

I confirmed my patch:

And I'm ready to download my patch:

Let's have a quick look at what's inside:

Basically, the script is ready to deploy. There are three steps in the script:

  1. D.O.M.E. need to connect to DEV (where it is installed) and mark that installation of the patch will start at the selected environment

  2. Scripts from downloaded patch will be deployed to my PROD

  3. D.O.M.E. will connect DEV and mark the installation patch as completed and deployed to PROD.

I deployed the script using SQLplus, and all my database object changes were deployed to my PROD environment.

And when we look into D.O.M.E. at DEV, there is an info about this deployment:

BONUS - D.O.M.E's feature you won't find anywhere else

Ok, the blog should end now, but D.O.M.E. has a feature I must mention.

I bet you all know those situations when you overwrite each other's changes, especially when working on the same package, view, or procedure, right?

Let me quickly show you that feature in my simple example:

  • I have two proxy users connecting to the HR schema (RAFAL and JOHN) and two users in the D.O.M.E application.

  • RAFAL and JOHN created their patches and started work:

  • They are not communicating (how true, isn't it?) and will try to change the same procedure, HR.SECURE_DML

  • Now, RAFAL is changing the procedure directly in SQL developer:

  • This change was detected by D.O.M.E. and added to Rafal's patch:

  • Now, John is trying to change the same procedure:

    Oooops, hey John, maybe it's time to communicate with each other? :)

    Nice feature, isn't it?

Summary

I hope this blog post gave you a general idea of working with D.O.M.E. and Oracle Database.

Drop me a comment if you have any questions or feedback.

In a special edition of my blog series, I will cover D.O.M.E. and its APEX tracking features.

Want to know more? Visit the links in the table below.

Rafal

Other tested tools

Tool review & testOfficial documentation
Liquibase (standalone Open-Source edition)LinkDoc
Oracle SQLcl with LiquibaseLinkDoc
Flyway Community EditionLinkDoc
D.O.M.E - Deployment Organisation Made EasyLinkDoc, Videos
Oracle’s SQLcl “Project” featureLinkDoc
ADT - APEX Deployment ToolNot published yetDoc
dbFlowNot published yetDoc