34.1 Backing Up the External Sybase Database

When an external Sybase database (Remote OEM Sybase or Remote Sybase SQL Anywhere) has been installed by using the ZENworks 10 Configuration Management installation media, you can back it up to a directory on the local machine or to a network location.

NOTE:This documentation provides instructions to back up the external Sybase database by using the DBISQL utility. You can choose to back up the database by using any other utility that is recommended in the Sybase SQL Anywhere documentation.

34.1.1 Backing Up the External Sybase Database on a Windows or Linux Server

  1. On the Windows or Linux server that has the external Sybase database installed and running, launch the DBISQL utility:

    1. At the command prompt, go to the %ZENWORKS_HOME%\share\ASA\win32 directory on Windows or to the /opt/novell/zenworks/share/sybase/bin32s directory on Linux.

    2. Enter the dbisql command.

    3. In the Identification tab, specify the database credentials.

    4. Click the Database tab, then specify the name of database service that is currently running.

    5. Click OK.

  2. Decide whether you want to immediately back up the external Sybase database or to schedule the backup to run at a specific time. To immediately back up the database, continue with Step 2.a. To schedule the backup to run at a specific time, skip to Step 3.

    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. To immediately back up the embedded Sybase SQL Anywhere database to a directory on the database server, do one of the following:

      • Specify the following query in the SQL Statements section of the DBISQL utility:

        BACKUP DATABASE DIRECTORY ‘complete_path_of_the_backup_directory_on_database_server’ TRANSACTION LOG TRUNCATE

        If you want to back up the database to a directory on Windows, you must use \\ (double backslash) as the delimiter while specifying the database backup directory path.

        Examples:

        • On Windows: To back up the database to the c:\dbbackup directory, execute the following query:

          BACKUP DATABASE DIRECTORY ‘c:\\dbbackup’ TRANSACTION LOG TRUNCATE

        • On Linux: To back up the database to the /root/dbBackup directory, execute the following query:

          BACKUP DATABASE DIRECTORY ‘/root/dbBackup’ TRANSACTION LOG TRUNCATE

        You must manually archive the complete path of the database backup location that you specify in the query because you need to specify it when you want to change the database backup location at a later time.

      • 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. Click Execute SQL Statement(s).

    4. 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. To schedule the backup to run at a specific time every day or on specific days of a month:

    1. Execute the following query by specifying it in the SQL Statements section of the DBISQL utility:

      CREATE EVENT backup_schedule_name
      
      SCHEDULE
      
      START TIME specify_the_schedule
      
      HANDLER
      
      BEGIN
      
      BACKUP DATABASE DIRECTORY ‘complete_path_of_the_backup_directory_on_database_server
      TRANSACTION LOG TRUNCATE
      
      END;
      
    2. Click Execute SQL Statement(s).

      While creating a database backup event, use the following guidelines:

      • The backup schedule name must be unique.

      • If you want to back up the database to a directory on Windows, you must use \\ (double backslash) as the delimiter while specifying the database backup directory path. For example, c:\\dbbackup.

      • You must manually archive the backup schedule that you specify in the query because you need to specify it when you want to change the database schedule at a later time.

    Examples:

    • To back up the database at a 1:00 a.m. every day to the /var/ directory on Linux, execute the following query:

      CREATE EVENT ZENDBbackup
      
      SCHEDULE
      
      START TIME '1:00 AM' EVERY 24 HOURS   
      
      HANDLER
      
      BEGIN
      
      BACKUP DATABASE DIRECTORY ‘/var/’
      
      TRANSACTION LOG TRUNCATE
      
      END;
      
    • To back up the database at a 1:00 a.m. on the first, second, third, and fourth day of the month to the c:\dbbackup directory on Windows, execute the following query:

      CREATE EVENT ZENDBbackup
      
      SCHEDULE
      
      START TIME '1:00 AM' EVERY 24 HOURS ON (1,2,3,4) 
      
      HANDLER
      
      BEGIN
      
      BACKUP DATABASE DIRECTORY ‘c:\\dbbackup’
      
      TRANSACTION LOG TRUNCATE
      
      END;
      
    • To back up the database to the /var/day_of_the_week directory on Linux, execute the following query:

      CREATE EVENT ZENDBbackup
      
      SCHEDULE
      
      START TIME '1:00 AM' EVERY 24 HOURS   
      
      HANDLER
      
      BEGIN
      
      DECLARE backupDir varchar(256);
      
      DECLARE backup_stmt varchar(512);
      
      SET backupDir = DAYNAME(now());
      
      SET backup_stmt = 'BACKUP DATABASE DIRECTORY '|| '''/var//' || backupDir || ''''|| ' TRANSACTION LOG TRUNCATE';
      
      EXECUTE IMMEDIATE backup_stmt;
      
      END;
      

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, see Section 35.2.2, Changing the Backup Schedule and Location of the External Sybase Database Subsequent to the Initial Backup.

