Perform Automatic Clone Database Refresh with Templates?
SeanPerkins
Posts: 13 New member
in SQL Clone
We have the business requirement to automatically refresh our images/clones at regular intervals.
An example was provided in the SQL Clone documentation to refresh all clone databases to use an updated image:
https://documentation.red-gate.com/clone4/automation/powershell-worked-examples/refresh-all-clone-databases-to-use-an-updated-image
How can this be accomplished for clones that are using a template?
The 'New-SqlClone' cmdlet has a -Template parameter, but the template does not exist in the new image, so the operation fails.
The 'New-SqlCloneTemplate' cmdlet could resolve that issue by creating the template for the new image, but it has no parameter that can accept a 'CloneTemplateResource' object. This prevents the template object from being directly transferred.
The template could potentially be re-created from the original modification scripts/files, however, the 'CloneTemplateResource' object in PowerShell does not appear to have a property containing the modification scripts and/or their original file paths (even though the SQL Clone GUI does show the original filenames on mouse hover). This prevents passing existing scripts from the template object to the 'New-SqlCloneSqlScript' cmdlet (for use with the -Modifications parameter of 'New-SqlCloneTemplate').
The only solution I can think of so far is to manually create templates at image creation (not clone creation), regardless of their use by clones, and then try to match on template name during the refresh. But... this solution brings with it a whole new host of problems too: clones dictate the need for templates and clone/template requirements may not be available at image creation, scripts used in the old image template may not match up with those used in the new image template of the same name and create discrepancies, the clone creation will fail if an expected template is unavailable in the new image, many templates could go unused and create clutter in every new image, and increased manual intervention in the "automatic" clone refresh and image creation processes.
Am I overlooking the proper way to accomplish this task? Feedback would be appreciated. Thanks.
An example was provided in the SQL Clone documentation to refresh all clone databases to use an updated image:
https://documentation.red-gate.com/clone4/automation/powershell-worked-examples/refresh-all-clone-databases-to-use-an-updated-image
How can this be accomplished for clones that are using a template?
The 'New-SqlClone' cmdlet has a -Template parameter, but the template does not exist in the new image, so the operation fails.
The 'New-SqlCloneTemplate' cmdlet could resolve that issue by creating the template for the new image, but it has no parameter that can accept a 'CloneTemplateResource' object. This prevents the template object from being directly transferred.
The template could potentially be re-created from the original modification scripts/files, however, the 'CloneTemplateResource' object in PowerShell does not appear to have a property containing the modification scripts and/or their original file paths (even though the SQL Clone GUI does show the original filenames on mouse hover). This prevents passing existing scripts from the template object to the 'New-SqlCloneSqlScript' cmdlet (for use with the -Modifications parameter of 'New-SqlCloneTemplate').
The only solution I can think of so far is to manually create templates at image creation (not clone creation), regardless of their use by clones, and then try to match on template name during the refresh. But... this solution brings with it a whole new host of problems too: clones dictate the need for templates and clone/template requirements may not be available at image creation, scripts used in the old image template may not match up with those used in the new image template of the same name and create discrepancies, the clone creation will fail if an expected template is unavailable in the new image, many templates could go unused and create clutter in every new image, and increased manual intervention in the "automatic" clone refresh and image creation processes.
Am I overlooking the proper way to accomplish this task? Feedback would be appreciated. Thanks.
Tagged:
Answers
Your post appears to be a duplicate of another forum post you recently submitted:
https://forum.red-gate.com/discussion/85833/perform-automatic-clone-database-refresh-with-templates
Your feedback is being discussed by the Development Team responsible for SQL Clone. Once I receive further information I will update the forum post whose link is above.
Many Thanks
Eddie
Senior Product Support Engineer
Redgate Software Ltd
Email: support@red-gate.com