Create rollback scripts

Last modified: February 2, 2023

It is important to foresee a scenario in which you might need your data deployment to be reversed. For this, you can create a data rollback script prior to actual data deployment.

The logic behind creating a data rollback script in dbForge Studio for SQL Server is to perform the comparison and before proceeding to database synchronization, change the synchronization direction, then generate and save the rollback script.

See how to do this step-by-step below:

1. Having performed the comparison, right-click the generated .dcomp file.

2. Click Change Synchronization Direction.

Change Synchronization Direction

3. You will see that the synchronization arrow now turns red and faces the opposite direction.

Change Synchronization Direction

4. Click the red arrow.

5. In the Data Synchronization Wizard that opens, choose either Open the synchronization script in the internal editor or Save the script to a file.

Data Synchronization Wizard

6. Click Synchronize.

If you choose Open the synchronization script in the internal editor, the generated script will open as a separate tab in dbForge Data Compare for SQL Server:

Internal Editor

If you choose the Save the script to a file option, you will first need to provide a path to the directory to save the script to.

Another way to create a rollback script is to swap Source and Target settings at the beginning of the comparison:

Swap Source and Target

1. By swapping Source and Target you will simply change the direction of the comparison and synchronization.

Note

It is important to keep in mind that this method will reset any manual mapping that was previously set. Thus, you will have to manually specify the same mapping as before.

2. Once done, click Compare.

3. Review the generated .dcomp file.

4. Click the green arrow to invoke the Data Synchronization Wizard:

5. In the Data Synchronization Wizard that opens, choose either Open the synchronization script in the internal editor or Save the script to a file.

6. Click Synchronize.

If you choose Open the synchronization script in the internal editor, the generated script will open as a separate tab in dbForge Data Compare for SQL Server:

If you choose the Save the script to a file option, you will first need to provide a path to the directory to save the script to.