How to create an image from a SQL Server database using SQL Clone
If you have a live connection to the SQL Server instance, you can create an image directly from a source SQL Server database. Following are the basic actions that SQL Clone performs 'behind the scenes':
Create an initial, small Virtual Hard Disk (VHD), at the image location
Create a mount point to this VHD on the local operating system of the machine hosting the source database
Use the Volume Shadow Copy Service (VSCS) to "remote copy" the MDF and LDF files to the image location
Un-mount the VHD
You can find out more about SQL Clone's underlying virtualization technology in How SQL Clone Works.
Where is your database?
From the SQL Clone web client:
Choose Create image and then choose SQL Server as the Source Type.
Select the SQL Server instance hosting the database you wish to clone.
SQL Clone populates the SQL Server instance dropdown with all instances visible to a SQL Clone Agent, so just pick one.
SQL Clone will attempt to establish a connection to the instance, using the specified SQL Clone Agent’s service account. If it succeeds, you’ll see a verification message.
Pick the database you wish to clone from the Database dropdown.
Would you like to modify the image?
Upload any files that will modify the image. SQL Clone will apply them as part of the image creation process. This might include:
Custom data masking scripts, or data masking sets created in Data Masker for SQL Server, to sanitize personal and sensitive information
Scripts to change configuration settings or amend permissions, as required to produce a working clone in the target environment.
Image Destination
Provide a UNC path to the image destination
If you've previously established an image location, it will appear in the dropdown, otherwise just type in the address.
Review and create image
Give the image a meaningful name – this might include the date the image was taken, or perhaps the current build version of the database.
Click Create Image – the image creation process will start, and you’ll see a progress screen
Creating an image takes a full byte-by-byte copy of the database and will take about as long as a database backup or restore operation to the same network location. However, it's a one-time cost and creating clones from this image will take seconds.
When the image creation process completes, you'll see a screen confirming the image was created, and showing its size.
You can verify the image size by inspecting the VHD file, at the image location.
SQL Clone appends the image ID with some random characters to prevent filename collisions, but its name in SQL Clone Server, and in PowerShell scripts, will be the name you assigned to it, above.
SQL Clone may report the size of the data image as being substantially larger than the original database, but this is simply due to the dynamic VHD resizing mechanism; the image is a straight copy of the data and log files.
Summary
Creating an image from a SQL Server database is straightforward with SQL Clone. You can now move on to learn how to:
Create an image from a database backup
Start creating clones within the UI – having created an image, many clones, either on the same server or on network servers, can reference this image, independently.
Automate the provisioning process using PowerShell.