Product Documentation

Database Administrator's Guide

Previous Topic

Next Topic

File and User Lock -filelocks

Retrieve lock information by file or by user.

Note: Dumping large quantities of locks in a very active system could affect performance.

Filelocks

For the -filelocks report:

  • -filelocks file [N] lists all locks on a data file. Displays the Nth key. Keys are displayed in hexadecimal format following each lock.

Example

>ctstat -filelocks custmast.dat -u ADMIN -p ADMIN -s FAIRCOMS -i 1 1

The -filelocks option lists all locks on a data file and, optionally, displays the Nth key. The lock offset and the associated keys are not read at the same time. Because the records used to generate the key are locked by other users, there is no guaranteed relationship between the lock and the displayed key. The following are possible scenarios:

  1. The displayed key is from before or after any changes made by the lock holder.
  2. The locked offset no longer holds a valid record (it has been deleted, or updated and moved).
  3. The locked offset could have been locked/modified/unlocked more than once between the time the lock offset was acquired and the time the record is read, so the offset could hold an entirely different record than what was originally locked.

Userlocks

For the -userlocks report:

  • If UserID is a number, it is interpreted as a task ID.
  • If UserID is a string, it is interpreted as a name, and information on locks held by each task ID with a matching name is returned.

Example

To identify all locks and associated files held by Task ID 23

>ctstat -userlocks 23 -u ADMIN -p ADMIN -s FAIRCOMS -i 1 1

./cxd01.dat

---

./cxd03.dat

---

./cxd05.dat

---

./cxd23.dat

0x0000000000004dd1 Write 25 0 ADMIN


To identify all locks and associated files held by user SALLY

>ctstat -userlocks SALLY -u ADMIN -p ADMIN -s FAIRCOMS -i 1 1

./cxd01.dat

0x00000000000055e5 Write 21 0 ADMIN

./cxd04.dat

0x0000000000004dd1 Write 25 0 ADMIN

./cxd10.dat

0x0000000000004dd1 Write 24 0 ADMIN

Because the -userlocks report may generate a large number of server calls (for each task ID and file), the -userlocks report interval may be increased up to 60 seconds, depending on the number of matching users and files involved.

TOCIndex