Table Sync supports schema synchronization, shadow table synchronization, empty database initialization, and table consistency repair, which you can control using security rules.
Basic configuration
The basic configuration items for Table Sync let you configure the default approval template, enable execution capability, and set the script expiration time for the analysis phase.
-
Enable execution capability: If you disable this option, Table Sync loses its SQL execution capability and can only compare table schema differences. All other security rules for configuration items and checkpoints are then disabled.
-
Default approval template for Table Sync: You can use the default value or click Switch Approval Template to change the default approval template's approval process. For more information, see Modify the default approval template.
-
Analysis phase script expiration time (in hours): Setting an appropriate expiration time helps mitigate risks caused by changes to the target table schema before task execution.
Checkpoints
Table Sync has four checkpoints, each corresponding to one of its four functions. These checkpoints are independent of each other. For example, when you submit a schema synchronization ticket, only the basic configuration item and Schema Synchronization Validation checkpoints are triggered.
-
Schema Synchronization Validation: Apply constraints or set an approval process for schema synchronization tickets.
-
Shadow Table Synchronization Validation: Apply constraints or set an approval process for shadow table synchronization tickets.
-
Empty Database Initialization Validation: Apply constraints or set an approval process for empty database initialization tickets.
-
Table Consistency Repair Validation: Apply constraints or set an approval process for table consistency repair tickets.
For each checkpoint, you can use the rules provided in the template database or create custom rules. For more information, see Add a rule.
Factors and actions
Factors
A factor is a built-in system variable that provides contextual information for security rule validation, such as the SQL type or the number of affected rows. All factors start with the @fac. prefix, followed by the factor name. Different checkpoints within each module provide different factors. The following table describes the factors available in Table Sync.
|
Factor |
Description |
|
@fac.env_type |
The environment type. The value is an environment identifier, such as |
|
@fac.schema_name |
The name of the schema. |
Actions
An action is a system behavior that executes when an IF condition is met. Actions, such as prohibiting ticket submission, selecting a workflow, or allowing or rejecting execution, express the main purpose of a security rule. All actions start with the @act. prefix, followed by the action name. Different checkpoints within each module provide different actions. The following table describes the actions available in Table Sync.
|
Action |
Description |
|
@act.forbid_submit_order |
Prohibits a ticket from being submitted. Syntax: |
|
@act.do_not_approve |
Specifies the ID of an approval template. For more information, see Set the approval process. |
|
@act.choose_approve_template |
|
|
@act.choose_approve_template_with_reason |
Template database
Security Rules provides a large number of rule templates that you can enable directly or customize to meet your requirements. The following table describes the templates for Table Sync.
|
Checkpoint |
Template |
|
Schema Synchronization Validation |
"Schema Synchronization" - Set approval-free synchronization for test databases |
|
"Schema Synchronization" - Disable SQL execution capability |
|
|
"Schema Synchronization" - Disable SQL execution capability for production databases |
|
|
"Schema Synchronization" - Set approval process for synchronization in production databases |
|
|
Shadow Table Synchronization Validation |
"Shadow Table Synchronization" - Set approval-free synchronization for test databases |
|
"Shadow Table Synchronization" - Disable SQL execution capability |
|
|
"Shadow Table Synchronization" - Disable SQL execution capability for production databases |
|
|
"Shadow Table Synchronization" - Set approval process for synchronization in production databases |
|
|
Empty Database Initialization Validation |
"Empty Database Initialization" - Set approval-free synchronization for test databases |
|
"Empty Database Initialization" - Disable SQL execution capability |
|
|
"Empty Database Initialization" - Disable SQL execution capability for production databases |
|
|
"Empty Database Initialization" - Set approval process for synchronization in production databases |
|
|
Table Consistency Repair Validation |
"Table Consistency Repair" - Set approval-free synchronization for test databases |
|
"Table Consistency Repair" - Disable SQL execution capability |
|
|
"Table Consistency Repair" - Disable SQL execution capability for production databases |
|
|
"Table Consistency Repair" - Set approval process for synchronization in production databases |
Enable execution capability
You must enable Enable execution capability in the basic configuration items. If this option is disabled, Table Sync can only compare table schema differences and cannot execute SQL statements.
Log in to DMS 5.0.
-
Move the pointer over the
icon in the upper-left corner and choose . NoteIf you use the DMS console in normal mode, choose in the top navigation bar.
-
On the Security Rules tab, find the target security rule set and click Edit in the Actions column.
-
In the left-side navigation pane of the Details page, choose .
-
On the Table Sync tab, click Basic Configuration Items.
-
Find the Enable execution capability (If disabled, other rules are invalid) rule and click Edit.
-
In the Edit Configuration Item dialog box, turn on the Configuration Content switch.
-
Click Submit.
Modify the default approval template
Log in to DMS 5.0.
-
Move the pointer over the
icon in the upper-left corner and choose . NoteIf you use the DMS console in normal mode, choose in the top navigation bar.
-
On the Security Rules tab, find the target security rule set and click Edit in the Actions column.
-
In the left-side navigation pane of the Details page, choose .
-
On the Table Sync tab, click Basic Configuration Items.
-
Find the Default approval template for Table Sync rule and click Edit.
-
In the Edit Configuration Item dialog box, click Switch Approval Template.
-
Click Select in the Actions column to the right of the target Template Name.
NoteYou can also click Reset to Free of Approval to allow tickets to bypass the approval process.
-
Click Submit.
Add a rule
Log in to DMS 5.0.
-
Move the pointer over the
icon in the upper-left corner and choose . NoteIf you use the DMS console in normal mode, choose in the top navigation bar.
-
On the Security Rules tab, find the target security rule set and click Edit in the Actions column.
-
In the left-side navigation pane of the Details page, choose .
-
On the Table Sync tab, click Add Rule to the right of Actions.
-
In the Add Rule - Table Sync dialog box, configure the following parameters:
Parameter
Description
Checkpoint (Required)
Select the checkpoint for the rule. The following checkpoints are available for Table Sync:
-
Schema Synchronization Validation
-
Shadow Table Synchronization Validation
-
Empty Database Initialization Validation
-
Table Consistency Repair Validation
Template Library (Optional)
After you select a Checkpoint, you can load a rule template from the template database as needed. For a list of available templates, see Template database.
Rule Name (Required)
Enter a custom name for the rule. If you load a template from the template database, this field is automatically populated.
Rule DSL (Required)
Enter the rule DSL. For more information about the syntax, see DSL syntax for security rules. If you load a template from the template database, this field is automatically populated.
-
-
Click Submit.
-
By default, the new rule is in the Disabled state. Click Enable in the rule's Actions column.
-
In the confirmation dialog box that appears, click OK.