Data Masker

About Foreign Key Enable/Disable Rules

Sometimes during data masking or synchronization operations, it is necessary to disable foreign keys while the operation is in progress. Foreign keys can be disabled and enabled by building specific Command rules for the purpose or if there are many of them, a Foreign Key Manager rule can be defined to automate the enable/disable process. A Foreign Key Manager rule is a container which manages the execution of a number of subsidiary actions which perform the foreign key disable or enable.

Important Note: Foreign Key Managers are not commonly required. The Foreign Key Manager rule was included primarily for completeness so that it would be available on the rare occasions when it was required.

The implementation of the foreign key enable/disable operations as a manager was done to make the process simple and intuitive. A database can have many foreign keys and each disable/enable action requires the execution of a distinct SQL statement. Each operation must be recorded in the log and any errors must be detected and reported. If such actions were configured as individual rules in the masking set, then the large quantity of such rules could visually overwhelm the masking set - leaving it hard to maintain the other masking rules. It is much more efficient to collect all of the actions together under one rule which acts as a manager. The Foreign Key Manager Rule form provides the ability to view, configure and manage the foreign key disable/enable actions and the Foreign Key Manager rule itself controls the execution of the configured disable/enable foreign key operations. Errors and statistics are handled by the Foreign Key Enable/Disable rule and presented to the user in a manageable summary form.

Important Note: The Foreign Key Manager rule is only aware of the foreign keys given to it by the Rule Controller. To refresh the list of foreign keys known to the Foreign Key Manager rule, first refresh the foreign keys in the Rule Controller using the Refresh Foreign Keys button on Options tab of the edit Rule Controller form. This retrieves an up-to-date list from the target database. Once the Rule Controller has been updated and saved, a dialogue will popup to allow refreshing the foreign key information in Foreign Key Manager rules automatically.

Once the Foreign Key Manager rule has begun to execute, the foreign key disable/enable operations will proceed in parallel using the full number of threads specified on the Run Statistics tab until all specified foreign keys have been operated on.

If required, a Foreign Key Manager rule is usually configured (using Rule Blocks) to run in disable mode as the very first rule in the masking set. A second Foreign Key Manager rule is configured to run in enable mode as the very last rule in the masking set. This ensures the foreign keys are disabled during the masking operations and, hence, will not fire and slow the process down.

It is possible to configure the Foreign Enable rules so that no extra checking is performed. In Data Masker for SQL Server, this option is at Enable with No Check option checkbox in the New Foreign Key Enable rule form, which correponds to the NOCHECK syntax in SQL Server database. In Data Masker for Oracle, this option is at Enable with NoValidate option checkbox in the New Foreign Key Enable rule form, which correponds to the NOVALIDATE syntax in Oracle database. 

Foreign Key Manager rules are created by launching the New Foreign Key Manager rule form using the New Rule button located on the bottom of the Rules in Set tab.

How to Create a New Foreign Key Manager rule


Didn't find what you were looking for?