Table of contents:

The following programs are used to connect to a Hades database:

  • tcl_to_ora


To simplify the procedure of inserting the information into the Hades database a perl script was written. It comes with oper CVS repository. The script reads a text file eb_runinfo2ora.txt (created by EB) with necessary information which is then inserted by into the corresponding table in the database. The program keeps track of the inserted lines. However, in case of the death of the script, can be run again on the existing eb_runinfo2ora.txt, because the RUN_ID is a unique constraint in the database and all the lines with the same RUN_ID can not be inserted/updated second time (they will be skipped by the database itself and you will see corresponding error message).



revision date comment
1.1 2007-10-04 works only with one EB. Supports the old format with only one EB
1.2 2008-08-01 works with multiple EBs. Supports new format

Installation guide requires Oracle client and Perl modules DBI and DBD/ To be able to install this module from CPAN, an install oracle client is needed.
  • The old installations of the Oracle client are here: /data/system/usr/local/oracle and here: /opt/oracle. The old installations had a bug: if an uptime of the machine acceeds some 60 days the Oracle client fails to connect to the server. The new bug-free installation is here: /home/hadaq/hadessoftware/oracle/product/
  • Proper Oracle settings:
    • export ORACLE_HOME=/home/hadaq/hadessoftware/oracle/product/
    • ORACLE_SID=orcl
    • export ORAENV_ASK="NO"
    • export PATH=$ORACLE_HOME/bin:$PATH
  • compile/install DBD::Oracle (with the force option) if missing
    • perl -MCPAN -e shell
    • force install DBD::Oracle
  • check connection to the server: sqlplus daq_pub/hades@db-hades
  • run script: nohup ./ &

-- SergeyYurevich - 01 Aug 2008


Here is how to run the program that puts all the runs to the oracle database nearly on-line. The program is called tcl_to_ora and unfortunately it is not really straight forward to run it as

  • it depends on the state of the database
  • deals with data coming via a pipe to stdin
  • uses an additional program to transform the input
  • needs a defined starting point for operation from the file point of view

Basically, the program reads a tcl-file produced by the eventbuilder (currently /home/hadaq/aug04/oper/eb_s.tcl), follows it's progress and dumps every line to Oracle. Frequently check if it is running by

ssh hadeb02

$ ps -fuhadaq | grep tcl_to_ora

if it is not running, You have to check from which point on it crashed (see which was the last run entered to oracle).

The Table contains all runs (even those not written to file and thus not appearing in the logbook). Check whether a file closing has not correctly written to Oracle (run_stop is (null)) or the run_id has not been set correctly (run_id is (null)). Fix that by pure SQL (or ask an expert for that), then cut the part of the file away, that was already been written to Oracle (probably to a file called "eb_s.tcl_<username>_<date>)". Now You should stop the eventbuilder process, take the rest and put it to Oracle by

$ cat eb_s.tcl | tcl_to_ora -s hades -e 's/^set [^(]*daq_evtbuild/set eb1pp/g;s/^set [^(]*daq_netmem/set eb1gp/g'

then also move this file away, touch a new eb_s.tcl:

$ touch eb_s.tcl

finally restart tracing the file in background by

nohup sh -c "tail -f eb_s.tcl | tcl_to_ora -s hades -p -e 's/^set [^(]*daq_evtbuild/set eb1pp/g; s/^set [^(]*daq_netmem/set ebgp/g'"

Finally, You can start the eventbuilder process again and check if the new runs appear in Oracle.

Just to give a hint about what is going on in these two lines: tcl_to_ora reads some tcl-script from stdin, which in turn should consist of entries of the type

set name(idx) value

where name is the name of a process, e.g. the eventbuild process, idx is the name of the variable to be written, value the value of the variable.

name has to be transformed to be "eb1pp" in case of the evtbuild process and "eb1gp" in case of the netmem process, and therefore stdin can first be filtered by some sed-script supplied with the "-e" option. "-s hades" gives the setup to be consulted to receive additional information like "which beamtime", which "running process", etc.

this process should run permanently while there will be an <EOF> after every open() / close()-sequence on the file eb_p.tcl. Not stopping in case of an <EOF> is caused by the tcl_to_ora-option "-p". So tail -f follows the growing eb_s.tcl and puts it to stdout. nohup sh -c "..." & opens a shell which will not receive any signal in case of the parent process (the interactive shell) dies, so this process of putting tcl-information to the database keeps running even if you close the terminal.

In case the beamtime changes, to have correct entries to the database, you have to set the current beamtime for the setup correctly. This can be done by experts directly in the database (TABLE daq.active_experiment), or by the out-of-date gui of the intermediate runctrl (run_manager).

Similar techniques apply to other information like the active operator (TABLE daq.active_operator).

Other useful information about the current state (e.g. in case of a crash of tcl_to_ora) can be found in TABLE daq.active_run and TABLE

Date: Tue, 1 Feb 2005 23:14:43 +0100 (CET) From: Benjamin Sailer <> To: Michael Traxler <> Cc: Martin Jurkovic <> Subject: Oracle on lxhadesdaq

Hallo zusammen,

hab's kompiliert, der Grund fuer den Fehler war lediglich, dass der Oracle-Praeprozessor nur arbeiten mag, wenn das Oracle-Enviroment komplett gesetzt ist (zu machen mit $ . oraenv , wobei oraenv in /usr/local/bin liegt).

Damit hat dann auch tcl_to_ora kompiliert. Ich habe beides (libOraParam* und tcl_to_ora) nach /usr/local gesteckt, Du kannst es aber natuerlich dort wieder wegwerfen, wenn die Konvention eher ist, dass es in /home/hadaq/aug04 landen soll, der Eindruck ist bei mir beim "make install" entstanden ( vom Mathias???).

Gruss und viel Erfolg


-- BenjaminSailer - Compilation from 27 Aug 2004 to 01 Feb 2005
Topic revision: r7 - 12 Dec 2009, JanMichel
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Hades Wiki? Send feedback
Imprint (in German)
Privacy Policy (in German)