3.3 Backing up the Embedded Sybase SQL Anywhere Database Running on a Linux Server to a Network Location on a Remote Linux Machine

To back up the embedded Sybase SQL Anywhere database that is installed and running on a Linux server to a network location on a Linux machine, you need a local machine and a remote machine. The local machine is a Linux server with the ZENworks server components and the embedded Sybase SQL Anywhere database installed. The remote machine is a Linux machine that has the network location to which you want to back up the database.

You can back up the database on a Linux machine by using any Linux share such as Samba share or NFS share.

To back up the embedded Sybase SQL Anywhere database that is installed and running on a Linux server to a network location on a Linux machine by using Samba share:

  1. Create a Samba share on the remote machine:

    1. Create a user by entering the useradd user_name command at the command prompt.

    2. Log into the remote machine with the username created in Step 1.a, and set the password by using the passwd specify_the_password command.

    3. Create a directory to save the database backup.

      For example, create a directory with the name backup.

    4. Open the Samba server settings by running the yast2 samba-server command.

    5. Click the Shares tab, then click Add to specify the share name and the path to the backup directory created in Step 1.c.

      For example, specify the sharename as dbbackup.

    6. Select the dbbackup share, click Edit, then add the following attributes:

      • create mask = 0640

      • force user = user_name_created_in_Step 1.a

      • guest ok = yes

      • public = yes

      • wide links = no

      • writeable = yes

  2. Create a directory on the local machine.

    For example, create a directory with the name zenworks_dbbackup in /root.

  3. Mount the Samba share on the zenworks_dbbackup directory on the local machine by entering the following command at the command prompt:

    mount -t smbfs //IP_address of the remote_machine/share_name -o username=user_name_specified_in_Step1a,password=password_ specified_in_Step_1b local_directory_name_with_complete_path_created_in_Step2

    For example:

    mount -t smbfs //IP_address of the remote_machine/dbbackup -o username=user_name_specified_in_Step1a,password=password_ specified_in_Step_1b /root/zenworks_dbbackup

  4. You can immediately back up the database or schedule the backup to run at a specific time.To immediately back up the database, continue with this step. To schedule the backup to run at a specific time every day or on specific days of a month, skip to Step 5.

    To immediately back up the database to the network location on the remote machine by using the zman command line utility, enter the following command at the database server console prompt:

    zman database-backup database_backup_directory

    For example:

    zman database-backup /root/zenworks_dbbackup

    To manually back up the database to the network location on the remote machine:

    1. Stop all the ZENworks Services on the all the ZENworks Servers in the Management Zone.

      1. Execute the following command at the server prompt:

        /opt/novell/zenworks/bin/novell-zenworks-configure -c Start

      2. Enter the number next to the Stop action.

    2. Manually copy zenworks_zone_name.db and zenworks_zone_name.log from the database server to a required location on the remote machine.

      By default, the files are located in /var/opt/novell/zenworks/database/ on a Linux Sybase database server.

    3. Start all the ZENworks Services on the all the ZENworks Servers in the Management Zone.

      1. Execute the following command at the server prompt:

        /opt/novell/zenworks/bin/novell-zenworks-configure -c Start

      2. Enter the number next to the Start action.

  5. (Conditional) To schedule the backup:

    1. Create a schedule file, backupschedule.sql, with the following contents:

      CREATE EVENT backup_schedule_name
      SCHEDULE
      specify_the_schedule   

      A sample schedule file to back up the database at a 11 p.m. everyday is as follows:

      CREATE EVENT ZENDBBackup
      SCHEDULE
      START TIME '11:00 PM' 
      EVERY 24 HOURS

      A sample schedule file to back up the database at 1:00 a.m. on the first, second, third, and fourth days of the month is as follows:

      CREATE EVENT ZENDBBackup1
      SCHEDULE
      START TIME '1:00 AM'
      ON (1,2,3,4)

      Sample schedule files are available in the ZENworks_Installation_directory:\Novell\Zenworks\ share\zman\samples\database directory.

    2. Enter the following command at the command prompt:

      zman database-backup database_backup_directory c:\backUpSchedule.sql -d SQL_function_call

      For example:

      zman database-backup /root/zenworks_dbbackup c:\backUpSchedule.sql -d SQL_function_call

      For more information about this command, view the zman man page (man zman) on the device, or see zman(1) in the ZENworks 11 SP4 Command Line Utilities Reference.

According to the backup schedule, zenworks_zone_name.db and zenworks_zone_name.log are created in the network location on the remote machine (/root/zenworks_dbbackup). The backed-up database is stored in zenworks_zone_name.db. The result of the database backup is logged in zenworks_zone_name.log.

If you want to change the database backup location or the backup schedule at a later time, review the following sections: