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
In the ddb repo, the deployPackager.properties should be set with below:
databaseBackupRestoreMethod=BackupRestoreOracleDatapump databaseBackupMode=always
In the sql repo, the ddl folder’s metadata.properties should be set with below:
#Ensure that Backup & Restore will occur packageMethod=convert
Run Packager
Add a create table statement to the ddl folder and check-in to SCM:
In this example we’re using a file called add_vehicle_reg_tbl_10.sql:
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:
Whitelist the ORA errors and Re-run Packager
To whitelist the errors, in the ddb repo, add the following to deployPackager.properties:
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.
Check-in the above changes to SCM.
Re-run Packager process.
We should now see Successful job completion.
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
https://datical-cs.atlassian.net/wiki/spaces/DDOC/pages/1302036557
https://datical-cs.atlassian.net/wiki/spaces/DDOC/pages/896570147
Copyright © Datical 2012-2020 - Proprietary and Confidential