Forum Discussion
sqltleo
Jan 22, 2024Copper Contributor
Preserve CDC info while restoring (-KeepCDC)
I would like to preserve the CDC information while refreshing the development using production backup. We use a sophisticated powershell script to perform the restores. I am a little unclear on the u...
olafhelper
Jan 23, 2024Bronze Contributor
However, I am not sure what value to pass in the powershell.
Default value: False
The parameter is a boolean value: False/True
sqltleo
Jan 25, 2024Copper Contributor
Thank You olafhelper for the information. I have updated PowerShell code to below:
Restore-DbaDatabase -SqlInstance $ServerInstanceName `
-DatabaseName $dbName `
-Path $file.FullName `
-DestinationDataDirectory F:\MSSQL\DATA `
-DestinationLogDirectory G:\MSSQL\Logs `
-WithReplace `
-EnableException
-KeepCDC True <----This is the change added
Regards,
Leo
Restore-DbaDatabase -SqlInstance $ServerInstanceName `
-DatabaseName $dbName `
-Path $file.FullName `
-DestinationDataDirectory F:\MSSQL\DATA `
-DestinationLogDirectory G:\MSSQL\Logs `
-WithReplace `
-EnableException
-KeepCDC True <----This is the change added
Regards,
Leo