To gather statistics

The database driver provides an option to gather driver-wide statistics on actions performed, such as:

  • Number of cursors:
    • Opened.
    • Closed.
    • Current open.
  • Number of parses, binds, executes, and fetches.
  • Number of logons: Sessions.
  • Number of inserts, updates, and deletes.
  • Number of commits and rollbacks.

For each action, the cumulative elapsed time spent and the average time is logged. You can enable the statistics with the environment variable ORASTAT. If you set the variable to zero, when the driver terminates, a statistics report is generated; in other words, it exits from LN Tools or the session. If a value n greater than zero is specified, the driver logs an incremental report every n seconds (the driver must be active). The statistics report is written to the file ORASTAT in the current directory.

These examples show how you can set ORASTAT:

SET ORASTAT=0
SET ORASTAT=30

In the first example, ORASTAT is set to zero; with this value, only a final report is generated. In the second example, ORASTAT is set to 30, which logs a report every 30 seconds while the driver is active.

The following is a sample output of ORASTAT. Because the report is generic for all databases, some information, such as the specific row actions, might not be appropriate for a particular database driver.

<3472> 2009-06-23[16:36:47]: Statistics [interval = 300]

DB-Cursor    Open     Close     Parse      Bind    Define   Execute     Fetch     Break
Count           7         7         7         7        13         9         5         5
Time(s)    0.0001    0.0001    0.0003    0.0001    0.0002    0.0100    0.0037    0.0000
Avg        0.0000    0.0000    0.0000    0.0000    0.0000    0.0011    0.0007    0.0000

Retained        #    Reused         %  Reparsed         %    Detach
Count           0         0       0.0         0       0.0         0

           BlobRd   BlobApp    BlobSz   BlobClr
Count          60        59        61         1
Time(s)    0.0198    0.3063    0.0085    0.0008
Avg        0.0003    0.0052    0.0001    0.0008

3/4GL       CrIdx     DrIdx     CrTbl     ClTbl     DrTbl     LkTbl     NrRow
Count           0         0         0         0         0         0         0
Time(s)    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
Avg        0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000

            Logon    Logoff    Commit  Rollback  ReadOnly
Count           1         1         1         1         0
Time(s)    0.0069    0.0014    0.0051    0.0723    0.0000
Avg        0.0069    0.0014    0.0051    0.0723    0.0000