Sybase: Change the IP address of a remote server

In order to access a remote database, you need to add a remote server and create a proxy database as shown here.

If your remote server gets a new IP address, you can of course drop the proxy database and remote server and recreate them. But I didn’t want to do that, so just update the sysservers table in the master database:

1> sp_configure 'allow updates to system tables', 1
2> go
 Parameter Name                 Default              Memory Used Config Value         Run Value            Unit                 Type
 ------------------------------ -------------------- ----------- -------------------- -------------------- -------------------- --------------------
 allow updates to system tables           0                    0            1                    1         switch               dynamic

(1 row affected)
Configuration option changed. ASE need not be rebooted since the option is dynamic.
Changing the value of 'allow updates to system tables' does not increase the amount of memory Adaptive Server uses.
(return status = 0)
1> update master..sysservers set srvnetname='192.168.230.236:2055' where srvid=4
2> go
(1 row affected)
1> sp_configure 'allow updates to system tables', 0
2> go
 Parameter Name                 Default              Memory Used Config Value         Run Value            Unit                 Type
 ------------------------------ -------------------- ----------- -------------------- -------------------- -------------------- --------------------
 allow updates to system tables           0                    0            0                    0         switch               dynamic

(1 row affected)
Configuration option changed. ASE need not be rebooted since the option is dynamic.
Changing the value of 'allow updates to system tables' does not increase the amount of memory Adaptive Server uses.
(return status = 0)

In order to update a system table like sysservers you first need to allow such changes. After modifying sysservers, you can disable such updates again as shown above.

Now testing whether I can still refresh my proxy:

1> alter database myproxydb for proxy_update
2> go
Msg 11216, Level 16, State 13:
Server 'SYBASE', Line 1:
Internal Ct-Lib/Cs-Lib error 84083972: 'ct_connect(): network packet layer: internal net library error: Net-Lib protocol driver call to connect two endpoints failed'.
Msg 11206, Level 16, State 1:
Server 'SYBASE', Line 1:
Unable to connect to server 'SOURCE'.

So I thought it was some kind of network connectivity issue, but:

# telnet 192.168.230.236 2055
Trying 192.168.230.236...
Connected to 192.168.230.236.
Escape character is '^]'.

So I can connect to the remote ASE with telnet, so must have missed something else. In the end, I never figured out why it didn’t but did find an alternative way to do this:

1> sp_addserver SOURCE, ASEnterprise, "192.168.230.236:2055"
2> go
Msg 17290, Level 16, State 1:
Server 'SYBASE', Procedure 'sp_addserver', Line 328:
There is already a server named 'SOURCE', physical name '192.168.230.236:2055'.

Ok, it doesn’t work because I’ve already updated sysservers manually, so setting it back to the way it was before the update:

1> sp_configure 'allow updates to system tables', 1
2> go
 Parameter Name                 Default              Memory Used Config Value         Run Value            Unit                 Type
 ------------------------------ -------------------- ----------- -------------------- -------------------- -------------------- --------------------
 allow updates to system tables           0                    0            1                    1         switch               dynamic

(1 row affected)
Configuration option changed. ASE need not be rebooted since the option is dynamic.
Changing the value of 'allow updates to system tables' does not increase the amount of memory Adaptive Server uses.
(return status = 0)
1> update master..sysservers set srvnetname='192.168.230.225:2055' where srvid=4
2> go
(1 row affected)
1> sp_configure 'allow updates to system tables', 0
2> go
 Parameter Name                 Default              Memory Used Config Value         Run Value            Unit                 Type
 ------------------------------ -------------------- ----------- -------------------- -------------------- -------------------- --------------------
 allow updates to system tables           0                    0            0                    0         switch               dynamic

(1 row affected)
Configuration option changed. ASE need not be rebooted since the option is dynamic.
Changing the value of 'allow updates to system tables' does not increase the amount of memory Adaptive Server uses.
(return status = 0)

And changing the IP address again using sp_addserver:

1> sp_addserver SOURCE, ASEnterprise, "192.168.230.236:2055"
2> go
Changing physical name of server 'SOURCE' from '192.168.230.225:2055' to '192.168.230.236:2055'

That’s right! sp_addserver doesn’t only add a server but can also change the physical name of a server. Now trying to refresh the proxy again:

1> alter database pdir_old for proxy_update
2> go

No error message this time ! That was easy (well, once you figure out that sp_addserver is actually sp_add_or_update_server…).

Leave a Reply

Your email address will not be published.