Hello folks,
My goal is to migrate DB from server A (MSSQL 2019 Standard) to server B (MSSQL 2022 Standard).
These two servers are two different VMs and they can communicate over network.
I would like to avoid, if possible, the "traditional" procedure: dump and import the dump.
I have seen that it is possible to migrate the database using the "Copy Database Wizard" functionality, with the option "Use the SQL Management Object method"
KB: https://learn.microsoft.com/en-us/sql/relational-databases/databases/use-the-copy-database-wizard?view=sql-server-ver17
The procedure fails, even though the SQL Agent is running on the target MSSQL instance. In addition, I changed the user running the MSSQL Agent service. I configured the same user to run the wizard. This account has "sysadmin" access.
OnInformation,VM2,COMPANY\my_admin,VM1_kathrein_local_VM2_Transfer Objects Task,{400FF9EC-A42D-4393-BCD3-D47842F004F0},{F949D4EF-D8F8-4E00-9DC7-EA7074528D93},29.11.2025 00:07:47,29.11.2025 00:07:47,0,0x,Transferring data to database FactoryDB from FactoryDB
OnInformation,VM2,COMPANY\my_admin,CDW_VM1_VM2_7,{DF71A845-A968-4FBB-9E4B-C88F29DB8997},{F949D4EF-D8F8-4E00-9DC7-EA7074528D93},29.11.2025 00:07:47,29.11.2025 00:07:47,0,0x,Transferring data to database FactoryDB from FactoryDB
OnError,VM2,COMPANY\my_admin,VM1_kathrein_local_VM2_Transfer Objects Task,{400FF9EC-A42D-4393-BCD3-D47842F004F0},{F949D4EF-D8F8-4E00-9DC7-EA7074528D93},29.11.2025 00:08:17,29.11.2025 00:08:17,0,0x,Cannot drop database "FactoryDB" because it is currently in use.
StackTrace: at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout, Boolean asyncWrite)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at Microsoft.SqlServer.Management.Smo.Transfer.ExecuteStatements(SqlConnection destinationConnection, IEnumerable`1 statements, SqlTransaction transaction)
at Microsoft.SqlServer.Management.Smo.Transfer.TransferData()
at Microsoft.SqlServer.Dts.Tasks.TransferObjectsTask.TransferObjectsTask.TransferDatabasesUsingSMOTransfer()
OnError,VM2,COMPANY\my_admin,CDW_VM1_VM2_7,{DF71A845-A968-4FBB-9E4B-C88F29DB8997},{F949D4EF-D8F8-4E00-9DC7-EA7074528D93},29.11.2025 00:08:17,29.11.2025 00:08:17,0,0x,Cannot drop database "FactoryDB" because it is currently in use.
StackTrace: at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout, Boolean asyncWrite)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at Microsoft.SqlServer.Management.Smo.Transfer.ExecuteStatements(SqlConnection destinationConnection, IEnumerable`1 statements, SqlTransaction transaction)
at Microsoft.SqlServer.Management.Smo.Transfer.TransferData()
at Microsoft.SqlServer.Dts.Tasks.TransferObjectsTask.TransferObjectsTask.TransferDatabasesUsingSMOTransfer()
OnProgress,VM2,COMPANY\my_admin,VM1_kathrein_local_VM2_Transfer Objects Task,{400FF9EC-A42D-4393-BCD3-D47842F004F0},{F949D4EF-D8F8-4E00-9DC7-EA7074528D93},29.11.2025 00:08:17,29.11.2025 00:08:17,0,0x,Database transfer failed for 1 database(s).
OnProgress,VM2,COMPANY\my_admin,VM1_kathrein_local_VM2_Transfer Objects Task,{400FF9EC-A42D-4393-BCD3-D47842F004F0},{F949D4EF-D8F8-4E00-9DC7-EA7074528D93},29.11.2025 00:08:17,29.11.2025 00:08:17,100,0x,Transfer objects finished execution.
OnTaskFailed,VM2,COMPANY\my_admin,VM1_kathrein_local_VM2_Transfer Objects Task,{400FF9EC-A42D-4393-BCD3-D47842F004F0},{F949D4EF-D8F8-4E00-9DC7-EA7074528D93},29.11.2025 00:08:17,29.11.2025 00:08:17,0,0x,
OnPostExecute,VM2,COMPANY\my_admin,VM1_kathrein_local_VM2_Transfer Objects Task,{400FF9EC-A42D-4393-BCD3-D47842F004F0},{F949D4EF-D8F8-4E00-9DC7-EA7074528D93},29.11.2025 00:08:17,29.11.2025 00:08:17,0,0x,
OnWarning,VM2,COMPANY\my_admin,CDW_VM1_VM2_7,{DF71A845-A968-4FBB-9E4B-C88F29DB8997},{F949D4EF-D8F8-4E00-9DC7-EA7074528D93},29.11.2025 00:08:17,29.11.2025 00:08:17,-2147381246,0x,SSIS Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED. The Execution method succeeded, but the number of errors raised (1) reached the maximum allowed (1); resulting in failure. This occurs when the number of errors reaches the number specified in MaximumErrorCount. Change the MaximumErrorCount or fix the errors.
Do you have suggestion for me?
Did you migrate DB successfully in the past using "Copy Database Wizard" feature?
Initially, CDW, create a new database on VM2, but it fails the tables copies; it fails to drop DB.
In short at the end of this wizard there is a fresh empty DB on VM2.
Thanks!