In December 2019, we released Redgate Change Control as part of the Deployment Suite for Oracle. Each developer installs it on their local machine to easily track changes to a development database and generate migration scripts, which can be used in an automated release process.
To deploy these migration scripts, you would have used a combination of command-lines and you would have needed to learn how to build the safety checks into your deployment pipeline. Now, Redgate Change Automation takes care of that for you. Everything you need is in one simple command-line, with the safety checks built-in, which makes it easier to setup.
Redgate Change Control is installed on the developer’s machine to generate migrations. Redgate Change Automation is used for CI/CD to deploy those migrations safely.
Using Redgate Change Automation
Redgate Change Control allows developers to source control the migration scripts describing every required change, including schema changes, data updates, configuration changes, and so on. These are sometimes referred to as change scripts.
The job of Redgate Change Automation is to run them in the right order to update an existing database to the version from source control, safely, and with built-in quality checks. It is a command-line application that can be used as part of a CI/CD pipeline to automate Oracle database deployments with migration scripts, giving you full control over the deployment. It enables you to build a safe, automated release process. Redgate Change Automation has the following commands (see our command line reference for more details on how to use these).
build command verifies the migration scripts in the repository by applying them to a clean CI database or updating an existing CI database. It can also run PL/SQL code analysis to check that best practices and naming conventions are being followed. It also checks for any invalid objects.
Most importantly, it generates a build artifact, which is a zip file, that can be used later for deployments. It is a DevOps best practice to build once and then use that same artifact to release to multiple environments, to ensure a consistent and repeatable process.
This command runs utPLSQL database unit tests and outputs reports for test results and code coverage. utPLSQL is an open source database unit testing framework that Redgate sponsors.
It’s good to have tests to cover any business logic in your procedures and functions. You can also add tests for any routine checks that can be automated to reduce manual risk and the time needed by DBAs to review changes. Some teams will cover testing the database as part of an automated integration test process. This test step is optional and can always be added later if you’re not doing database unit testing yet.
rca release prepare
Prepares a release artifact that is targeted for a specific environment. This release artifact can then be deployed to a downstream database (e.g. Production). The artifact contains a copy of the scripts in your repository along with a change report and deployment script that can be easily reviewed by DBAs. This step also performs drift detection to validate that the target database has not changed since the previous deployment (e.g. through a hotfix). If drift has been detected, additional scripts are generated that allows you to either reverse the detected drift or include the drift in your development environment, so that you’re testing against a more realistic representation of Production.
rca release perform
Deploys the release artifact generated by rca release prepare against the target database. This will run the deployment.sql script only if no drift has happened since it was generated. If a DBA is happy that the drift will not impact this release, then they can use a force flag to proceed with the deployment.
Built-in safety checks
Redgate Change Automation provides the following built-in safety checks to make Oracle database releases as safe as possible.
- PL/SQL code analysis checks that best practices are being followed and your naming conventions are being enforced. These rules can be customized per pipeline and you can set the severity level to warning or error. For errors, you can choose to stop the build from continuing and give quick feedback to developers to review the changes.
- The invalid objects report makes you aware of any objects that might need to be reviewed.
- A detailed change report so DBAs can quickly understand what objects will be changed and how as part of each release. Post-release, this report also makes it easy to see what objects changed and how, which can make it easier to identify the cause if there are any problems.
- The exact SQL deployment script for DBAs that still want to perform a manual review step as part of an automated pipeline.
- Drift detection to make releases safer and catch any changes that happen outside of your release process. If a change is only on Production, then the tests that you have done in your earlier environments (like Dev, Test, and QA) may not accurately capture any issues that happen on Production since the schema is different.
- Drift correction scripts to revert drift from Production or include it in your development environment so you are developing/testing against the most representative Production schema, and future releases won’t be identified as drifted.
Redgate Change Automation will work with any CI/CD system that can call a command-line. The CI/CD agents can be Linux or Windows machines. Redgate Change Automation is also available on Docker Hub, which makes it easy to automatically get the latest version of it, as part of your pipeline process.
On our documentation site, we have worked examples for using Redgate Change Automation to automate Oracle database deployments with Jenkins, Azure DevOps, and TeamCity and Octopus Deploy. These examples along with the command-line documentation can be used to setup other CI/CD systems like GitHub Actions, GitLab CI/CD Pipelines, Bitbucket Pipelines, IBM UrbanCode, XebiaLabs, and more. If your system is not listed and you need help, please let us know.
We’d love to hear your thoughts on Redgate Change Automation, and work with you to help you automate your Oracle database deployments safely. You can learn more and download the latest Deployment Suite for Oracle from our website.
Was this article helpful?