34.1.2 Backing up the External Sybase Database Running on a Windows Server to a Network Location on a Remote Windows Machine

To back up an external Sybase 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 external Sybase 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 you 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. Launch the DBISQL utility on the local machine:

    1. At the command prompt, go to the %ZENWORKS_HOME%\share\ASA\win32 directory on Windows or to the /opt/novell/zenworks/share/sybase/bin32s directory on Linux.

    2. Enter the dbisql command.

    3. In the Identification tab, specify the database credentials.

    4. Click the Database tab, then specify the name of database service that is currently running.

    5. Click OK.

  4. Decide whether you want to immediately back up the external Sybase database or to schedule the backup to run at a specific time. To back up the database immediately, continue with Step 4.a. To schedule the backup to run at a specific time, skip to Step 5.

    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. To immediately back up the embedded Sybase SQL Anywhere database to the network location on the remote machine, do one of the following:

      • Specify the following query in the SQL Statements section of the DBISQL utility:

        BACKUP DATABASE DIRECTORY ‘\\\\IP_address_of_remote_machine\\backup_directory\\custom_directory’ TRANSACTION LOG TRUNCATE

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

        For example, execute the following query to back up the database to the dbbackup directory:

        BACKUP DATABASE DIRECTORY ‘\\\\shared_network_location_on_remote_machine\\dbbackup’ TRANSACTION LOG TRUNCATE

        You must manually archive the complete path of the database backup location that you specify in the query because you need to specify it if you want to change the database backup location at a later time.

      • 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. Click Execute SQL Statement(s).

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

  5. To schedule the backup to run at a specific time every day or on specific days of a month:

    1. Execute the following query by specifying it in the SQL Statements section of the DBISQL utility:

      CREATE EVENT backup_schedule_name
      
      SCHEDULE
      
      START TIME specify_the_schedule
      
      HANDLER
      
      BEGIN
      
      BACKUP DATABASE DIRECTORY
      ‘\\\\IP_address_of_remote_machine\\backup_directory\\custom_directory
      TRANSACTION LOG TRUNCATE
      
      END;
      

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

      While creating a database backup event, use the following guidelines:

      • The backup schedule name must be unique.

      • You must manually archive the backup schedule that you specify in the query because you need to specify it if you want to change the database schedule at a later time.

    2. Click Execute SQL Statement(s).

    Examples:

    • To back up the database at a 1:00 a.m. every day to the dbbackup directory on Windows, execute the following query:

      CREATE EVENT ZENDBbackup
      
      SCHEDULE
      
      START TIME '1:00 AM' EVERY 24 HOURS   
      
      HANDLER
      
      BEGIN
      
      BACKUP DATABASE DIRECTORY ‘\\\\shared_network_location_on_remote_machine\\dbbackup’
      
      TRANSACTION LOG TRUNCATE
      
      END;
      
    • To back up the database at a 1:00 a.m. on the first, second, third, and fourth day of the month to the dbbackup directory on a Windows server, execute the following query:

      CREATE EVENT ZENDBbackup
      
      SCHEDULE
      
      START TIME '1:00 AM' EVERY 24 HOURS ON (1,2,3,4)   
      
      HANDLER
      
      BEGIN
      
      BACKUP DATABASE DIRECTORY ‘\\\\shared_network_location_on_remote_machine\\dbbackup’
      
      TRANSACTION LOG TRUNCATE
      
      END;
      
    • To back up the database to the \dbbackup\day_of_the_week directory on a Windows server, execute the following query:

      CREATE EVENT ZENDBbackup
      
      SCHEDULE
      
      START TIME '1:00 AM' EVERY 24 HOURS   
      
      HANDLER
      
      BEGIN
      
      DECLARE backupDir varchar(256);
      
      DECLARE backup_stmt varchar(512);
      
      SET backupDir = DAYNAME(now());
      
      SET backup_stmt = 'BACKUP DATABASE DIRECTORY '|| '''\\\\shared_network_location_on_remote_machine\\dbbackup/' || backupDir || ''''|| 'TRANSACTION LOG TRUNCATE';
      
      EXECUTE IMMEDIATE backup_stmt;
      
      END;
      

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, see Section 35.2.2, Changing the Backup Schedule and Location of the External Sybase Database Subsequent to the Initial Backup.

