[New-Command] Request: Move-DbaDatabaseFile #1806
Labels
feature
hacktoberfest
See https://hacktoberfest.digitalocean.com/
help appreciated
If you have time to swing by and submit a PR to fix some things, we would greatly appreciate it
Is this:
System Details
$PSVersionTable
:Can a cmdlet be created that will take standard arguments that must include:
SqlServer/Instance
DestinationDataFilePath
DestinationLogFilePath
Request based on the in-place upgrade process. If SQL installed using standard paths, upon upgrade (ex. 2014 to 2016) user databases will remain in
Drive:\Program Files\Microsoft SQL Server\MSSQL12.INSTANCENAME\MSSQL\Data
.IF upgrading with standard paths, the desired action would be to detach and reattach data files after moving to version specific directory, in this example
Drive:\Program Files\Microsoft SQL Server\MSSQL13.INSTANCENAME\MSSQL\Data
but MSFT leaves the files in the original version directory.Example call to this new cmdlet would be:
Get-DbaDatabaseFile
and retrieve physical path of mdf and ldf files($DBFileObj | ?{$_.TypeDescription -eq 'ROWS'}).PhysicalPath
to$DestinationDataFilePath\$($DBFileObj.LogicalName).mdf
($DBFileObj | ?{$_.TypeDescription -eq 'LOG'}).PhysicalPath
to$DestinationDataFilePath\$($DBFileObj.LogicalName).ldf
$DBFileObj | %{ Remove-Item -Force -Path $_.PhysicalPath}
The text was updated successfully, but these errors were encountered: