12.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 user name 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. For more information, see Step 1 in the Backing Up the External Sybase Database on a Windows or Linux Server.

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

  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:

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