Migration fromPostgreSQL databaseto MS SQL

Document OverviewAD360 comes bundled with a PostgreSQL database to store product data. The solution also supportsthe usage of MS SQL Server to store data and enables you to migrate product data from the built-inPostgreSQL to MS SQL database. This guide will walk you through the database migration process.Please note that AD360 supports online database migration.Supported versions of MS SQL Server: 2005, 2008 R2, 2012, 2014, 2016, and 2017Prerequisites for the migration processMake sure that the following conditions are satisfied in the MS SQL Server to which you want tomigrate the data:1. The SQL Server browser must be up and running.2. For SQL Server network configuration, TCP/IP protocol must be enabled.3. All the client protocols must be enabled.4. MS SQL Server access is delegated to a user with sysadmin and db owner permissions atthe server and database levels respectively.Refer to Appendix A for configuring prerequisites 1, 2, and 3. Refer to Appendix B for configuringprerequisite 4.Migrating from PostgreSQL to MS SQLMigrating data from AD360’ PostgreSQL database to MS SQL consists of the following two steps:1. Backing up the AD360 database2. Migrating PostgreSQL data to MS

Step 1: Backing up the AD360 databaseYou can skip this step if you are migrating the database of a new AD360 installation.Note: It's not necessary to stop AD360 before performing the backup, as it supports onlinedatabase backup and migration. AD360 makes automatic backups of the data at configuredintervals. If you want to make a backup just before migration, you can follow the steps givenbelow.1. Navigate to AD360 installation directory \bin.Note: By default, AD360 is installed in: C:\ManageEngine\AD3602. Run the backupDB (Windows Batch) file as an administrator. Do not terminate until the process isfinished.Note: If you run the backupDB.bat in your local machine, the server needs to be stopped. Butusing the path – Admin General Settings Database Settings Database Backup in AD360product console, you can directly make online backup of database without stopping theproduct.3. Data in the default database of AD360 will be backed up and stored under AD360 installationdirectory \backup\ AD360 Backup Backup Date Time if you have taken an online backup.On performing an offline backup operation, data will be stored under AD360 installationdirectory \backup\ Offline Backup Backup Time

Step 2: Migrating PostgreSQL Data to MS SQLNote: AD360 supports both online and offline migration. Refer to section A to perform offlinemigration and to section B to perform online migration.A. Offline migration1. If MS SQL Server is installed in a remote computer, first install the necessary command lineutilities and native client, and then proceed to the next step.Note: The links provided below will redirect you to the Microsoft SQL feature pack pagecommand line utilities and native client formats. Download and install the corresponding SQLNative client or command line utilities (as per the MS SQL Server version and CPU type of themachine where AD360 is installed) in the machine where AD360 is running. The command lineutilities contain the term SQLCMD, and the native client file can be found under the namesqlncli.SQL Server versionCommand line utilitiesNative client2005DownloadDownload2008 Download2016DownloadDownload2017DownloadDownload2. Copy the following files to AD360 installation directory \bin folder.i. bcp.exe- MSSQL installation directory \Tools\Binn\bcp.exeii. bcp.rll- MSSQL installation directory \Tools\Binn\Resources\1033\bcp.rll3. Navigate to AD360 installation directory \bin.4. Run the ChangeDB (Windows batch file) as an administrator. In the Database Setup Wizard thatappears, select Server Type as MS SQL 3

5. Enter the Host Name and Port number of MS SQL Server.6. Select the SQL Server Instance from the list of available instances.7. If you want to migrate all the data stored in the default database, and also keep a copy of it in thenewly-migrated database, check the box next to Migrate existing data. If you don't want tomigrate the data, you can leave it 0/04

