Upgrading the database schema

Changes to the WhatsUp Gold v12 application require that the database schema be upgraded. If you are running a default database configuration, the WhatsUp Gold v12 upgrade automatically upgrades your database schema for you. If not, you must manually upgrade your database schema after installing WhatsUp Gold v12 before you can use the application.

You must first complete the WhatsUp Gold installation, then upgrade the database schema. This section steps through how to upgrade the database schema for an installation of WhatsUp Gold that is a non-default configuration.

To upgrade the database from WhatsUp Gold v11.x or WhatsUp Professional 2006:

  1. Make a backup of your WhatsUp database.

    Warning: Ipswitch Technical Support may not be able to recover your network data from a database which has failed an upgrade attempt. It is imperative to make a backup copy of the database, in case any portion of the database schema upgrade encounters a problem.

  2. Copy the <WUG_Install_Folder>\DB Scripts folder to the computer running the SQL Server that hosts the WhatsUp database.

    Important: You must copy the entire DB Scripts folder to the computer running the SQL Server. This includes any files and sub-directories it may contain.

  3. Make note of the fully qualified path to the DB Scripts directory, it may be required in the steps that follow.
  4. Run the upgrade scripts, either by running the Visual Basic (VB) script which automatically runs each script in sequence or by running each script individually using the SQL Management tools.

    Warning: The upgrade scripts should be run only once. If an upgrade script is interrupted or errors occur, you must restore your database before running the scripts a second time.

    Important: Before running the scripts, close the WhatsUp Gold application; then, stop the Ipswitch WhatsUp Engine and the Ipswitch Web Server service, for more information see Stopping and starting the Ipswitch WhatsUp Engine and Stopping and starting the internal web server in the Help. If you are running IIS as your web server, stop IIS, then restart it.

To upgrade the database automatically using the VB Script:

  1. On the computer on which the SQL server hosting the WhatsUp database is installed, open the command prompt window, then go to the location where you copied the <WUG_Install_Folder>\DB Scripts directory. Navigate to the Upgrade Scripts directory inside it.

    Warning: The VB script must be executed locally on the SQL Server. If SQL Server is installed on another computer, attempting to run the VB script from the WhatsUp computer will cause the database upgrade to fail.

    Note: If running the VB script on a Windows Vista computer, be sure to run the command prompt with administrative privileges. For more information, see the Microsoft Command Prompt FAQ article.

  2. Execute the VB script using the following case-sensitive command:
    cscript upgrade_db.vbs -S "<sql_server_name>" -d "WhatsUp"
    Replace <sql_server_name> with the machine name or machine name and database instance name.

    For example:
    If you have a default instance of SQL installed on a computer named SQLBOX:
    cscript upgrade_db.vbs -S "SQLBOX" -d "WhatsUp"
    If you have a named instance of SQL installed on a computer named SQLSYSTEM and the instance name is WUG:
    cscript upgrade_db.vbs -S "SQLSYSTEM\WUG" -d "WhatsUp"
    For assistance in determining whether your SQL instance is a default or named instance, please contact your database administrator.

    Note: Arguments are case-sensitive (-d is not the same as -D).

    Tip: Optional: If you prefer to use SQL authentication to execute the VB script, you can use the -U and -P switches to provide an SQL user and that user's password.
    cscript upgrade_db.vbs -S "<sql_server_name>" -d "WhatsUp" -U "<sql_user_name>" -P "<sql_password>"
    Replace <sql_user_name> with the SQL username and <sql_password> with that user's password.
    For example:
    cscript upgrade_db.vbs -S "SQLSERVER" -d "WhatsUp" -U "sa" -P "WhatsUp_Gold"

    The VB script will execute the appropriate upgrade scripts, based on the existing WhatsUp Gold database schema. As each upgrade script is executed, a log file is created in the DB Scripts\Upgrade Scripts directory. If errors occur during the execution of an upgrade script, the corresponding log file for the script will be displayed in a Notepad window.

  3. After the database upgrade is complete, start the Ipswitch services (Ipswitch Web Server$WhatsUp and Ipswitch WhatsUp Engine) and run the WhatsUp Gold application normally. If you are running IIS as your web server, stop IIS, then restart it.

    Note: We recommend that you make a backup of your SQL database after the upgrade has completed. This will be useful for any disaster recovery mechanisms in place at your company.

