dbatools icon indicating copy to clipboard operation
dbatools copied to clipboard

Move-SqlDatabaseFile commited to development branch needs testing

Open dansqldba opened this issue 10 years ago • 5 comments

Review #175 and test appropriately, probably just focus on any files changed which are shared etc.

dansqldba avatar Sep 09 '16 16:09 dansqldba

Paging @ClaudioESSilva here's the existing issue for your cmdlet!

dansqldba avatar Sep 18 '16 21:09 dansqldba

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.

  1. 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
  2. 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
  3. 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

ClaudioESSilva avatar Sep 19 '16 21:09 ClaudioESSilva

This is beautiful @ClaudioESSilva, exactly what I wanted :+1: :)

dansqldba avatar Sep 20 '16 08:09 dansqldba

@ClaudioESSilva : sorry for pinging but isn't this a "duplicate" of #250 ?

niphlod avatar Feb 16 '17 00:02 niphlod

@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.

ClaudioESSilva avatar Feb 16 '17 08:02 ClaudioESSilva