Skip to end of metadata
Go to start of metadata

A central LDAP server can keep track of all SAP SQL Anywhere database servers running in an enterprise. This list can be used by clients to find and connect to the database server they are looking for.

The purpose of this article is to explain how to register an SAP SQL Anywhere database server in Active Directory.

We will be using Microsoft Windows Server 2012 Active Directory for setting up a test environment that is formed by three virtual machines: A, B and C. 
Machine A is the Domain Controller (DC).

Let us open Active Directory Users and Computers and create new Organizational Unit and User (I have called them respectively iAnywhereSA and SAServer).

Let us open PowerShell and run Get-ADUSER command to display information about the user just created (for example: Get-ADUSER SAServer )

 

We are interested in the attributes and values because we need them to build the URL string for validating the LDAP server connection. This URL, in our example, looks like the following:

ldap://DC-machine-name.uk.lab:389/dc=uk,dc=lab?distinguishedName?sub?cn=*

where DC-machine-name is, of course, the domain controller server name.

Machine B and C host SAP SQL Anywhere 16 database servers. We can test the connection to Active Directory from Interactive SQL utility. It is sufficient to connect Interactive SQL to a running database server and run validate ldap server statement similar to the example below.

Let us suppose that B and C are part of a mirroring system and B hosts Arbiter and Primary server whilst C hosts Secondary server.
For each database server (dbsrv16.exe), we create a Windows service using, for example, the following parameters:
Arbiter:
-n demo_arbiter –su sql –x “tcpip(port=6870;dobroad=no)” –xf “c:\newrepro\arbiter\arbiter.state” –xa “auth=abc;dbn=mirror_demo”

Primary:
-n mirror_server1 –x tcpip(port=6871;LDAP=saldap.ini) –su sql –z –o c:\newrepro\server1\server1log.txt

Secondary:
-n mirror_server2 –x tcpip(port=6871;dobroad=no;LDAP=saldap.ini) –su sql –z –o c:\newrepro\server2\server2log.txt

 

Note that the -z switch is useful to display messages during the LDAP registration. If this fails, we should see, in the database server log file, an error message. Otherwise, a couple of lines like the following:

Attempting to register server with LDAP
Successfully registered with LDAP

These messages are not displayed if the -z switch is not used.
The saldap.ini file (it can be placed in the bin64 directory of the SQL Anywhere installation path) should have a content similar to the following:

[LDAP]
server=10.x.x.100
port=389
basedn=dc=UK,dc=lab
authdn=CN=SAServer,ou=iAnywhereASA,dc=UK,dc=lab
password=xxx
search_timeout=600
update_timeout=120
read_authdn=CN=Administrator,cn=Users,dc=UK,dc=lab
read_password=xxx


When the database server services are running,and the LDAP registration is successful, we should see demo_arbiter, mirror_server1, mirror_server2 and SAServer entries as shown in the screenshot below.


 

Finally, the databases can be started running the following SQL statements in Interactive SQL:

START DATABASE ‘c:\\newrepro\\server1\\mirror_demo.db’ as mirror_demo autostop off mirror on;

START DATABASE ‘c:\\newrepro\\server2\\mirror_demo.db’ as mirror_demo autostop off mirror on;

This should be reflected correctly in Active Directory (note two new entries mirror_demo_primary and mirror_demo_mirror) as shown in the screenshot below.

 

Let us verify if our mirroring system works correctly having a look at the IP addresses:

mirror_server1 = mirror_demo_primary: 10.x.x.101:6871

mirror_server2 = mirror_demo_mirror: 10.x.x.102:6871

demo_arbiter = 10.x.x.101:6870

If we can stop the database running on 10.x.x.101 running the following statement in Interactive SQL:

STOP DATABASE mirror_demo unconditionally;

The correspondent entry disappears in LDAP and the primary database is now running on 10.x.x.102:

 

 

Let us restart the same database:

START DATABASE ‘c:\\newrepro\\server1\\mirror_demo.db’ as mirror_demo autostop off mirror on;

A new entry appears in LDAP and now mirror_demo_mirror is running on 10.x.x.101 whilst mirror_demo_primary in on 10.x.x.102 :

 

 

 

At last, we can check the database server log files, to be sure that there are no errors. Below an extract from server1log.txt file

 Below an extract from server2log.txt file:

 

 

Reference: SAP SQL Anywhere 16 product manual

Tutorial: Creating a database mirroring system http://dcx.sap.com/index.html#sa160/en/dbadmin/da-highavailability-s-4980336.html

VALIDATE LDAP SERVER statement http://dcx.sap.com/index.html#sa160/en/dbreference/validate-ldap-server-statement.html

 

 

  • No labels