28.3 Backing Up the Embedded Sybase SQL Anywhere Database

The embedded Sybase SQL Anywhere database can be backed up to a directory on the local machine or to a network location.

28.3.1 Backing Up the Embedded Sybase SQL Anywhere Database on a Windows or Linux Server

  1. Store the ZENworks administrator name and password by entering the following command at the command prompt:

    zman admin-store-credential administrator

    If you do not store the credentials, you must enter the ZENworks administrator name and password for each zman command.

  2. You can immediately back up the embedded Sybase SQL Anywhere database or schedule the backup to run at a specific time. To back up the embedded Sybase SQL Anywhere database immediately, continue with this step. To schedule the backup to run at a specific time, skip to Step 3.

    To immediately back up the embedded Sybase SQL Anywhere database to a directory on the database server by using the zman command line utility, enter the following command at the database server console prompt:

    zman database-backup complete_path_of_the_backup_directory_on_database_server

    For example, to back up the database to the c:\dbbackup directory on a Windows database server, execute zman database-backup c:\dbbackup. To back up the database to the /root/dbBackup directory on a Linux database server, execute zman database-backup /root/dbBackup.

    To manually back up the embedded Sybase SQL Anywhere database to a directory on the database server:

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

      • On Windows: Do the following

        1. Execute the following command at the server prompt:

          novell-zenworks-configure -c Start

        2. Specify the number next to the Stop action, then press Enter.

      • On Linux: Do the following:

        1. Execute the following command at the server prompt:

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

        2. Specify the number next to the Stop action, then press Enter.

    2. Manually copy zenworks_zone_name.db and zenworks_zone_name.log from the database server to the new location where you want to back up the database.

      By default, the files are located in ZENworks_Installation_directory\Novell\Zenworks\Database on a Windows Sybase database server, and 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.

      • On Windows: Do the following

        1. Execute the following command at the server prompt:

          novell-zenworks-configure -c Start

        2. Specify the number next to the Start action, then press Enter.

      • On Linux: Do the following:

        1. Execute the following command at the server prompt:

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

        2. Specify the number next to the Start action, then press Enter.

  3. (Conditional) To schedule the backup to run at a specific time every day or on specific days of a month, you need to create a schedule file and run it.

    1. Create a schedule file with the Create event, 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. every day 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 day 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 on a Windows server, and in the /opt/novell/zenworks/share/zman/samples/database directory on a Linux server.

    2. Enter the following command at the command prompt:

      zman database-backup complete_path_of_the_backup_directory complete_path_of_backUpSchedule.sql -d SQL_function_call

      For example, to back up the database to the c:\dbbackup\day_of_the_week directory on a Windows server as per the schedule in the c:\backupschedule.sql file, enter the following command:

      zman database-backup c:\dbbackup c:\backUpSchedule.sql -d "DAYNAME(now())"

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

  4. Clear the credentials stored in Step 1 by entering the following command at the command prompt:

    zman admin-clear-credential

According to the backup schedule, the zenworks_zone_name.db database file and the zenworks_zone_name.log transaction log file are created in the database backup directory.

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

28.3.2 Backing Up the Embedded Sybase SQL Anywhere Database Running on a Windows Server to a Network Location on a Remote Windows Machine

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

  1. Perform the following steps on the local machine:

    1. Create an administrative user and specify a password.

      For example, you could specify the administrative username as Administrator and the password as novell.

    2. From the desktop Start menu, click Settings, click Control Panel, double-click Administrative Tools, then double-click Services.

    3. Right-click the Novell ZENworks Datastore service, then click Properties.

    4. Click the Log On tab.

    5. Select This account, then specify the name and the password of the administrative user created in Step 1.a.

      For example, specify the user as Administrator and the password as novell.

    6. Click OK.

  2. Perform the following steps on the remote machine that has the network location where you want to save the backup:

    1. Create an account with the same credentials as the user you created in Step 1.a.

      For example, specify user as Administrator and password as novell.

    2. Provide Read/Write permission on the network location to the user.

  3. 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 4.

    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 \\IP_address_of_the_remote_machine\backup_directory\custom_directory

    Where \\IP_address_of_the_remote_machine\backup_directory is the network location on the remote machine and custom_directory_name is a name that you specify for a directory to be newly created by zman and into which the database files are to be backed up.

    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:

        novell-zenworks-configure -c Start

      2. Specify the number next to the Stop action, then press Enter.

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

      By default, the files are located in ZENworks_Installation_directory\Novell\Zenworks\Database on a Windows 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:

        novell-zenworks-configure -c Start

      2. Specify the number next to the Start action, then press Enter.

  4. (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. every day 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 day 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. Execute the following command at the command prompt:

      zman database-backup \\IP_address_of_the_remote_machine\backup_directory\custom_directory c:\backUpSchedule.sql -d SQL_function_call

      Where \\IP_address_of_the_remote_machine\backup_directory is the network location on the remote machine and custom_directory_name is a name that you specify for a directory to be newly created by zman and into which the database files are to be backed up.

      For more information about the command, view the zman man page (man zman) on the device, or see zman(1) in the ZENworks 10 Asset Management 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. 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:

28.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 in to 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 embedded Sybase SQL Anywhere 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. Specify the number next to the Stop action, then press Enter.

    2. Manually copy zenworks_zone_name.db and zenworks_zone_name.log from the database server to a desired 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. Specify the number next to the Start action, then press Enter.

  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. every day 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 10 Asset Management 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: