30.2 Database Tips

30.2.1 Changing the Backup Location and Schedule of the Embedded Sybase Database Subsequent to the Initial Backup

Review the following sections:

Changing the Backup Location of the Embedded Sybase SQL Anywhere Database Subsequent to the Initial Backup

To change the backup location of the embedded Sybase SQL Anywhere database subsequent to its initial backup:

  1. Delete the existing database backup schedule by executing the following command at the Primary Server command prompt:

    zman db current_database_backup_location DropSchedule.sql

    Dropschedule.sql is located by default 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 to back up the database to a new location:

    zman database-backup complete_path_of_the_new_database_backup_directory complete_path_of_the_database_backup_schedule_file -d SQL_function_call

    For example, to back up the database to the c:\dbbackup\newdbbackups directory on a Windows server according to the database backup schedule specified in the c:\backUpschedule.sql, enter the following command:

    zman database-backup c:\dbbackup\newdbbackups 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.

Changing the Backup Schedule of the Embedded Sybase SQL Anywhere Database Subsequent to the Initial Backup

To change the backup schedule of the embedded Sybase SQL Anywhere database subsequent to its initial backup:

  1. Create a schedule file with the Alter Event content:

    ALTER EVENT backup_schedule_name
    
    SCHEDULE
    
    START TIME specify_the_schedule   
    

    For example, you could use the Alterschedule.sql file to back up the database at a 11:00 p.m. on Monday, Tuesday, and Wednesday of every week as follows:

    ALTER EVENT ZENDBBackup
    
    SCHEDULE
    
    START TIME '11:00 PM'
    ON ('Monday', 'Tuesday', 'Wednesday')
    

    A sample Alterschedule.sql file is 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 to back up the database according to the new schedule:

    zman database-backup complete_path_of_the_database_backup_directory complete_path_of_the_modified_database_backup_schedule_file -d SQL_function_call

    For example, to back up the database to the c:\dbbackup\ directory on a Windows server according to the database backup schedule specified in the c:\AlterSchedule.sql, enter the following command:

    zman database-backup c:\dbbackup\ c:\AlterSchedule.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.

30.2.2 Changing the Backup Schedule and Location of the External Sybase Database Subsequent to the Initial Backup

To change the backup location and the backup schedule of the external Sybase database subsequent to its initial backup, perform the following tasks on the device that has the external Sybase database installed and running:

  1. 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. Change the database backup schedule and the backup location as desired.

    You can use the same SQL query to change the database backup schedule and the backup location. You can change the backup schedule and the location at the same time or at a different time.

    ALTER EVENT name_of_the_existing_backup_schedule_event_containing_the_database_backup_schedule_or_location_that_you_want_to_change
    
    SCHEDULE
    
    new_database_backup_schedule or existing_backup_schedule
    
    HANDLER
    
    BEGIN
    
    BACKUP DATABASE DIRECTORY ‘complete_path_of_the_existing_database_backup_location or complete_path_of new_database_backup_location
    TRANSACTION LOG TRUNCATE
    
    END;
    

    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, assume that you have database backup event, zendbbackup, that locally backs up the database to c:\dbackup at 1:00 a.m. every day. If you want to change the database backup schedule or location, review the following:

    • If you want to back up the database at 11:00 p.m. on Monday, Wednesday, and Friday of every week, change the database backup schedule in the zendbbackup event by executing the following query in the DBISQL utility:

      ALTER EVENT zendbbackup 
      
      SCHEDULE
      
      '11:00 PM' ON (‘Monday’, ‘Wednesday’, ‘Friday’)
      
      HANDLER
      
      BEGIN
      
      BACKUP DATABASE DIRECTORY ‘c:\\dbbackup’
      
      TRANSACTION LOG TRUNCATE
      
      END;
      
    • If you want to back up the database to a new location, such as e:\zendb\dbbackup, change the database backup location in the zendbbackup event by executing the following query in the DBISQL utility:

      ALTER EVENT zendbbackup 
      
      SCHEDULE
      
      '1:00 AM' EVERY 24 HOURS
      
      HANDLER
      
      BEGIN
      
      BACKUP DATABASE DIRECTORY ‘e:\\zendb\\dbbackup’
      
      TRANSACTION LOG TRUNCATE
      
      END;
      
    • If you want to back up the database at 2:00 a.m. on the first, second, and third day on the month to a new location, e:\zendb\dbbackup, change the database backup schedule and location in the zendbbackup event by executing the following query in the DBISQL utility:

      ALTER EVENT zendbbackup 
      
      SCHEDULE
      
      ‘2:00 AM' EVERY 24 HOURS ON (1,2,3)
      
      HANDLER
      
      BEGIN
      
      BACKUP DATABASE DIRECTORY ‘e:\\zendb\\dbbackup’
      
      TRANSACTION LOG TRUNCATE
      
      END;
      

30.2.3 Reverting to the ZENworks Sybase Database from the ZENworks Oracle Database

ZENworks 10 Asset Management allows you migrate the data from an internal or external Sybase database to an Oracle database installed on a device that does not have the ZENworks 10 Asset Management installed. You can revert to using ZENworks Sybase database at a later time if you have retained the ZENworks Sybase database files after migrating the data to Oracle.

To revert to using ZENworks Sybase database, perform the following tasks:

  1. On the device where you run the migration utility, rename the following files:

    • zdm.xml.bak to zdm.xml
    • dmaccounts.properties.bak to dmaccounts.properties
    • dmmappings.properties.bak to dmmappings.properties

    The files are located in the ZENworks_installation_path\conf\datamodel directory on Windows and in the /etc/opt/novell/zenworks/datamodel directory on Linux.

  2. Restart all the ZENworks Services on 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. Enter the number next to the Restart action.

    • On Linux: Do the following:

      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 Restart action.

30.2.4 Identifying the EBF Version of Sybase Database Server

To know the version of the EBF that is installed and running on the Sybase database server, run the dblocate utility. The utility is located in the %ZENWORKS_HOME%\share\ASA\win32 directory on a Windows database server and in the /opt/novell/zenworks/share/sybase/bin32s directory on a Linux database server.