Note: By choosing either option, data will remain in the default PostgreSQL database evenafter the migration. However, the MS SQL database will be active and used to store all theproduct data.8. Select the Authentication type.a. If you choose Windows Authentication, provide the Domain Name, User Name, andPassword of the user account that has access to the server.b. If you choose SQL Server Authentication, provide the User Name and Password of the userwho has access to the MS SQL Server.9. Click on Test Connectionto check the status. If the connection fails, try reentering the correctcredentials and establishing the connection again.10. Click Save.11. Start the AD360Server/Service to work with MS SQL Server as the database.B. Online MigrationAD360 supports online migration of the product's database, so you don't need to stop the productbefore migration. After making a backup of the current database, follow the steps below to performan online migration to MS SQL Server:1. Log in to AD360 using administrator credentials.2. Go to the Admin tab in the top pane.3. Click on the General Settings drop-down menu on the left side.4. Navigate to Database Settings Database Configuration.5. Under Database Configuration, select the Database server, and enter the DB server name,port and instance.6. Browse and select the bcp.exe and bcp.rll files.7. Select the Authentication type.a. If you choose Windows Authentication, you can either use the Default WindowsAuthentication option or provide the Username and Password of the machine that hasaccess to the server.b. If you choose SQL Server Authentication, provide the Username and Passwordof the user who has access to

8. If you want to migrate with all the data stored in the default database intact and keep a copyof it in the new migrated database, check the Migrate existing data option. Otherwise, leaveit unchecked.Note: Data will remain in the default PostgreSQL database even after the migration.However, MS SQL database will be active and used to store all the product

9. Click on Test Connection to check the status. If the connection fails, try reentering thecorrect credentials and establishing the connection again.10. Click on 0/07

Appendix AConfiguring MS SQL ServerIf you already have a functional MS SQL Server, then this step is not required. Follow the stepsbelow to configure a new MS SQL Server installation.1. Open SQL Server Configuration Manager, or run compmgmt.msc in Command Prompt.2. Go to SQL Server Services SQL Server Browser. Make sure the SQL Server Browser isrunning.3. Go to SQL Server Network Configuration double-click Protocols for Instance Name .4. Click on 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 ingeneral, however, it can be changed. This name will be used for reference.6. Go back to SQL Server Configuration Manager. In the left pane:Navigate to SQL Server Network Configuration Protocols for SQLEXPRESS, and enableall the protocols.Navigate to SQL Native Client Configuration Client Protocols, and enable all -360/08

Appendix BDelegating MS SQL Server access to usersIt's necessary to add a login for users to access the configured MS SQL Server either using WindowsAuthentication or SQL Server Authentication. However, it's not mandatory to create a new login. Youcan use existing service accounts too. If there are none, then follow the steps given below to create aNew 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 on Logins, and select New Login.4. Provide a Login Name, and choose whether to use Windows Authentication or SQL ServerAuthentication.If you choose Windows Authentication, enter the Windows NT name of the user to whomaccess must be granted.If you choose SQL Server Authentication, you will be prompted to create a new Username and Password.5. The new user must have the sysadmin role in the server level and db owner role in thedatabase level. Follow these steps to provide the sysadmin and db owner role permission:Navigate to Machine Name SQLEXPRESS Security Logins Right-click the user Properties.Go to Server Roles, select the sysadmin check box, and click

Go to User Mapping in the left pane. In the Users mapped to this login list, check thedatabase and in the Database role membership for list, select db owner, and click OK.Note: For details about user roles, refer to the following documents:For Server-Level Roles: spxFor Database-Level Roles: spxIn general, the configured account needs one of these three sets of privileges to complete themigration process successfully:Required database roleRequired permissionsSet 1db ownerNot requiredSet 2db datareader,Not requireddb datawriter,db ddladmin,db ry-360/10

Set 3db ddladminALTER 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 SCHEMACOLLECTION,ALTER ANY REFERENCES,CONTROL ONCERTIFICATE::[ZOHO CERT]TO [user],CONTROL ON SYMMETRICKEY::[##MS DatabaseMasterKey##]TO [user],CONTROL ON SYMMETRICKEY::[ZOHO SYMM KEY]TO [user]Important:Please note that you must have the db owner permission while migrating PostgreSQL to MS SQLfor the first time. After a successful migration, you can revoke the db owner permission for theaccount, and provide the set 2 or set 3 permissions.AD360 is an identity and access management (IAM) solution for managing user identities, governing access toresources, enforcing security, and ensuring compliance. AD360 provides all these functionalities for Windows ActiveDirectory, Exchange Server, and O ce 365. With AD360, you can choose the modules you need and start addressingIAM challenges across on-premises, cloud, and hybrid environments—all from a single console. For more informationabout AD360, please visit

Supported versions of MS SQL Server: 2005, 2008 R2, 2012, 2014, 2016, and 2017 Prerequisites for the migration process Make sure that the following conditions are satisfied i