Friday, August 30, 2024

Native PL/SQL Application to Capture Source Code and Configuration Data

I recently completed development and testing on the open source project ODBCapture.

ODBCapture is a native PL/SQL application that can be used to capture self-building scripts (source code and configuration data) for a database.

Existing tools like TOAD, PL/SQL Developer, and SQL*Developer can create “source code” scripts from an Oracle database. They can also create data load scripts from an Oracle database. What they cannot do is create a cohesive set of installation scripts that execute from a single “install.sql” script.

Existing database source code is handled by Liquibase and Flyway which are “diff” engines. These “diff” engines simply track changes to a database. Rarely is the source code from these “diff” engines ever used to create a database from nothing. Typically, the database source code from these “diff” engines require some existing database to get started.

ODBCapture is not a “diff” engine. ODBCapture is unique in its ability to create Oracle database installation scripts that can create different “flavors” of Oracle databases from a common set of source code. This installation occurs after an initialization to an empty database or PDB, such as:

  • Create Database …
  • Create Pluggable Database …
  • Drop Schema …

The published website is https://odbcapture.org

ODBCapture has been successfully tested on these platforms (Click the link).

ODBCapture has been successfully tested on these database object types:

  • Advanced Queue
  • Advanced Queue Table
  • Context
  • Database Link
  • Database Trigger
  • Directory
  • Foreign Key (psuedo-object)
  • Grant, Database Object (psuedo-object)
  • Grant, System Privilege (psuedo-object)
  • Host ACL (psuedo object)
  • PL/SQL Function
  • Java Source
  • Index
  • Materialized View
  • Materialized View Index
  • Materialized View Foreign Key
  • Materialized View Trigger
  • Package Body
  • Package Specification
  • PL/SQL Procedure
  • RAS ACL (psuedo-object)
  • Role
  • Scheduler Job
  • Scheduler Program
  • Scheduler Schedule
  • Sequence
  • Schema Trigger
  • Synonym
  • Table
  • Table Index
  • Table Foreign Key
  • Table Trigger
  • Type Body
  • Type Specification
  • User
  • View
  • View Foreign Key
  • View Trigger
  • Wallet ACL (psuedo-object)
  • XDB ACL (psuedo-object)

ODBCapture has been successfully tested on these database data types:

    • BLOB
    • CHAR
    • CLOB
    • DATE
    • INTERVAL_DAY_TO_SECOND
    • JSON
    • NUMBER
    • RAW
    • TIMESTAMP
    • TIMESTAMP_WITH_LOCAL_TZ
    • TIMESTAMP_WITH_TZ
    • VARCHAR2
    • XMLTYPE


    Monday, August 19, 2024

    GitHub Pages Jekyll Theme Google Analytics Update

     Let's breakdown that title:

    • GitHub Pages - a website hosting feature in GitHub
    • Jekyll Theme - a static site generator with built-in support for GitHub Pages.
    • Google Analytics Update - Google Analytics 4 is the next generation of Analytics which collects event-based data from both websites and apps
    If you are using Jekyll Themed GitHub Pages with Google Analytics and haven't found the simplest way to convert it from Universal Analytics to GA4, this is your "how to"...

    Jekyll Themes


    Universal Analytics was a simple setup before GA4.  The "_config.yml" included a "google_analytics:" location where the Universal Analytics ID would activate the needed website changes to begin data collection.  With GA4 the new Measurement ID replaces the Universal Analytics ID.  However, the website activation is different for GA4.  Fortunately, the creators of Jekyll Themes included a place to update this new website activation.

    Head Custom Google Analytics


    GutHub Pages has several supported Jekyll Themes.  Each of these themes has an "_includes/head-custom-google-analytics.html" file.

    Within the "_includes/head-custom-google-analytics.html" file is the website activation code:
    {% if site.google_analytics %}
      <script>
        (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
        (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
                m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
            })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
        ga('create', '{{ site.google_analytics }}', 'auto');
        ga('send', 'pageview');
      </script>
    {% endif %}
        
    That code needs to be changed to the new data collection script:
    {% if site.google_analytics %}
      <!-- Google tag (gtag.js) -->
      <script async src="https://www.googletagmanager.com/gtag/js?id={{ site.google_analytics }}"></script>
      <script>
        window.dataLayer = window.dataLayer || [];
        function gtag(){dataLayer.push(arguments);}
        gtag('js', new Date());
        gtag('config', '{{ site.google_analytics }}');
      </script>
    {% endif %}
        

    Call Tree


    The "_includes/head-custom-google-analytics.html" file is called from the "_includes/head-custom.html" file by this line:
    {% include head-custom-google-analytics.html %}
    The "_includes/head-custom.html" file is called from the "_layouts/default.html" file by this line:
        {% include head-custom.html %}
    The "_layouts/default.html" file is the top level template in each Jekyll Theme.

    Procedure

    1. Create an "_includes" folder in the same folder as the "_config.yml" file.
    2. Copy the "_includes/head-custom-google-analytics.html" file for the correct theme from the list above.
    3. Paste the "_includes/head-custom-google-analytics.html" file into the new "_includes" folder.
    4. Modify the contents of the new "_includes/head-custom-google-analytics.html" file as described above.
    5. Push the changes and wait for GitHub to refresh the website.
    6. Confirm the new Google Analytics code in the header of the HTML source.