Move-SqlDatabaseFile commited to development branch needs testing
Review #175 and test appropriately, probably just focus on any files changed which are shared etc.
Paging @ClaudioESSilva here's the existing issue for your cmdlet!
The subset of tests is repetead for each method of copy (Local, remote (UNC-PATHS) and full-remote (PSSession)) I have copy&pasted so you can check each one individualy. Any other test that came to your mind please fell free. We can talk first if you want.
- Run scritps local (same host than sql server instance) - This should use robocopy to copy the files, if not exists use Start-BitsTransfer
- [ ] Only one file - Execute command only with -SqlServer and -Databases one database parameters. Choose one file, choose destination. Will do an DBCC CHECKDB after database come online.
- [ ] Two files - Execute command only with -SqlServer and -Databases one database parameters. Choose one file, choose destination (with this method you only choose on destination for all files).
- [ ] Two files with -CheckFileHash switch - Execute command only with -SqlServer, one database and -CheckFileHash. This will take longer than the example before because for each file choosed an hash will be generated for source and destination files to garantee that is the same.
- [ ] Two files with -CheckFileHash switch - Execute command only with -SqlServer, one database and -CheckFileHash. This will take longer than the example before because for each file choosed an hash will be generated for source and destination files to garantee that is the same.
- [ ] Two files with -NoDbccCheckDb switch - Execute command only with -SqlServer, one database and -CheckFileHash. This will less time than the examples before because no checkdb will be run on database.
- [ ] Only one file with -DeleteSourceFiles switch - Execute command only with -SqlServer, one database and -DeleteSourceFiles. When all the process ends, the files no longer be available on the source.
- [ ] Generate csv with file structure - Execute command with -SqlServer, one database, -ExportDatabaseStructure and -OutFile ".csv" - Will generate a csv file with all database structure. A message must appear at the end saying which command you should run after change de csv in order to move files.
- [ ] Generate csv with file structure - Execute command with -SqlServer, one database, -MoveFromCSV and -InputFile ".csv" - Will move all files specified on csv with valid "DestinationFolderPath" values.
- [ ] try to move a file with a size bigger than the existing freespace on the destination drive/lun
- [ ] try to move a file to an folder where you don't have access
- Run scritps remotely (outside the host of sql server instance) - This should use robocopy to copy the files, if not exists use Start-BitsTransfer
- [ ] Only one file - Execute command only with -SqlServer and -Databases one database parameters. Choose one file, choose destination. This should use Start-BitsTransfer to copy the files and do an DBCC CHECKDB after database came online.
- [ ] Two files - Execute command only with -SqlServer and -Databases one database parameters. Choose one file, choose destination (with this method you only choose on destination for all files).
- [ ] Two files with -CheckFileHash switch - Execute command only with -SqlServer, one database and -CheckFileHash. This will take longer than the example before because for each file choosed an hash will be generated for source and destination files to garantee that is the same.
- [ ] Two files with -CheckFileHash switch - Execute command only with -SqlServer, one database and -CheckFileHash. This will take longer than the example before because for each file choosed an hash will be generated for source and destination files to garantee that is the same.
- [ ] Two files with -NoDbccCheckDb switch - Execute command only with -SqlServer, one database and -CheckFileHash. This will less time than the examples before because no checkdb will be run on database.
- [ ] Only one file with -DeleteSourceFiles switch - Execute command only with -SqlServer, one database and -DeleteSourceFiles. When all the process ends, the files no longer be available on the source.
- [ ] Generate csv with file structure - Execute command with -SqlServer, one database, -ExportDatabaseStructure and -OutFile ".csv" - Will generate a csv file with all database structure. A message must appear at the end saying which command you should run after change de csv in order to move files.
- [ ] Generate csv with file structure - Execute command with -SqlServer, one database, -MoveFromCSV and -InputFile ".csv" - Will move all files specified on csv with valid "DestinationFolderPath" values.
- [ ] try to move a file with a size bigger than the existing freespace on the destination drive/lun
- [ ] try to move a file to an folder where you don't have access
- Run scritps full-remote (outside the host of sql server instance and without access to UNC paths) - This should use robocopy to copy the files, but only if PSSession is available to be used
- [ ] Only one file - Execute command only with -SqlServer and -Databases one database parameters. Choose one file, choose destination. This should use Start-BitsTransfer to copy the files and do an DBCC CHECKDB after database came online.
- [ ] Two files - Execute command only with -SqlServer and -Databases one database parameters. Choose one file, choose destination (with this method you only choose on destination for all files).
- [ ] Two files with -CheckFileHash switch - Execute command only with -SqlServer, one database and -CheckFileHash. This will take longer than the example before because for each file choosed an hash will be generated for source and destination files to garantee that is the same.
- [ ] Two files with -CheckFileHash switch - Execute command only with -SqlServer, one database and -CheckFileHash. This will take longer than the example before because for each file choosed an hash will be generated for source and destination files to garantee that is the same.
- [ ] Two files with -NoDbccCheckDb switch - Execute command only with -SqlServer, one database and -CheckFileHash. This will less time than the examples before because no checkdb will be run on database.
- [ ] Only one file with -DeleteSourceFiles switch - Execute command only with -SqlServer, one database and -DeleteSourceFiles. When all the process ends, the files no longer be available on the source.
- [ ] Generate csv with file structure - Execute command with -SqlServer, one database, -ExportDatabaseStructure and -OutFile ".csv" - Will generate a csv file with all database structure. A message must appear at the end saying which command you should run after change de csv in order to move files.
- [ ] Generate csv with file structure - Execute command with -SqlServer, one database, -MoveFromCSV and -InputFile ".csv" - Will move all files specified on csv with valid "DestinationFolderPath" values.
- [ ] try to move a file with a size bigger than the existing freespace on the destination drive/lun
- [ ] try to move a file to an folder where you don't have access
This is beautiful @ClaudioESSilva, exactly what I wanted :+1: :)
@ClaudioESSilva : sorry for pinging but isn't this a "duplicate" of #250 ?
@niphlod no problem. Yes this one was the first. Those tests can be copied later for a new PR. For now this can be closed.