✖

- Related Products
- ADManager Plus

  Active Directory Management & Reporting

  Download | Demo
- ADAudit Plus

  Real-time Active Directory Auditing and UBA

  Download | Demo
- ADSelfService Plus

  Self-Service Password Management

  Download | Demo
- EventLog Analyzer

  Real-time Log Analysis & Reporting

  Download | Demo
- AD360

  Integrated Identity & Access Management

  Download | Demo
- Log360

  Comprehensive SIEM and UEBA

  Download | Demo

# Migrating from MySQL to MS SQL Server

Exchange Reporter Plus, from build 4142 and above, comes bundled with a PostgreSQL database to store reporting, monitoring, and auditing data. But the builds below 4142 had a MySQL database for this purpose. Exchange Reporter Plus supports MS SQL Server and enables you to migrate from the built-in PostgreSQL or MySQL database to an MS SQL database. This page will walk you through the MySQL to MS SQL database migration process.

Supported versions of MS SQL: SQL Server 2008 R2, SQL Server 2012, SQL Server 2014, SQL Server 2016, and SQL Server 2017

## Prerequisites for the migration process

In the MS SQL server used for migration, make sure that the following conditions are satisfied:

1. The SQL Server Browser service is up and running.
2. TCP/IP is enabled for SQL Server Network Configuration.
3. All client protocols are enabled.
4. MS SQL Server access is delegated to a user with sysadmin and db_owner permissions at the server and database levels, respectively.

Refer to Appendix A for information on configuring prerequisites 1, 2, and 3. Refer to Appendix B for help configuring prerequisite 4.

## Migrating from MySQL to MS SQL

Migrating data from Exchange Reporter Plus’ MySQL database to MS SQL consists of the following steps:

1. Backing up the Exchange Reporter Plus database
2. Migrating MySQL data to MS SQL

## Step 1: Backing up the Exchange Reporter Plus database

Note: This step is not required if you are migrating the database of a freshly installed Exchange Reporter Plus instance.

1. Stop Exchange Reporter Plus. (Note: This is essential before performing the backup.)

- If Exchange Reporter Plus is running as an application, click the Windows icon. Search for Exchange Reporter Plus and choose Stop Exchange Reporter Plus.
- If Exchange Reporter Plus is running as a service, click the Windows icon. Search for Services. In the window that appears, choose ManageEngine Exchange Reporter Plus and select Stop the service on the left side.

2. Navigate to <Exchange Reporter Plus installation directory>\bin.

Note: By default, Exchange Reporter Plus is installed at C:\Program Files\ManageEngine\Exchange Reporter Plus.

3. Run backupDB.bat (Windows batch file) as an administrator. Do not terminate the process until it is finished.

4. Data in the default database of Exchange Reporter Plus will be backed up and stored under Exchange Reporter Plus installation directory>\backup\OfflineBackup_<Backup Time>.

Note: If the below error shows up while running the backupDB file, double-check that the product has been stopped before proceeding.

## Step 2: Migrating MySQL data to MS SQL

1. If MS SQL Server is installed on a remote computer, install the necessary command line utilities and native clients as per the SQL Server version and CPU type of the machine where Exchange Reporter Plus is installed, then proceed to the next step.
2. Copy the following files to <Exchange Reporter Plus installation directory>\bin:

- bcp.exe: <MSSQL installation directory>\Tools\Binn\bcp.exe
- bcp.rll: <MSSQL installation directory>\Tools\Binn\Resources\1033\bcp.rll

3. Stop Exchange Reporter Plus. (Note: This is essential before performing the migration.)

- If Exchange Reporter Plus is running as an application, click the Windows icon. Search for Exchange Reporter Plus and choose Stop Exchange Reporter Plus.
- If Exchange Reporter Plus is running as a service, click the Windows icon. Search for Services. In the window that appears, choose ManageEngine Exchange Reporter Plus and select Stop the service on the left side.

4. Navigate to <Exchange Reporter Plus installation directory>\bin.
5. Run ChangeDB (Windows batch file) as an administrator. In the Database Setup Wizard that appears, select MS SQL Server as the Server Type.

6. Enter the Host Name, Database Name, and Port number of MS SQL Server.

Note: If you want to enable SSL Connection to secure the MS SQL migration, then make sure you have followed all the steps given in this guide.

7. Select Yes beside Migrate Data to migrate with data intact. This makes a copy of all the data (e.g., previously generated reports) in the MS SQL database to which you are migrating. If you'd like a fresh installation with no data in place after migration, choose No.

