27.1 Rebuilding the Sybase Database

If your ZENworks database is an embedded or external Sybase database, you should rebuild the database so that it runs on the latest version of the Sybase database engine.

  1. Ensure that you have archived your database credentials.

    To archive the credentials of an external Sybase database, contact your database administrator.

    To archive the credentials of an embedded or external OEM Sybase database, perform the following tasks on the database server:

    1. Ensure the database service is running.

      On Windows: In the Windows Services, ensure that the status of Novell ZENworks Embedded Datastore is Started.

      On Linux: At the console prompt,

      • To verify the status of the database, enter:

        • /etc/init.d/sybase-asa status on SLES 11.

        • systemctl status sybase-asa.service on SLES 12.

      • If the database is not running, then enter:

        • /etc/init.d/sybase-asa start on SLES 11.

        • systemctl start sybase-asa.service on SLES 12.

    2. Obtain the Sybase connection information by running the zman dgc command.

    3. Provide the credentials of the ZENworks administrator when prompted.

    4. Copy and save the database user name and password into a text file.

  2. Stop the Novell ZENworks Embedded Datastore service, if it is running.

    • On Windows: Do the following:

      1. From the Start menu, click Settings > Control Panel.

      2. Double-click Administrative Tools > Services.

      3. Right-click the Novell ZENworks Embedded Datastore service, then click Stop, or select the Novell ZENworks Embedded Datastore service, then click Stop icon on the toolbar.

    • On Linux: At the console prompt, enter

      • /etc/init.d/sybase-asa stop on SLES 11.

      • systemctl stop sybase-asa.service on SLES 12.

  3. Stop the ZENworks services on all other 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.

  4. At the console prompt, go to the Sybase database directory. By default, it is %ZENWORKS_HOME%\database on Windows, and /var/opt/novell/zenworks/database on Linux.

  5. Take a reliable backup of the zenworks_zone_name.db and Zenworks_zone_name.log files.

    For detailed information on how to take an immediate backup of the files of the embedded Sybase database, see Section 3.0, Backing Up the Embedded Sybase SQL Anywhere Database. For detailed information on how to take an immediate backup of the files of the external Sybase database, see Section 12.0, Backing Up the External Sybase Database.

  6. Start the Novell ZENworks Embedded Datastore service.

    • On Windows: Perform the following:

      1. From the Windows desktop Start menu, click Settings > Control Panel.

      2. Double-click Administrative Tools > Services.

      3. Right-click the Novell ZENworks Embedded Datastore service, then click Start, or select the Novell ZENworks Embedded Datastore service, then click Start icon on the toolbar.

    • On Linux: At the console prompt, enter

      • /etc/init.d/sybase-asa start on SLES 11.

      • systemctl start sybase-asa.service on SLES 12.

  7. (Conditional) If your database is installed on Linux, run the following script file:

    source /opt/novell/zenworks/share/sybase/bin32/sa_config.sh

  8. Ensure that the database authentication has been set up by verifying that the database_authentication attribute in the saopts.sql file has been configured.

    The saopts.sql file is located in the %ZENWORKS_HOME%\share\asa\scripts\ directory on Windows, and in the /opt/novell/zenworks/share/sybase/scripts/ directory on Linux. The database_authentication attribute is located in the following entry in the saopts.sql file:

    if not exists( select * from SYS.SYSOPTION
     where ucase( "option" )  = ucase( 'database_authentication' ) ) then
        set option PUBLIC.database_authentication = <value>;
    end if
    go

    If the value of set option PUBLIC.database_authentication is empty or does not exist in the script, continue with Step 8.a to launch the DBISQL utility and to configure the database authentication; else skip to Step 9.

    1. Launch the DBISQL utility. For more information, see Step 1 in the Backing Up the External Sybase Database on a Windows or Linux Server.

    2. In the SQL Statements section, specify the following query:

      select setting
      from sysoptions 
         where "option" like 'database%' >># output_filename
    3. Click Execute SQL Statement(s).

      The results of the query are written in the output file that you specify in the query.

    4. Copy the result of the query from the output file, and paste it as the value of the database_authentication attribute in the saopts.sql file. The saopts.sql file is located in the %zenworks_home%\share\asa\scripts\ directory on Windows, and in the /opt/novell/zenworks/share/sybase/scripts/ directory on Linux.

      The database_authentication attribute is located in the following entry in the saopts.sql file:

      if not exists( select * from SYS.SYSOPTION
       where ucase( "option" )  = ucase( 'database_authentication' ) ) then
          set option PUBLIC.database_authentication = <output_of_the_query_run_in_Step_8b>;
      end if
      go
  9. Stop the Novell ZENworks Embedded Datastore service.

    • For the Embedded Database: Stop the ZENworks services, including the Novell ZENworks Embedded Datastore service:

      1. At the console prompt, run the novell-zenworks-configure -c Start command.

      2. Type the option number corresponding to Stop.

      3. Press Enter twice.

    • For the External Database: Stop the Novell ZENworks Embedded Datastore Service by stopping the Windows Services manager on Windows, or by running the /etc/init.d/sybase-asa stop command on Linux.

  10. Open another command prompt on the database server, and run the dbunload command. ZENworks Database services must be stopped at this point.

    Run the appropriate command:

    On Windows:

    <ZENWORKS_HOME>\share\ASA\BIN64\dbunload.exe -c "UID=zenadmin;PWD=password;DBF=<ZENWORKS_HOME>\database\zenworks_<ZoneName>.db" -ar -ap 4096 -ii -et"

    On Linux:

    /opt/novell/zenworks/share/sybase/bin64s/dbunload -c "UID=zenadmin;PWD=password;DBF=/var/opt/novell/zenworks/database/zenworks_<ZoneName>.db" -ar -ap 4096 -ii -et"

    where ZENWORKS_HOME is the folder path that is selected during installation, and ZoneName is the name that is specified in the Zone Name field during installation.

    This will rebuild the original database and replace the files with the new files.

  11. After the database rebuild has been successfully completed, take a reliable backup of the newly built database. The database is located in the c:\dbreload\unload directory on Windows and in the /tmp/dbreload/unload directory on Linux.

    If you encounter any issues during the rebuild process, contact Novell Support.

  12. Stop the Novell ZENworks Embedded Datastore service by using the dbeng12 command:

    • On Windows: Right-click the Rebuild icon located in Windows taskbar, then click Shutdown.

    • On Linux: At the console prompt, enter q.

  13. Overwrite the database and applicable log file in the database directory with the new ones located in the unload directory (zenworks_management_zone_name.*).

    The unload directory is located in c:\dbreload\ on Windows or in /tmp/dbreload/ on Linux.

  14. Start the Novell ZENworks Embedded Datastore service.

    • For the Embedded Database: Start all the ZENworks services, including the Novell ZENworks Embedded Datastore service:

      1. At the console prompt, run the novell-zenworks-configure -c Start command.

      2. Type the option number corresponding to Start.

      3. Press Enter twice.

    • For the External Database: Start the Novell ZENworks Embedded Datastore service in the Services window on Windows, or run the /etc/init.d/sybase-asa start command on Linux.

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

  16. Take a backup of the newly created database on a regular basis (daily or weekly).