SQL Clone 4

Run a T-SQL script during image creation

SQL Clone version 2.4.0 can run scripts on image databases while they are being created.

Clone Agent will attach the image files directly to the SQL Server instance being used to create it (either the instance it came from for an image from SQL Server, or the temporary instance for an image from a backup file).

It will then execute your scripts via a low-privilege login and user it creates for the task, which will have the db_owner role on the image database, and since SQL Clone 2.5.2 also has VIEW ANY DEFINITION and VIEW SERVER STATE permissions on the server. The temporary user and login will be deleted after the scripts have run.

View "Create a new SQL Clone data image with a post-image T-SQL.ps1" on GitHub

If you'd prefer to specify filenames, you can use New-SqlCloneSqlScript's -Path parameter instead of specifying raw T-SQL content with -Sql.

View "Create a new SQL Clone data image with a post-image T-SQL, loaded from files.ps1" on GitHub


Didn't find what you were looking for?