2017-02-19

Backup: Backup Server

There is a special service associated with Sybase installation: Backup Server. It can be used to perform the backup or load:
  • remotely
  • directly from disk, bypassing the main Sybase process
The steps done during a backup or restore process performed this way are:
  • Sybase process (can be from a different machine) sends using Remote Procedure Call (RPC) a request to perform a backup/load operation
  • Backup can be divided into many stripes. It is Backup Server responsibility to decide how big the stripes will  be. Additionally those stripes (files) can be located on local drives, but also on remote shares making the backup less depended on the same hardware as the database itself!
  • It is possible that a local Backup Server will perform the backup on locally installed databases and send the data to remote Backup Server, which in turn will save the received backup on local tapes available on that remote machine.
Of course backup server needs to be installed and configured on the same machine as the Sybase. That is a requirement, because backup server process needs to have access to the same devices as Sybase server has. Backup server listens on dedicated port that is different than the Sybase port. The information regarding ports can be found in the interfaces file. Below, an example content of interfaces file can be found:

[sap@SAPSybase ~]$ more interfaces

SAP01
        master tcp ether localhost 5000
        query tcp ether localhost 5000
        master tcp ether 192.168.137.11 5000
        query tcp ether 192.168.137.11 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

Here Sybase server listens on port 5000, while Backup Server named SAP01_BS on port 5001.This backup server is capable of performing backups only on that one machine, however it can be called from outside by other Sybase family processes.
To find what Backup Servers are available Sybase checks the content of sysservers table:

SELECT * FROM master..sysservers

The result can be similar to:

When operation on Backup Server should be performed Sybase looks for SYS_BACKUP entry and finds the correct srvname and srvnetname. Having
If a new server should be defined here the procedure sp_addserver should be used with basic syntax:

exec sp_addserver remote_backup_name, class, network_name

here:
  • remote_backup_name is the name how the newly defined server should use
  • class can be local and this allows to define local backup server, it can be also one of the allowed class names or null if you don't want to define the class
  • network_name is the name as it should appear in the interfaces file

However this is not enough for a remote Backup Server to be used. Additionally also correct entries should be added to the interfaces file.
During the installation of SAP Sybase by default Backup Server is also installed. It is however not configured to start automatically. The script defining the Backup Server is: /opt/sap/ASE-16_0/install/RUN_SAP01_BS. An example content of this file can be found below:

[sap@SAPSybase install]$ more RUN_SAP01_BS
#!/bin/sh
#
# Error log path:       /opt/sap/ASE-16_0/install/SAP01_BS.log
# Maximum number of network connections:        25
# Maximum number of server connections: 20
# Interfaces file path: /opt/sap/interfaces
# Multibuf executable path:     /opt/sap/ASE-16_0/bin/sybmultbuf
# Backup Server name:   SAP01_BS
#
/opt/sap/ASE-16_0/bin/backupserver \
-e/opt/sap/ASE-16_0/install/SAP01_BS.log \
-N25 \
-C20 \
-I/opt/sap/interfaces \
-M/opt/sap/ASE-16_0/bin/sybmultbuf \
-SSAP01_BS \

To start Backup Server execute just following command:

/opt/sap/ASE-16_0/bin/startserver -f /opt/sap/ASE-16_0/install/RUN_SAP01_BS

To stop Backup Server following command should be issued from isql:

SHUTDOWN SYB_BACKUP WITH NOWAIT

of course instead of using WITH NOWAIT also WITH WAIT could be use. WITH WAIT is more nice as this command allows the other processes using the Backup Server to finish their jobs, while NOWAIT breaks all at the moment working processes.

There is one more interesting point about Backup Server. This is software that can run on a remote machine, for example on machine with tape drives attached. Let's suppose that we are restoring a database and we finished reading data from one tape and now a second one tape should be put into the tape drive. How Backup Server will handle this situation?
  • first a message will be generated about the tape to be changed
  • operator should monitor that log and should replace the tape
  • after that a procedure sp_volchanged should be called by the operator:
sp_volchanged session_id, devicename, action

The meaning of the parameters:
  • sessionid - should be taken from message recorded initially by Backup Server
  • devicename - also should be the same as in the message recorded from the Backup Server
  • action can be abort (to cancel the operation), proceed (to continue with the backup or restore) or retry (if some error appeared and there is a chance that after next trial the process will succeed)

No comments:

Post a Comment

SAP Adaprive Server Enterprise

SAP Adaprive Server Enterprise
SAP Adaprive Server Enterprise