dbaclone icon indicating copy to clipboard operation
dbaclone copied to clipboard

New-DcnImage: Allow specifying a Recovery Model

Open lowlydba opened this issue 3 years ago • 2 comments

Is your feature request related to a problem? Please describe. I imagine most use cases will want a clone to be in simple recovery mode, so being able to change the model at image creation would be an ideal way to ensure this is passed down to clones.

lowlydba avatar Apr 14 '22 17:04 lowlydba

That would be a nice feature but people do need to be aware to take caution when doing IO heavy stuff in the database because that could let the clone grow really large.

sanderstad avatar Apr 19 '22 07:04 sanderstad

Maybe an easier (and more helpful) approach would be changing the temp DB name to a parameter (defaulting to the value used now) that way one could reliably reference it by name in their SQL script/file executed during image creation. That'd make any last-minute customization of the database very easy.

https://github.com/dataplat/dbaclone/blob/0148b669664caee3c4f4634d4e2dad792d156edd/functions/image/New-DcnImage.ps1#L630-L631

To allow for something like

$database = 'MyClone'
$tempDb = '$database-Temp123'
New-DcnImage -TempDb $tempDb ...

$sqlScript = "USE [master];
ALTER DATABASE [$tempDb] SET RECOVERY SIMPLE;"

lowlydba avatar May 09 '22 15:05 lowlydba