Image modifications
Published 30 April 2018
As of version 2.4.0, Clone can make specific changes to your images while it creates them, before it makes them available for cloning.
In version 2.4.0, this was limited to running T-SQL scripts on the image database. As of version 2.5.0, Clone can also invoke Data Masker 6 on the database image, making it easier to provision sanitized copies of sensitive production databases.
Usage scenario
Suppose you have a backup of your production database, which you want to make available to a development team through Clone. It contains some sensitive customer data, which must be cleared out before distribution to remain compliant with data protection regulations. It also contains some environment-specific configuration data, which you need to modify to fit the development environment.
Using the image modifications feature, Clone can mask the customer data using Data Masker for SQL Server, and then run a T-SQL script to update the configuration data for the development environment. This all happens as a part of the image creation workflow - no additional manual work needed, except to specify what work to do.
Specifying modifications via the web UI
Some modifications are too large to upload via the web UI, although SQL Clone 4.0.2 allows use of larger modifications than earlier versions. PowerShell can be used with modifications of any size.
During the image creation workflow, SQL Clone will give you the option of uploading files that will be used to modify your image. If you don't upload anything, your image will be created as normal.
To make modifications, upload a .sql file (for T-SQL modifications) or a .dmsmaskset file (for data masking).
The modifications will be applied in the order you specify on the UI, from top to bottom.
Specifying modifications via PowerShell
See our reference page and usage examples.
Implementation details
If Clone is instructed to modify an image, it will proceed with the normal imaging process, but add a modification step at the very end.
In this step, the SQL Clone Agent creating the image will attach the copied image database to a SQL Server instance, and run your modifications through that instance.
- When creating an image from a live SQL database, the instance used will be the one the image was drawn from.
- When creating an image from a backup file, the instance used will be the temporary instance specified during image creation.
After running your modifications, the agent will detach the database and conclude the imaging process, enabling clones to be created from the now-modified image.
For more details on the kinds of modifications you can specify, see our documentation on T-SQL modifications, and data masking modifications.