2018-01-13

Sybase listener is not starting with the new settings in interfaces file

One of the final step in Sybase installation can be change in the port that the server binds to, or adding a specific network interface, where sybase should listen on. This can be done using the sp_listener procedure and change in the interfaces file. Here,  there is an example of interfaces file and the failed command sp_listener. We want to allow Sybase to listen on the external interface 192.168.10.20:







SAP01
        master tcp ether SAP01 5000
        master tcp ether 192.168.10.20 5000
        query tcp ether SAP01 5000
SAP01_BS
        master tcp ether SAP01 5001
        query tcp ether SAP01 5001
SAP01_XP
        master tcp ether SAP01 5002
        query tcp ether SAP01 5002
SAP01_JSAGENT
        master tcp ether SAP01 4900
        query tcp ether SAP01 4900

and the port change from within of Sybase:

[root@SAP01 ~]# su - sap
-bash-4.3$ isql -Usa -SSAP01 -Ppassword
3>
4> sp_listener 'status'
5> go
 proto  host  port  status
 -----------------------------------------------------
 tcp
   SAP01  5000  active
DBCC execution completed. If DBCC printed error messages, contact a user with
System Administrator (SA) role.
(return status = 0)


1> sp_listener 'start','192.168.10.20:5000'
2> go
Msg 15936, Level 16, State 1:
Server 'SAP01', Procedure 'sp_listener', Line 107:
An error was encountered when starting a listener with protocol tcp, host
192.168.10.20, port 5000.
Msg 15038, Level 16, State 1:
Server 'SAP01', Procedure 'sp_listener', Line 107:
The specified port 5000 is invalid.
DBCC execution completed. If DBCC printed error messages, contact a user with
System Administrator (SA) role.
(return status = 1)"


Well, one line in the configuration looks sometimes differently.  In my case in the interfaces file there was no entry for:


SAP01
       master tcp ether SAP01 5000


instead of this I have:

SAP01
       master tcp ether localhost 5000


This is another interfaces file for comparison:

SAP01
    master tcp ether localhost 5000
    master tcp ether 192.168.137.100 5000
    query tcp ether localhost 5000
ACCOUNTING
    query tcp ether localhost 5000
SAP01_BS
    master tcp ether localhost 5001
    query tcp ether localhost 5001
SAP01_XP
    master tcp ether localhost 5002
    query tcp ether localhost 5002
SAP01_JSAGENT
    master tcp ether localhost 4900
    query tcp ether localhost 4900

SAP01 in this case is pointing to the external interface and that after bringing SAP01 listener up it already reserves the port 5000. So, when you next start the listener binding to the IP address you receive error related to incorrect 5000 port because it is already used (reserved).

To verify whether this is the case, you can issue following OS command:

netstat -an | more

You should see all the ports, which some processes are listening on. If the 5000 is among them - than this is our case. 
Indeed, in case of this server port 5000 was already in use in my configuration:
-bash-4.3$ netstat -an | grep -i 5000
tcp        0      0 192.168.10.24:5000       0.0.0.0:*               LISTEN
tcp        0      0 192.168.10.24:5000       192.168.10.24:56614      ESTABLISHED
tcp        0      0 192.168.10.24:56618      192.168.10.24:5000       ESTABLISHED
tcp        0      0 192.168.10.24:56614      192.168.10.24:5000       ESTABLISHED

tcp        0      0 192.168.10.24:5000       192.168.10.24:56624      ESTABLISHED
tcp        0      0 192.168.10.24:56612      192.168.10.24:5000       ESTABLISHED
tcp        0      0 192.168.10.24:5000       192.168.10.24:56622      ESTABLISHED
tcp        0      0 192.168.10.24:5000       192.168.10.24:56616      ESTABLISHED
tcp        0      0 192.168.10.24:5000       192.168.10.24:56610      ESTABLISHED
tcp        0      0 192.168.10.24:56622      192.168.10.24:5000       ESTABLISHED
tcp        0      0 192.168.10.24:5000       192.168.10.24:56612      ESTABLISHED
tcp        0      0 192.168.10.24:56624      192.168.10.24:5000       ESTABLISHED
tcp        0      0 192.168.10.24:56620      192.168.10.24:5000       ESTABLISHED

tcp        0      0 192.168.10.24:5000       192.168.10.24:56618      ESTABLISHED
tcp        0      0 192.168.10.24:56610      192.168.10.24:5000       ESTABLISHED
tcp        0      0 192.168.10.24:5000       192.168.10.24:56620      ESTABLISHED
tcp        0      0 192.168.10.24:56616      192.168.10.24:5000       ESTABLISHED

In such case ofter an error message will be displayed like:
kernel  network name localhost, interface IPv4, address 127.0.0.1, type tcp, port 5000, filter NONE
kernel  network name 192.168.10.20, interface IPv4, address 192.168.10.20, type tcp, port 5000, filter NONE
kernel  ninit: bind, Cannot assign requested address
kernel  Cannot allocate resources for listener with protocol tcp, host 192.168.10.20, port 5000.

 
Well time to come to some results. Here the host name of the machine was equal to the name of the sybase server. So, those 2 lines in the interfaces file define generally the same binding:
SAP01
        master tcp ether SAP01 5000
        master tcp ether 192.168.10.20 5000

SAP01 == 192.168.10.20. Generally nothing to change!
-bash-4.3$ uname -a
Linux SAP01.domain.com 4.8.13-100.fc23.x86_64 #1 SMP Fri Dec 9 14:51:40 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

In this case the name SAP01 was bound not only to 127.0.0.1, but to the external interface as well.

No comments:

Post a Comment

SAP Adaprive Server Enterprise

SAP Adaprive Server Enterprise
SAP Adaprive Server Enterprise