How to migrate the repository database to a different SQL Server

Applies to
ApexSQL Monitor

Summary
This article describes post migration steps after the ApexSQL Monitor central repository database has been migrated to another SQL Server instance.

Description

If the ApexSQL Monitor central repository database needs to be monitored to a new SQL Server, it can be moved via backup and restore, attach or detach etc.

Modifying the Monitor.dat file

Whatever method was used to migrate the repository database to a new SQL Server, the next step is altering the Monitor.dat file to accommodate the new information for the repository database. The Monitor.dat file is located in the <drive-letter>:\ProgramData\ApexSQL\ApexSQLMonitor.

Replace <drive_letter> with an appropriate drive letter depending on where ApexSQL Monitor is installed.

Change the name of the server that hosts the repository database by entering the name of the SQL Server that is going host it in the following line:

<MonitorServerName>New_SQL_Server_Name</MonitorServerName>

Replace the highlighted text with the adequate SQL Server name. In the example below it should look like this

<MonitorDatabaseName>ApexSQLMonitor</MonitorDatabaseName>
<MonitorServerName>SERVER2012R2-L1\SQL2016</MonitorServerName>

Optionally, in case that the repository database is restored using the new name, to allow the ApexSQL Monitor to recognize the new repository name should be entered in the following line as well:

<MonitorDatabaseName>New_Database_Name</MonitorDatabaseName>

The final look of the Monitor.dat file should be like this

<?xml version=”1.0″?>
<ExternalInfo xmlns:xsd=”http://www.w3.org/2001/XMLSchema” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”>
 <MonitorDatabaseName>New_Database_Name</MonitorDatabaseName>
 <MonitorServerName>New_SQL_Server_Name</MonitorServerName>
 <Port>65446</Port>
 <WCFServer>WIN-ECJIMF4DK6U</WCFServer>
 <WebPort>5000</WebPort>
 <WebHttpsPort>4443</WebHttpsPort>
 <HttpsSiteName />
 <HttpHostNames>
  <string>localhost</string>
  <string>!127.0.0.1</string>
  <string>ip</string>
  <string>!machinename</string>
 </HttpHostNames>
 <WebHost>localhost</WebHost>
 <UseHttpServer>true</UseHttpServer>
 <UseHttpsServer>false</UseHttpsServer>
</ExternalInfo>

Save the altered Monitor.dat file and restart the ApexSQL Monitor service

The migration of the repository database is now completed, and ApexSQL Monitor will now be storing the collected data into the new repository.