PROUTIL -C HOLDER or PROUTIL -C BUSY will still show that the database is in use when the database is not shutdown properly prior to reboot, or after a power failure, since
the database .lk file is still present (even if it dates prior to the reboot).
There's a difference between the .lk file checks when a process tries to open the database and the
PROUTIL -C holder or
PROUTIL -C busy qualifiers that simply check for the .lk file's existence and content - these do not access the database.
The database .lk file contains three pieces of information:
- The mode in which the database was started. (which is what the PROUTIL utilities are reporting on)
- The process id (pid) of the process that started the database.
- The hostname where the process that started it is running.
The database .lk file contains validation information about the broker during the current session, and will clear it out at the database normal shutdown time. This is why If a power outage or reboot occurs while the Database was running, the PROUTIL -C holder/busy qualifiers report wrong information as they don't have the required knowledge to reconise that the Database has crashed and will return incorrectly that the database is running in multi-user mode, since that was the last 'content' of the .lk file.
While server outage is unavoidable at times, a reboot is manageable and the process should be reviewed in terms of shutting down the AdminServer (if in use) and databases prior to issuing the reboot.
In the database startup scripts (_mprosrv or proadsv + dbman), instead of using/relying on proutil -C holder/busy, within the same database startup script delete the .lk file and utility/broker will work normally.
- Check if the uptime is less than 90 seconds, (ensuring that the system has rebooted recently)
- If true, delete the .lk file first
- and then/else:
- Truncate of the BI to ensure that the shared memory segment ids stored in the master block are cleared up
- Optionally run proutil -C BIGROW
- Start the database.
EXAMPLE (LINUX)
UPTIME=`cat /proc/uptime | cut -d " " -f 1| cut -d . -f1`
# check for stale lk-Files resulting from a crash and delete them if uptime < 90seconds
if [ "$UPTIME" -le "90" ]; then
echo "Uptime less than 90 seconds, system rebooted recently, no DBs can be running yet. Deleting db.lk files."
find /db/ -type f -name "*.lk" -exec rm -f {} \;
else
echo "Uptime above 90 sec, continue to start databases."
fi
# done
# Truncate bi: proutil dbname -C truncate bi
# Grow bi file: proutil dbname -C bigrow 13
# Start database: _mprosrv dbname -pf dbname.pf