34.1.3 Backing up the External Sybase Database Running on a Linux Server to a Network Location on a Remote Linux Machine

To back up the external Sybase 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 external Sybase 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 an NFS share.

To back up the external Sybase 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 you 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 you created in Step 1.c.

      For example, specify the share name 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. Launch the DBISQL utility on the local machine:

    1. At the command prompt, go to the %ZENWORKS_HOME%\share\ASA\win32 directory on Windows or to the /opt/novell/zenworks/share/sybase/bin32s directory on Linux.

    2. Enter the dbisql command.

    3. In the Identification tab, specify the database credentials.

    4. Click the Database tab, then specify the name of database service that is currently running.

    5. Click OK.

  5. Decide whether you want to immediately back up the external Sybase database or to schedule the backup to run at a specific time. To back up the database immediately, continue with this Step 5.a. To schedule the backup to run at a specific time, skip to Step 6.

    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. To immediately back up the external Sybase database to the network location on the remote machine, do one of the following:

      • Specify the following query in the SQL Statements section of the DBISQL utility:

        BACKUP DATABASE DIRECTORY ‘complete_path_of_the_backup_directory_on_database_server’ TRANSACTION LOG TRUNCATE

        For example, execute the following query to back up the database to the /root/zenworks_dbbackup directory:

        BACKUP DATABASE DIRECTORY ‘/root/zenworks_dbbackup/’ TRANSACTION LOG TRUNCATE

        You must manually archive the complete path of the database backup location that you specify in the query because you need to specify it if you want to change the database backup location at a later time.

      • 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. Click Execute SQL Statement(s).

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

  6. To schedule the backup to run at a specific time every day or on specific days of a month:

    1. Execute the following query by specifying it in the SQL Statements section of the DBISQL utility:

      CREATE EVENT backup_schedule_name
      
      SCHEDULE
      
      START TIME specify_the_schedule
      
      HANDLER
      
      BEGIN
      
      BACKUP DATABASE DIRECTORY ‘complete_path_of_the_backup_directory_on_database_server
      TRANSACTION LOG TRUNCATE
      
      END;
      

      While creating a database backup event, use the following guidelines:

      • The backup schedule name that you specify must be unique.

      • You must manually archive the backup schedule that you specify in the query because you need to specify it if you want to change the database schedule at a later time.

    2. Click Execute SQL Statement(s).

    Examples:

    • To back up the database at a 1:00 a.m. every day to the /root/zenworks_dbbackup directory on Linux, execute the following query:

      CREATE EVENT ZENDBbackup
      
      SCHEDULE
      
      START TIME '1:00 AM' EVERY 24 HOURS   
      
      HANDLER
      
      BEGIN
      
      BACKUP DATABASE DIRECTORY ‘/root/zenworks_dbbackup/’
      
      TRANSACTION LOG TRUNCATE
      
      END;
      
    • To back up the database at a 1:00 a.m. on the first, second, third, and fourth day of the month to the /root/zenworks_dbbackup directory on Linux, execute the following query:

      CREATE EVENT ZENDBbackup
      
      SCHEDULE
      
      START TIME '1:00 AM' EVERY 24 HOURS ON (1,2,3,4)   
      
      HANDLER
      
      BEGIN
      
      BACKUP DATABASE DIRECTORY ‘/root/zenworks_dbbackup/’
      
      TRANSACTION LOG TRUNCATE
      
      END;
      
    • To back up the database to the /root/zenworks_dbbackup/day_of_the_week directory on Linux, execute the following query:

      CREATE EVENT ZENDBbackup
      
      SCHEDULE
      
      START TIME '1:00 AM' EVERY 24 HOURS   
      
      HANDLER
      
      BEGIN
      
      DECLARE backupDir varchar(256);
      
      DECLARE backup_stmt varchar(512);
      
      SET backupDir = DAYNAME(now());
      
      SET backup_stmt = 'BACKUP DATABASE DIRECTORY '|| '''/root/zenworks_dbbackup//' || backupDir || ''''|| ' TRANSACTION LOG TRUNCATE';
      
      EXECUTE IMMEDIATE backup_stmt;
      
      END;
      

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, see Section 35.2.2, Changing the Backup Schedule and Location of the External Sybase Database Subsequent to the Initial Backup.