The Before Image is logically organized in clusters. Theses clusters get re-used as soon as all transaction notes in them are not relevant anymore. Large and/or long running transactions are causing the Before Image to grow because a lot of clusters can not be re-used until these transactions are either committed or rolled back.
Therefore the only way to know the utilization of the Before Image is to know the number of Before Image clusters that are actually in use. The file size is not that relevant as long as you don't blow the file system.
The smallest value in the _Trans._Trans-Counter will give us the oldest Before Image cluster in use.
Now it gets tricky: In order to get the newest cluster you need to start a transaction and find the _Trans record associated with your connection. For this you could use a code like this
Code:
for first _MyConnection no-lock,
first _Trans no-lock where _Trans._Trans-UsrNum = _MyConnection._MyConn-UserId:
/* Your Stuff : _Trans._Trans-Counter holds the number of the BI cluster */
end.
As soon as you know the oldest and the newest Berfore Image cluster you know the number of actual clusters in use. The you just need to calculate that with you Before Image cluster size and you know the actual size/utilization of the Before Image. From that you can compare it with historical data, the actual file size or your Before Image threshold to know whether you are in trouble or not.
Heavy Regards, RealHeavyDude.