WF 16.3 - Error restoring repository from CentralConfig using "Attach Datasource" - "Error while copying repository :CopyRepository()".

Issue:
When attempting to restore a repository from CentralConfig using "Attach Datasource", the following error message pops up:



Solution:

Before following the steps below, ensure that backups of the farm and repository databases have been done.

1.  Open the repository database from SQL Server Management Studio.
2.  Expand the database > Programmability > Stored Procedures.
3.  Right-click dbo.ChangeReposName and choose "Modify".
4.  Comment out all of the update scripts in the stored procedure (Lines 14 - 162).
5.  Add the following line just before End:
     select @@Version
6.  Execute the script to save these changes.
7.  Log into CentralConfig and attach the Datasource.
8.  Choose the repository name from the drop down box that you want to restore.
9.  In the Repository Name field, enter in the same exact name as the repository selected in the drop down box.
10.  Enter in the rest of the information and choose "Attach Providers" to restore the previous provider associated with the repository.
11.  Click OK to restore the repository.
12.  After the repository has been restored, modify the dbo.ChangeReposName stored procedure and revert the changes that were made (uncomment out all of the Update scripts and remove the line that was added), then execute the modify stored procedure to save the changes.

NOTE:
If the name of the restored repository needs to be different than the original name, then specify the new name for the repository in step 9.  After saving these changes, the dbo.ChangeReposName stored procedure must be run manually from SQL Server Management Studio in order to update the repository tables to reflect the new name.

Did you find this article helpful?