Engineering Tip

NOTE: This technique is not supported by USDATA, always backup all data files before using this technique!

Most applications are modified after being used in a production environment.  When additional items need to be logged for trending or browsing, the structure of the database table changes requiring the historian to regenerate the file with the new schema.  The suggested technique is to delete all files in the directory where the data is being logged and restart the system.  If you are using this same directory for alarms or other logs, you will lose that archived data.

Although this technique does not preserve the data in the table in which structure has been changed, it does allow for the new table to be re-created without deleting all of the other files in the directory.

CAUTION: copy the directory contents to a safe place before attempting this technique!!!

The DB4 Historian creates a set of files called: sys_file.cdb and sys_file.mdx. These files contain the files and relationships contained in the directory being managed by the DB4HIST task. Remember that the table names specified in the dblogger become the file names found in the directory specified in the db4hist tables.

What we need to do is to remove the file/table with the new structure from this database so that the historian can re-create it with the new schema (just deleting the file and index won't work and will mess up the system).

  1. Open a DOS window (command prompt window)
  2. Change to the directory where the table (file.cdb) is found
  3. Run bh_sql
  4. List tables (to check that your table is in the list)
  5. Drop table table_name (where table_name is the name of the file/table)
  6. Quit

This series of commands will both delete the file and indexes as well as remove the table name from the sys_file.cdb. When you restart the FactoryLink system and the first log event occurs, the file will be re-created with the new schema and the other files will be unaffected.