To manually run the upgrade scripts:

The alternative to using the VB script is to manually execute the upgrade scripts using Query Analyzer (SQL 2000), SQL Management Studio (SQL 2005), or the SQL command-line utilities (osql.exe or sqlcmd.exe). If you need assistance using the management tools for SQL 2000 or SQL 2005, contact your database administrator or consult the online documentation for each tool.

Important: Be sure to run all of the queries, in the instructions below, against the WhatsUp database.

Using Query Analyzer (SQL 2000) and Management Studio (SQL 2005):

  1. Determine your current database version by executing the following query against the WhatsUp database. The value returned should be a six digit number.
    SELECT sValue FROM DatabaseProperty WHERE sName = N'Version'
  2. Using a text-editor of your choice, open the Transform.ini file located in the DB Scripts\Transforms directory. In the [VERSIONS] section, locate the version that matches the version of your database.
    For example, database version 110302 corresponds to transform version 39. Make a note of the transform version, which we will refer to as the "starting transform version."
  3. Find the [SCRIPTS] section in Transform.ini file. Make note of all the Transform entries which appear after your starting transform version.
    For example, if your starting transform version is 39, the first upgrade script you need to run is transform 40 (upgrade_from_110302_to_120001.sql) and the last is FinalUpgradeScript.sql.
  4. Open each upgrade script needed to complete your schema upgrade in a text editor of your choice. Replace every occurrence of the <DATAFILESPATH> variable with the absolute path to the DB Scripts directory. Some scripts may have several <DATAFILESPATH> variables that need replacement, some scripts may have none.

    Note: Be sure to exclude any trailing slashes from the directory path when replacing the text.

    For example, in an upgrade script, we see the following text:
    BULK INSERT WorkspaceReport FROM '<DATAFILESPATH>\WorkspaceReport.txt'

    If we copied the DB Scripts directory to a WUG directory at the root of the C drive on the SQL Server, we would change it to the following:
    BULK INSERT WorkspaceReport FROM 'C:\WUG\DB Scripts\WorkspaceReport.txt'

    Important: The path you replace the <DATAFILESPATH> variable with must be local to the SQL Server hosting the WhatsUp database. It must be a directory on a local drive, not a network share or mapped drive. If you are running Query Analyzer Management Studio from another computer, be sure to use the path that would be "seen" by the SQL Server, not your remote computer.

  5. Save each updated file.
  6. Run each upgrade script using Query Analyzer or Management Studio. The script should be run in the order specified in Transform.ini. Check for any errors or warnings returned by the SQL tool before continuing to the next upgrade script. If any script should fail, restore your database backup and repeat any previously successful upgrade scripts before attempting to run the failing script again.
  7. After the last upgrade script is complete, you may start the Ipswitch services (Ipswitch Web Server$WhatsUp and Ipswitch WhatsUp Engine) and run the WhatsUp Gold application normally. If you are running IIS as your web server, stop IIS, then restart it.

    Tip: Optional: We recommend making another backup of your SQL database once the upgrade has completed. This will be useful for any disaster recovery mechanisms in place at your company.

Using the osql utility (SQL 2000) and the sqlcmd utility (SQL 2005):

An alternative to using the Query Analyzer or Management Studio tools is using the SQL command-line tools to execute the upgrade scripts. If your database is SQL 2000, use the osql utility. If you are running SQL 2005, you should use the sqlcmd utility. For more information, see the Microsoft web site for information about the osql utility and the sqlcmd utility.

