TechTalk – FactoryLink : Database Troubleshooting

You look at Run-Time Manager and see it has a red background button what used to be green (which meant good task in Run-Time Manager). Next to it, there are some cryptic message from the Run-Time Manager saying “Historian SQL error: EXEC(17,-1)”. Ok now what is that?

Well have no fear. I have consolidated guidelines of where you can look at to determine what the error could possibly be. Here we go!

1) Historian Log File
FactoryLink historians outputs the error code(s) and message(s) when the historian experience some abnormal state to the Task Status tags and database log file. The between tags and log file is that the Task Status tags get updated with numerical value which denotes the error type. Hence, a look up table is required to decipher error message(s). The look up table is defined in the next section of this article. On the other hand, the database log file has a longer, more descriptive message that tells you what went wrong.

You can set two types of files to record Historian operations; a Historian log file and a Historian trace file. These two files will best help you troubleshoot what might be incorrect in your FactoryLink application. Historian log files are accessible on disk for seven days. After seven days, old log files are deleted. At the start of each new day, the previous day log file closes and a new one opens.

Log files reside in the following directory.

FLAPP/FLNAME/shared/FLUSER/log

The name of a log file adheres to the following format.

PRMMDDYY.log

where “PR” identifies the historian type as shown in the table below.

Historian Type PR Prefix Log file Sample Name
DB IV d4 d4111617.log
ODBC od od111617.log
Oracle oh oh111617.log
Sybase sy sy111617.log

Entries continue to append to each .log file. Consequently, these files can grow and take up large amounts of disk space. Delete the file contents or the file itself. Remove the Program Arguments on the System Configuration Information panel to stop logging for a Historian.

 

2) Error Messages In Log File – EXPLAINED!
Ok! You got your log file and see there are a bunch of error…. what does it mean. Table below explains just that.

The table below show list of possible errors that can appear in the log file during startup of the historian.

Log File Error Message Cause Action
Bad CT record size in CT archive filename The archive file *HIST.CT is corrupt. Delete the archive file *HIST.CT. Restart the application to rebuild the archive file.
Bad CT type in CT archive filename The archive file *HIST.CT is corrupt. Delete the archive file *HIST.CT. Restart the application to rebuild the archive file.
Bad hist. mailbox in CT archive filename The file *HIST.CT contains an invalid element name for a mailbox
element.
Open the Configuration Manager Main Menu and choose the appropriate Historian. Delete the invalid element name from the Historian Mailbox Information panel and enter a valid element name.
Can’t open CT archive filename Either the archive file *HIST.CT does not exist or is corrupt. Delete it if the file exists. Restart the application to rebuild the archive file.
Can’t open .LOG file The Database Logging task can not open a .LOG file. Ensure the FLAPP/LOG directory exists.
Can’t read record in CT archive filename The archive file *HIST.CT is corrupt. Delete the archive file *HIST.CT. Restart the application to rebuild the archive file.
Duplicate mailboxes in CT archive filename The Historian Mailbox Information panel contains duplicate mailbox elements. Open the Configuration Manager Main Menu and choose the appropriate Historian. Delete the duplicate entry in the Historian Mailbox Information panel.
Invalid # number of CT types in CT archive name The archive file *HIST.CT is corrupt. Delete the archive file *HIST.CT. Restart the application to rebuild the archive file.
No CTs in CT archive filename The Historian Table is not configured. Open the Configuration Manager Main Menu, choose Historian, and complete the Historian table.
No dbases defined in CT archive filename The Historian Information panel is not configured. Open the Configuration Manager Main Menu, choose the appropriate Historian, and complete the Historian Information panel.
No mailboxes in CT archive filename The Historian Mailbox Information panel is not configured. Open the Configuration Manager Main Menu, choose the appropriate Historian, and complete the Historian Mailbox Information panel.
Out of RAM Not enough RAM to run this task. Restart the task. If it fails again, allocate more RAM for this task or install more RAM.
SQLERROR: Can’t function for task task_name due to error: error An SQL error occurred during the execution of an SQL statement for a FactoryLink task. This error may originate with that FactoryLink task or with the Historian task. Refer to the user manual for the database in use for instructions for correcting this error.
SQLERROR: Can’t function serial id with SQL statement: sql_statement for task task_name due to error: error An SQL error occurred during the execution of an SQL statement for a FactoryLink task. This error may originate with that FactoryLink task or with the Historian task. Refer to the user manual for the database in use for instructions for correcting this error.

 

The table below explains error messages written to a Historian .log file in general.

Log File Error Message Cause Action
SQLERROR: Can’t sql_function SQL statement sql_statement for task task_name due to error: error An SQL error occurred during the execution of an SQL statement for a FactoryLink task. This error may originate with that FactoryLink task or with the Historian task. Refer to the documentation for the database in use for instructions for correcting this error.
SQLERROR: Can’t function unique index: unique_index for task task_name due to error: error An SQL error occurred during the execution of an SQL statement for a FactoryLink task. This error may originate with that FactoryLink task or with the Historian task. Refer to the documentation for the database in use for instructions for correcting this error.
Task initialization failed The Historian task is installed incorrectly. Reinstall FactoryLink.

 

3) Run-Time Manager Error Message
Historian errors and messages will be displayed as your FactoryLink application run in the Run-Time Manager. The FactoryLink Historian sends a code or message to the Run-Time Manager screen for display whenever an error occurs in a Historian or a Historian-client task.

FactoryLink also sends a longer, more descriptive message to the log file (location of the log file is outline in part above) when the log file Program Argument is set. This part describes the error codes and messages displayed on the Run-Time Manager screen.

Alternatively, the Task Status tag can be used to acquire the error code which is located on the System Configuration Information panel. The data type you assign to this tag for a historian and any FactoryLink task determines the type of codes written to this tag.
The data types you can assign are

Digital data type reports these two codes.
0 (zero) indicates the requested operation successfully completed
1 (one) indicates an error occurred

  • Analog, longana, or float data type
    A FactoryLink historian generates the message or status codes shown in the table below. The table below is directly from the FactoryLink 7.0 Task Configuration Reference Guide.

 

Xybernetics FactoryLink : Database Troubleshooting

 

Additional Notes

  • DBBROWSE task performs SQL “SELECT” request, while DBLOG task performs an “INSERT” which will result in selected record being over written by (if it was the oldest record).

 

Reference