How To: Simulate Restore ORA Errors for Testing oracleRestoreErrorWhitelist

Below is an example of how to simulate errors in Oracle’s Datapump API. The example is to highlight how Liquibase can be configured to ignore certain ORA errors during the restore process. This demonstration is for QA purposes only and should be used on a REF database that has been setup specifically for testing.

Do not perform this particular Scenario on REF databases being used in production or other application environment pipelines. It should only be used to showcase whitelist functionality.

Scenario

In this scenario we will be adding a database trigger for ‘drop on database’ that will perform a select on an invalid table. This trigger will force errors during the Packager’s restore operation. We will then whitelist the errors and Re-package to show a successful run.

To setup the scenario, add the following trigger in your REF database using the DATICAL_USER:

create or replace trigger drop_trigger before drop on database declare n number; begin execute immediate 'select count(*) from not_a_table' into n; end; /

Initial Project Setup

  1. In the ddb repo, the deployPackager.properties should be set with below:

    1.  

      databaseBackupRestoreMethod=BackupRestoreOracleDatapump databaseBackupMode=always
  2. In the sql repo, the ddl folder’s metadata.properties should be set with below:

    1.  

      #Ensure that Backup & Restore will occur packageMethod=convert

Run Packager

  1. Add a create table statement to the ddl folder and check-in to SCM:

    1. In this example we’re using a file called add_vehicle_reg_tbl_10.sql:

  2. Run the Packager process. Depending on the existing objects in your REF database, you should see the following errors during the Restore operation in the daticaldb.log:

    1.  

Whitelist the ORA errors and Re-run Packager

  1. To whitelist the errors, in the ddb repo, add the following to deployPackager.properties:

    1.  

  2. Because of the previous Backup and Restore error, you may also need to remove any .lock files that have been added to the ddb repo.

  3. Check-in the above changes to SCM.

  4. Re-run Packager process.

  5. We should now see Successful job completion.

    1. Please remember to also drop your trigger from this Scenario so it does not impact your future testing efforts.

Packager Logs from Demonstration

Video

Documentation

 

 

Copyright © Datical 2012-2020 - Proprietary and Confidential