Note: Data will remain in the default MySQL database even after the migration regardless of the option you choose. However, only the MS SQL database will be active and used.

8. Select the SQL Server instance from the list of available instances.
9. Select the Authentication type.

- If you choose Windows Authentication, provide the Domain Name, User Name, and Password of the service account that has necessary permission to access the MS SQL server.
- If you choose SQL Server Authentication, provide the User Name and Password of the user who has access to the MS SQL server.

10. Click Test Connection to check the status. If the connection fails, try reentering the correct credentials and establishing the connection again.
11. Click Save.
12. Start the Exchange Reporter Plus server or service to work with MS SQL Server as the database.

## Appendix A

### Configuring MS SQL Server

Note: If you already have a functional MS SQL Server instance, then this step is not required. Follow the steps below to configure a freshly installed MS SQL Server instance:

1. Open SQL Server Configuration Manager. (You can also run compmgmt.msc in the Command Prompt.)
2. Go to SQL Server Services → SQL Server Browser. Make sure the SQL Server Browser is running.

3. Go to SQL Server Network Configuration and double-click Protocols for <Instance _Name>.
4. Click the TCP/IP protocol and enable it.
5. Restart the SQL Server service for the changes to take effect.

Note: SQLEXPRESS is the instance name provided while configuring MS SQL Server in general; however, it can be changed. SQLEXPRESS will be used hereafter in this document.

6. Go back to SQL Server Configuration Manager. In the left pane:

- Navigate to SQL Server Network Configuration → Protocols for SQLEXPRESS, and enable all the protocols.
- Navigate to SQL Native Client Configuration → Client Protocols, and enable all the protocols.

## Appendix B

### Delegating MS SQL Server access to users

It is necessary to add a login for users to access the configured MS SQL Server instance either using Windows Authentication or SQL Server Authentication. It is not mandatory to create a new login. You can use existing service accounts, too. If there are none, then follow the steps below to create a new login and equip the user with the necessary permissions.

1. Log in to SQL Server Management Studio.
2. In the left pane, navigate to Machine Name → SQLEXPRESS → Security → Logins.
3. Right-click Logins and select New Login.
4. Provide a Login Name and choose whether to use Windows Authentication or SQL Server Authentication.

- If you choose Windows Authentication, enter the Windows NT name of the user to whom access must be granted.
- If you choose SQL Server Authentication, you will be prompted to create a new user by entering a User Name and Password.

5. The new user must have the sysadmin role at the server level and the db_owner role at the database level. Follow these steps to provide the sysadmin and db_owner role permissions:

- Navigate to Machine Name → SQLEXPRESS → Security → Logins. Right-click the user, then select Properties.
- Go to Server Roles, check the box next to sysadmin, and click OK.
- Go to User Mapping in the left pane. In the Users mapped to this login list, check your preferred database. In the Database role membership for list, select db_owner. Click OK.

Note: For details about user roles, refer to the documents in the following links:
For server-level roles: http://msdn.microsoft.com/en-us/library/ms188659.aspx
For database-level roles: http://msdn.microsoft.com/en-us/library/ms189121.aspx

In general, the configured account needs db_owner privileges to complete the migration process successfully. If you would like to go with more granular roles, you can opt for db_datareader, db_datawriter, db_ddladmin, or db_backupoperator permissions or, as the last choice, go for the db_ddladmin set 3 permissions listed below.

Set | Required database role | Required permissions
--- | --- | ---
Set 1 | db_owner | Not required
Set 2 | db_datareader, db_datawriter, db_ddladmin, db_backupoperator | Not required
Set 3 | db_ddladmin | ALTER ANY TABLE, ALTER ANY AGGREGATE, ALTER ANY DEFAULT, ALTER ANY FUNCTION, ALTER ANY PROCEDURE, ALTER ANY QUEUE, ALTER ANY RULE, ALTER ANY SYNONYM, ALTER ANY TYPE, ALTER ANY VIEW, ALTER ANY XML SCHEMA COLLECTION, ALTER ANY REFERENCES, CONTROL ON CERTIFICATE::[ZOHO_CERT] TO [user], CONTROL ON SYMMETRIC KEY::[##MS_DatabaseMasterKey##] TO [user], CONTROL ON SYMMETRIC KEY::[ZOHO_SYMM_KEY] TO [user]

Important: Please note that you must have the db_owner permission while migrating MySQL to MS SQL for the first time. After a successful migration, you can revoke the db_owner permission for the account and provide Set 2 or Set 3 permissions.

Previous Topic Next Topic

Copyright © 2024, ZOHO Corp. All Rights Reserved.