How to move one repository from one database to another existing database of SourceAnywhere?

With SourceAnywhere, you can configure different databases on different servers. Sometimes, you may want to move one repository from one database to another database. This can be achieved using the feature of Multiple SQL Server Database support added in SourceAnywhere 4.x or later. For more info, please click here.

Below are the detailed steps (Using Microsoft SQL Server 2008):

1. Install or upgrade to SourceAnywhere server v4.x or later on the server that you want to move the repository to. To install, please check "Setup Guide". To upgrade, please click here.

2. Stop SourceAnywhere Service on the old server. (Dynamsoft SourceAnywhere Service Configurator->Service Control->Stop Service)

3. Backup SourceAnywhere database in the SQL Server on the old server and copy the backup to the new server. How to Back Up a Database

4. Restore the backup to a new database other than "SourceAnywhere", like "SourceAnywhere2" in the SQL Server on the new server. How to restore a Database Backup


5. Delete some unnecessary tables in the new database "SourceAnywhere2":

??5.1. If there are 3 repositories in the old database: Default with iRepositoryID 1, Test with iRepositoryID 2 and Temp with iRepositoryID 3. And now you want to create a database for repository "Test", you have to delete the tables tblExtraFileInfo[RepositoryID],tblFileInfo[RepositoryID], tblHistory[RepositoryID],tblItem[RepositoryID] which do not belong to "Test" (You can check the names of the repositories at {SQL}->Databases->SourceAnywhere2->Tables->dbo.tblRepository -(right click)>Edit Top 200 Rows). In this case, you
need to delete the tables tblExtraFileInfo1, tblFileInfo1, tblHistory1, tblItem1, tblExtraFileInfo3,
tblFileInfo3, tblHistory3, tblItem3, leaving just tblExtraFileInfo2, tblFileInfo2, tblHistory2, tblItem2. Please refer to attached SQL_Drop_Table1.sql

??5.2. Delete the below tables which belong to the old database, please refer to attached SQL_Drop_Table2.sql

tblDatabaseOption,
tblEncryptionInfo,
tblGroup,
tblGroupUser,
tblLicense,
tblLoginLog,
tblPasswordHistory,
tblRepository,
tblSmtpServer,
tblUser,
tblUserGroupChange,
tblUserKey,

6. Create view in the new database "SourceAnywhere2" from the existing database "SourceAnywhere" on the new server. Please refer to attached SQL_Create_View.sql

7. Delete unnecessary information (like which files are checked out, shared, etc.) which belong to the deleted databases (in this case: Default and Temp). Please refer to attached SQL_Delete.sql.

8. Create a new repository "Test" in the Server Manager on the new server and
choose the new database "SourceAnywhere2" under "Place the repository in a different database". After that, a new record will be inserted in the database with a new RepositoryID (in this case, the id is 4. You can check this at {SQL}->Databases->SourceAnywhere -> Tables -> tblRepository).

9. In the new database "SourceAnywhere2", change the names of the tables
tblExtraFileInfo2, tblFileInfo2, tblHistory2, tblItem2 to tblExtraFileInfo4, tblFileInfo4, tblHistory4, tblItem4. (4 is the id of the new repository on the new server)

10. Update the RepositoryID in the tables tblCheckout, tblComment, tblExcludeFileType , etc. Please
refer to attached SQL_Update.sql.

Ok. Now the repository Test is successfully added to the SourceAnywhere database on the new server. And you can log in from the client to check this new repository.