Each utility needs connection and authentication information specific to your environment in order to connect to the WhatsUp database and issue queries and schema updates. Your specific connection and authentication information may vary from the examples below. Contact your database administrator for information about using these command-line utilities. These examples assume that that Windows user running the utility has administrative access to the DB, and that the SQL Server is a default instance on a computer named SQLSYSTEM.

  1. Determine your current database version by executing the following case-sensitive query against the WhatsUp database. The value returned should be a six digit number.
    SQL 2000 (osql):
    osql -E -S "SQLSYSTEM" -d "WhatsUp" -Q "SET NOCOUNT ON SELECT sValue FROM DatabaseProperty WHERE sName = N'Version'"
    SQL 2005 (sqlcmd):
    sqlcmd -E -S "SQLSYSTEM" -d "WhatsUp" -Q "SET NOCOUNT ON SELECT sValue FROM DatabaseProperty WHERE sName = N'Version'"

    Note: Arguments are case-sensitive (-d is not the same as -D).

  2. Using a text-editor of your choice, open the Transform.ini file located in the DB Scripts\Transforms directory. In the [VERSIONS] section, locate the version that matches the version of your database. For example, database version 110302 corresponds to transform version 39. Make a note of the transform version, which we will refer to as the "starting transform version."
  3. Find the [SCRIPTS] section in Transform.ini. Make note of all the Transform entries which appear after your starting transform version. For example, if your starting transform version is 39, the first upgrade script you'll need to run is transform 40 (upgrade_from_110302_to_120001.sql) and the last is FinalUpgradeScript.sql.
  4. Open each upgrade script needed to complete your schema upgrade in a text-editor of your choice. Replace every occurrence of the <DATAFILESPATH> variable with the absolute path to the DB Scripts directory. Some scripts may have several that need replacement, some may have none. Be sure to exclude any trailing slashes from the directory path when replacing the text.
    For example, in an upgrade script, we see the below text:

    BULK INSERT WorkspaceReport FROM
    '<DATAFILESPATH>\WorkspaceReport.txt'


    If we copied the DB Scripts directory to a WUG directory at the root of the C drive on the SQL Server, we would change it to the following:

    BULK INSERT WorkspaceReport FROM 'C:\WUG\DB
    Scripts\WorkspaceReport.txt'

    Note: The path you replace <DATAFILESPATH> variable with must be local to the SQL Server hosting the WhatsUp database. It must be a directory on a local drive, not a network share or mapped drive. If you are running the command-line tools from another computer, be sure to use the path that would be "seen" by the SQL Server, not your remote computer.

  5. Save each updated file.
  6. Run each upgrade script using the appropriate command-line tool. The script should be run in the order specified in Transform.ini. Check for any errors or warnings returned by the SQL tool before continuing to the next upgrade script. If any script fails, restore your database backup and repeat any previously successful upgrade scripts before attempting to run the failing script again.
    SQL 2000 (osql):
    osql -E -S "<sql_server_name>" -d "WhatsUp" -i
    "<upgrade_script_name.sql>"

    SQL 2005 (sqlcmd):
    sqlcmd -E -S "<sql_server_name>" -d "WhatsUp" -i
    "<upgrade_script_name.sql>"


    For example:
    SQL 2000 (osql):
    osql -E -S "SQLSYSTEM" -d "WhatsUp" -i
    "upgrade_from_110302_to_120001.sql"
    SQL 2005 (sqlcmd):
    sqlcmd -E -S "SQLSYSTEM" -d "WhatsUp" -i
    "upgrade_from_110302_to_120001.sql"

    Tip: Optional: You can specify to create a log file for each upgrade script using the -o switch and by specifying a filename. We recommend creating a separate log file for each upgrade script. For example:
    sqlcmd -E -S "SQLSYSTEM" -d "WhatsUp" -i "upgrade_from_110302_to_120001.sql" -o "upgrade_from_110302_to_120001.log"

  7. After the last upgrade script is complete, you may start the Ipswitch services (Ipswitch Web Server$WhatsUp and Ipswitch WhatsUp Engine) and run the WhatsUp Gold application. If you are running IIS as your web server, stop IIS, then restart it.

    Note: We recommend that you make a backup of your SQL database after the upgrade has completed. This will be useful for any disaster recovery mechanisms in place at your company.