8.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%\sybase\ASA\BIN32 directory on Windows or to the /opt/novell/zenworks/share/sybase/bin32s directory on Linux.

    2. On Windows enter the dbisql command, or on Linux enter the ./dbisql command.

    3. In the Connection page, specify the following fields:

      • Specify the database credentials.

      • In Action, select Connect to running database on another computer.

      • In Host, specify the host name or IP address.

      • In Port, specify 2638 for ZENworks database, or 2639 for Audit database.

    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.

    NOTE:You need to stop the services before taking a manual backup of the database. In a scheduled backup, the command used for taking database backup stops the service before the backup.

    1. Stop the ZENworks Services on the ZENworks Servers in the Management Zone For more information, see Step 2.a in the Section 3.1, Backing Up the Embedded Sybase SQL Anywhere Database on a Windows or Linux Server.

    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 the ZENworks Services on the ZENworks Servers in the Management Zone. For more information, see Step 2.c in the Section 3.1, Backing Up the Embedded Sybase SQL Anywhere Database on a Windows or Linux Server.

  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

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