The Table Sync module in Data Management (DMS) provides the Schema Synchronization, Empty Database Initialization, and Repair Table Consistency features. You can configure security rules to manage these features.

Basic configuration items

You can configure the following basic configuration items in the security rules of the Table Sync module:
  • Enable execution capability (if closed, other rules are invalid): specifies whether to enable SQL-based synchronization. If this configuration item is set to OFF, you can compare table schemas but cannot execute SQL statements to synchronize databases and tables. In addition, if this configuration item is set to OFF, the security rules that you configured for other basic configuration items and the checkpoints of the Table Sync module become invalid.
  • Database table synchronization default approval Template: the default approval template for database and table synchronization. You can use this approval template or click Switch Approval Template to switch to another approval template. For more information, see Change the default approval template.
  • Analysis phase script Expiration Time (unit: hours): the timeout period of the analysis phase. You can specify an appropriate timeout period in which synchronization can be canceled if schemas are changed in the destination database.

Checkpoints

The Table Sync module provides three checkpoints for you to manage the three features of the Table Sync module. The three checkpoints are independent of each other. For example, if you submit a Schema Synchronization ticket, only the basic configuration items and the security rules that are configured for the Schema Synchronization Validation checkpoint are valid.
  • Schema Synchronization Validation: Under this checkpoint, you can configure approval processes or constraints for Schema Synchronization tickets.
  • Empty Database Initialization Validation: Under this checkpoint, you can configure approval processes or constraints for Empty Database Initialization tickets.
  • Table Consistency Repair Validation: Under this checkpoint, you can configure approval processes or constraints for Repair Table Consistency tickets.

You can use the default rules that are provided by DMS for each checkpoint, or customize rules based on your actual needs. For more information, see Create a security rule.

Factors and actions

  • A factor is a built-in variable that is provided by DMS. You can use factors to obtain the context to be validated by security rules, such as the categories of SQL statements and the rows of data to be affected. A factor name consists of the prefix @fac. and the display name of the variable. Each tab of the Security Rules tab provides different factors for different checkpoints. The following table describes the factors that are provided for the checkpoints on the Table Sync tab.
    Factor Description
    @fac.env_type The type of the environment. The value is the display name of the environment type, such as DEV and PRODUCT. For more information, see Change the environment type of an instance.
    @fac.schema_name The name of the schema to be synchronized.
  • An action is the operation that DMS performs after the conditions specified in the if statement are met. For example, DMS forbids the submission of a ticket, selects an approval process, approves a ticket, or rejects a ticket. Actions demonstrate the purposes of security rules. An action name consists of the prefix @act. and the display name of the operation. Each tab of the Security Rules tab provides different actions for different checkpoints. The following table describes the actions that are provided for the checkpoints on the Table Sync tab.
    Action Description
    @act.forbid_submit_order Forbids the ticket from being submitted. The statement is in the following format: @act.forbid_submit_order 'Reasons for forbidding the ticket from being submitted'.
    @act.do_not_approve Specifies the ID of an approval template. For more information, see Configure approval processes.
    @act.choose_approve_template
    @act.choose_approve_template_with_reason

Security rule templates

DMS provides you with a large number of built-in security rule templates. You can use the templates or modify the templates based on your business requirements. The following table describes the security rule templates that are provided on the Table Sync tab.
Checkpoint Template feature
Schema Synchronization Validation Specifies that no approval is required for schema synchronization in an offline environment.
Specifies that SQL execution is disabled for schema synchronization.
Specifies that SQL execution is disabled for schema synchronization in an online environment.
Specifies an approval process for schema synchronization in an online environment.
Empty Database Initialization Validation Specifies that no approval is required for empty database initialization in an offline environment.
Specifies that SQL execution is disabled for empty database initialization.
Specifies that SQL execution is disabled for empty database initialization in an online environment.
Specifies an approval process for empty database initialization in an online environment.
Table Consistency Repair Validation Specifies that no approval is required for table consistency repair in an offline environment.
Specifies that SQL execution is disabled for table consistency repair.
Specifies that SQL execution is disabled for table consistency repair in an online environment.
Specifies an approval process for table consistency repair in an online environment.

Enable SQL-based synchronization

To enable SQL-based synchronization, you must set the basic configuration item named Enable execution capability (if closed, other rules are invalid) to ON. If this configuration item is set to OFF, you can only compare table schemas but cannot execute SQL statements to synchronize databases and tables.

  1. Log on to the DMS console.
  2. In the top navigation bar, move the pointer over the More icon and choose System > Security Rules. The Security Rules tab appears.
  3. On the Security Rules tab, find the security rule set that you want to manage and click Edit in the Actions column.
  4. On the Details tab, click the Table Sync tab in the left-side pane.
  5. On the Table Sync tab, click Basic Configuration Item.
  6. Find the configuration item named Enable execution capability (if closed, other rules are invalid) and click Edit in the Actions column.
  7. In the Change Configuration Item dialog box, turn on Configuration Value.
  8. Click Submit.

Change the default approval template

  1. Log on to the DMS console.
  2. In the top navigation bar, move the pointer over the More icon and choose System > Security Rules. The Security Rules tab appears.
  3. On the Security Rules tab, find the security rule set that you want to manage and click Edit in the Actions column.
  4. On the Details tab, click the Table Sync tab in the left-side pane.
  5. On the Table Sync tab, click Basic Configuration Item.
  6. Find the configuration item named Database table synchronization default approval Template and click Edit in the Actions column.
  7. In the Change Configuration Item dialog box, click Switch Approval Template.
  8. Find the template that you want to apply and click Select in the Actions column.
    Note You can also click Reset to Free of Approval to free submitted tickets from approval.
  9. Click Submit.

Create a security rule

  1. Log on to the DMS console.
  2. In the top navigation bar, move the pointer over the More icon and choose System > Security Rules. The Security Rules tab appears.
  3. On the Security Rules tab, find the security rule set that you want to manage and click Edit in the Actions column.
  4. On the Details tab, click the Table Sync tab in the left-side pane.
  5. On the Table Sync tab, click Create Rule next to Actions.
  6. In the Create Rule - Table Sync dialog box, set the parameters that are described in the following table.
    Parameter Description
    Checkpoints Required. The checkpoint for which you want to create the security rule. On the Table Sync tab, three checkpoints are provided:
    • Schema Synchronization Validation
    • Empty Database Initialization Validation
    • Table Consistency Repair Validation
    Template Database Optional. The template that you want to use to create the security rule. DMS provides a large number of security rule templates. After you select a checkpoint, you can click Load from Template Database and select a template as required. For more information about the available templates, see Security rule templates.
    Rule Name Required. The name of the custom security rule. If you load a security rule from a template, the rule name is automatically entered.
    Rule DSL Required. The domain-specific language (DSL) statement that you want to use to configure the security rule. For more information, see DSL syntax for security rules. If you load a security rule from a template, the DSL statement is automatically entered.
  7. Click Submit.
  8. By default, the security rule that you create is in the Disabled state. Click Enable in the Actions column.
  9. In the Prompt message, click OK.