DATABASE MAINTENANCE

Most of the long-term information stored in WebSite Director (WSD) is kept in an SQL (Structured Query Language) database on the web server, or on a server connected by a LAN to the web server. WSD currently supports the following databases:

  • MySQL for both UNIX and Windows platforms - MySQL was designed as a low-overhead, lightweight database engine that is well suited for running on web servers, where the top priority is usually serving web pages, not accessing a database.

  • MiniSQL (usually referred to as "mSQL") for both UNIX and Windows platforms - Historically, mSQL was often the *only* database engine available in many ISP environments, so support for mSQL is a critical part of the WSD database design.

  • ODBC on Windows and UNIX - Supporting ODBC for Windows and UNIX provides WSD with access to, and use of, a wide range of SQL databases.

Although WSD will support other database engines in future releases, it is designed to remain compatible with the smaller subset of SQL that is supported by MySQL, mSQL, and the "lowest common denominator" subset supported by ODBC compatible database engines.

Exporting and Importing to and from the WSD Database

WSD provides utility functions for exporting the contents of a WSD database into a text file that can be used to easily import the same data into the same or a different WSD database.  To dump the entire WSD database, issue the following command from the command line in the WSD installation directory: 
        wsdutils export <export-filename>

where "export-filename" is the name of the text file to use for storing the WSD database record information.  To import the contents of such an exported file into the WSD database, issue the following command:

wsdutils import <import-filename>

where "import-filename" is the name of the text file containing the WSD database record information.  Warning: importing database records generated by the "wsdutils export" command into the WSD database will overwrite any data already in that database.  

Migrating WSD installations between two Servers

The following instructions describe the process of moving an entire WSD installation from one location (SOURCE) to another location (TARGET) on either the same server or on a different server. These instructions, when followed, will result in the TARGET system containing all of the site content, templates, version files, and SQL data base contents stored in the SOURCE system.

These instructions assume that the person moving the installation is familiar with the operating environment of both SOURCE and TARGET systems and the server commands required to accomplish the tasks described herein.

  1. If the TARGET server does NOT have WSD already installed, you must first install WSD on the TARGET server.
  2. From within the WSD TARGET System Installation Directory (TID):
    1. Record the name/location of the TID for later use in completing the rest of these instructions
    2. Remove all files from within the directory named "requests" located directly under the TID
    3. Remove all files from within the directory named "versions" located directly under the TID
    4. Remove all directories and files from within the directory named "templates" located directly under the TID.
    5. Remove all web site content located under the document root.
  3. From within the WSD SOURCE System Installation Directory (SID):
    1. Record the name/location of the SID for later use in completing the rest of these instructions
    2. Export the SQL database contents into a file, for import into the TARGET SQL data base using the following command: "wsdutils export wsd.import"
    3. If the SOURCE server file system can not be accessed from the TARGET Server, copy the following files/directories located within/under the SID onto a form of removable media for transport to the TARGET server location:
      • File: "wsd.import" (created in item 3b above)
      • The directory named "requests" and all its files
      • The directory named "versions" and all its files
      • The directory name "templates" and all of its sub-directories and files
      • All of the web site content (including sub-directories) located under the Document Root (e.g. the "htdocs" directory and all of its children)
  4. From the new server location’s TID you must copy the following sub-directories and files from either the SID or from the removable media created in step 3c above:
    1. All of the files from the "requests" sub-directory under the SID
    2. All of the files from the "versions" sub-directory under the SID
    3. All of the sub-directories and files from the "templates" sub-directory under the SID
    4. All of the sub-directories and files from the web site Document Root under the SID
    5. The file "wsd.import" (created in item 3b above)
  5. Import the SID SQL data base contents from the file named "wsd.import" copied during step 4e above, using the following command: "wsdutils import wsd.import"

Making Interactive Queries to the WSD Database

MySQL and mSQL are distributed with utilities that can be used to interactively query a database. These utilities, respectively called "mysql" and "msql" can also be used to reload database content from an input file, including files generated by either the "mysqldump" or "msqldump" command. To use these utilities, issue one of the following commands: 
        mysql <database-name> OR
        msql <database-name>
where "database-name" is the name of your WSD database. For detailed instructions on using these interactive query utilities, refer to the MySQL or mSQL documentation.    

Using the WSD SQL Journal File

WSD has the option, set during installation, of maintaining a journal file of all SQL update commands issued against the WSD database. This journal file can be used to recover a WSD database completely even if the database files themselves are corrupted and have to be restored from an older backup. 

The WSD SQL Journal file consists of one line for each SQL update command, which includes a date and time stamp of when the update occurred. The journal file can be used as an input file to the WSD import database utility function, but may only be used after removing the date and time stamps from each line. 

If you need to restore part or all of a WSD database from the SQL Journal file, you first need to decide which SQL updates to restore from the journal file. If you were able to recover a backup of the database files, you will want to reload the journal file from the date and time immediately following the time the backup was taken. 

You can use a WSD utility function to extract the desired lines from the SQL Journal file with the following command:

wsdutils extract <extract-filename>

where "extract-filename" is the file to put the extracted SQL queries in.  The wsdutils module will prompt for a starting timestamp and an ending timestamp.  You can enter an empty value for either to start at the beginning and end at the end of the SQL journal file, respectively.  If you enter a timestamp value, it needs to be in the same format as the timestamp at the beginning of every line of the SQL Journal file.  The timestamps will be removed from the extracted lines.  The extracted queries can then be loaded into the WSD database using the following command:

wsdutils import <extract-filename>

Copyright 2000-2005 CyberTeams, Inc., http://www.cyberteams.com All rights reserved.
CyberTeams and WebSite Director are registered trademarks of CyberTeams, Inc. All other marks are the property of their respective owners.