Salesforce

Using PROUTIL HOLDER to determine if a database is in use.

« Go Back

Information

 
TitleUsing PROUTIL HOLDER to determine if a database is in use.
URL NameP43261
Article Number000142120
EnvironmentProduct: Progress
Version: 8.x, 9.x
Product: OpenEdge
OS: All supported platforms
Question/Problem Description
Using PROUTIL HOLDER to determine if a database is in use.
How to find out if a database is in use with PROUTIL HOLDER?
What is the PROUTIL HOLDER qualifier?
Is this database running in single or multi-user mode ?
How to check if a database is running?
Sample program that shows how to check a return code for PROUTIL HOLDER?
 
Steps to Reproduce
Clarifying Information
Error Message
Defect Number
Enhancement Number
Cause
Resolution
The PROUTIL HOLDER qualifier determines whether the database currently in use is in single-user mode, multi-user mode, or in use by a Progress utility. This information is useful for example before performing a database backup or shutting down a database.
 
Once the PROUTIL HOLDER qualifier completes, it returns a different return code depending the content of the database .lk file which can be captured in a UNIX script, WINDOWS batch file or ABL code, to determine the status of the database. 
 
SYNTAX:  proutil <dbname> -C holder
 
Where:
dbname specifies the name of the database being queried.
 
Return Codes for PROUTIL HOLDER qualifier:
 
0   Database not in use.
14 Database locked by single user, PROUTIL, or RFUTIL.
16 Database open in multi-user mode.
Any other nonzero return code indicates that an error has occurred.
 
Return codes can be added or changed from one release to the next. Use scripts that depend on a specific return codes with caution.
 
Example 1: Accessing the return codes of the HOLDER qualifier from a UNIX script:
 
proutil dbname -C holder
retcode=$? # this saves the return code
case $retcode in
0) echo "The database is not in use"
;;
14) echo "The database is in single-user mode"
exit $retcode
;;
16) echo "The database is busy in multi-user mode"
exit $retcode
;;
*) echo "proutil -C holder failed"
echo error code = $retcode
exit $retcode
;;
esac # case $retcode in
Example 2:   Accessing the return codes of the HOLDER qualifier from a Windows batch file

1. Save the following batch file as "DBHolder.bat"
@echo off
_proutil <path>\dbname -C holder
if errorlevel 16 goto multiuser
if errorlevel 14 goto singleuser
if errorlevel 0 goto notinuse
goto end

:multiuser
echo Database is open in multi-user mode
goto end

:singleuser
echo Database is locked by single user, PROUTIL, or RFUTIL
goto end

:notinuse
echo Database is not in use
goto end

:end

2. Start a PROENV cmd shell (so that the relevant DLC and PATH environment variables are correctly set) then run the batch script:

proenv> DBHolder.bat
 

Example 3: Accessing the return codes of the HOLDER qualifier from a 4GL procedure:

1. Save the following batch file as "DBStatus.bat".
@echo off
_proutil <path>\<dbname> -C holder
echo %errorlevel% > TempFilename.txt

2. Save the following ABL procedure
 
DEFINE VARIABLE cTempFilename AS CHARACTER NO-UNDO.
DEFINE VARIABLE cOutputLine AS CHARACTER NO-UNDO.
DEFINE VARIABLE cExecutableCommand AS CHARACTER NO-UNDO.

ASSIGN
   cExecutableCommand  = "DBStatus.bat"
   cTempFilename  = "TempFilename.txt".
    
OS-COMMAND SILENT VALUE(cExecutableCommand).
INPUT FROM VALUE( cTempFilename ) NO-ECHO.
IMPORT UNFORMATTED cOutputLine.
IF cOutputLine = "16" THEN
   MESSAGE "Database is open in multi-user mode"
      VIEW-AS ALERT-BOX INFO BUTTONS OK.
IF cOutputLine = "14" THEN
   MESSAGE "Database is locked by single user, PROUTIL, or RFUTIL"
      VIEW-AS ALERT-BOX INFO BUTTONS OK.
IF cOutputLine = "0" THEN
   MESSAGE "Database is not in use"
      VIEW-AS ALERT-BOX INFO BUTTONS OK.

/* NOTE:  Make sure that %DLC%\bin is in the Progress Session's PROPATH. */
Workaround
Notes
Keyword Phrase
Last Modified Date11/20/2020 7:35 AM

Powered by