This is an update to the DB-Migrate (http://www.sqlservergeeks.com/sql-server-database-migration-db-migrate-a-powershell-module-to-migrate-databases/) powershell module to migrate database between sql instances.

The new version is available here DB-Migrate v1.

The Move-Database function can now be used to move database to remote instances. There are 4 new parameters

IsCopy It’s a Boolean variable when true will copy database files to new location. The default value is false.

Datafilepath It’s the new location for data files (*.mdf and *.ndf). The default value is empty string. It will only be used only when IsCopy is true.

Logfilepath It’s the new location for log files (*.ldf). The default value is empty string. It will only be used only when IsCopy is true.

DatafileCopyPath It’s the path where data files are to be copied. It is same as DataFilePath parameter in case databases are to be moved between instances on same computer. If the files are to be copied to remote computer specify a UNC path.

logfileCopyPath It’s the path where log files are to be copied. It is same as logFilePath parameter in case databases are to be moved between instances on same computer.  If the files are to be copied to remote computer specify a UNC path.

Example

The following function call will move all databases from AHMAD-PC\SQL2005 to Remote-PC\SQLExpress. The datafilecopypath and logfilecopypath are same as datafilepath and logfilepath respectively only difference is that they use UNC path of same location.

 

Regards

Ahmad Osama

Like us on FaceBook Follow us on Twitter | Join the fastest growing SQL Server group on FaceBook

Follow me on TwitterFollow me on FaceBook