findrecordlocks.pl

Use the findrecordlocks.pl Perl script from the command line to find record locks and set timeout locks.

HCL Compass provides the following ways to find locks, report abandoned locks, and remove abandoned locks:
  • Report locked records only.
  • Monitor locked records in an interval time.
  • Report abandoned locks.
  • Unlock abandoned locks.

This script is installed in the default product installation directory.

Synopsis

cqperl findrecordlocks.pl [–help ] | [–dbsetdatabase-set ] [–database user_database ] compass_login compass_password {record_type_list | –all} [–unlock] [–scan interval ] [–timeout interval ] [–timestimes] [–loglevel error | info | verbose]

Options and Arguments

–help
Displays a list of the command options and a brief description of each option.
-dbset database-set
Optional. Name of the database set that contains the database to search for locked records. The default dbset is used if this option is not provided.
-database
Optional/Required. The user database to scan. This option is required if there is more than one user database in the dbset.
compass_login
Required. Compass user login name.
compass_password
Required. Compass user password.
record_type_list
Optional. A list of record types to be checked for locks. Each record type name can be separated by space or comma.
-all
Optional. Check all record types in the schema.
-unlock
Optional. Automatically release abandoned locks when found. An abandoned lock is one that has been held longer than the value given by the -timeout option. This option requires that the login user have superuser privileges. Otherwise, only locks held by the login user are removed.
-scan
Optional. The interval to check for locks. The value is in seconds.
-timeout
Optional. The time a lock may be held before it is considered to be abandoned. The value is in seconds. The default value is 3600 seconds (1 hour).
-times
Optional. The number of times to scan; default is unlimited.
-loglevel
Optional. Specify what level of message should be printed out on the standard output. Accepted values are "error", "info", or "verbose", which provide progressively more information. The default is "verbose".

Examples

  • Report Compass dbset locked records in Defect record type:
    cqperl findrecordlocks.pl -dbset RecordLocking admin "" Defect   
  • Monitor Compass dbset locked records every 7200 seconds (2 hours) in the user database udb and scan a total of 12 times:
     cqperl findrecordlocks.pl -dbset RecordLocking admin "" Defect -scan 7200 -database udb -times 12  
  • Report abandoned locks for the Defect and Requirement record types every 2 hours using 5 hours as the timeout interval:
    cqperl findrecordlocks.pl -dbset RecordLocking admin "" Defect,Requirement -scan 7200 -timeout 18000 -loglevel info
  • Unlock Mode: Look for record locks in all record types every 2 hours and remove locks held longer than 5 hours:
    cqperl findrecordlocks.pl -dbset RecordLocking admin "" -all -unlock -scan 7200 -timeout 18000 -loglevel verbose