onstat -g opn 命令:打印打开的分区

可以使用 onstat -g opn 命令显示通过线程 ID 打印系统中当前打开的分区(表和索引)的列表。

使用 thread_id 选项来限制指定 ID 的列表。

语法:

示例输出

图: onstat -g opn 命令输出

            tid  rstcb              isfd  op_mode    op_flags   partnum    ucount ocount lockmode
            38   0x00000000460db7b0 0     0x00000400 0x00000397 0x001000af 2      2      0
            38   0x00000000460db7b0 1     0x00000002 0x00000117 0x001000af 2      2      0
            38   0x00000000460db7b0 2     0x00000440 0x00000797 0x0010010c 2      0      0
            38   0x00000000460db7b0 3     0x00000400 0x00000407 0x0010010a 2      0      0
            38   0x00000000460db7b0 4     0x00000400 0x00000407 0x0010010a 2      0      0
            38   0x00000000460db7b0 5     0x00000002 0x00000003 0x00100003 2      2      0
            38   0x00000000460db7b0 6     0x00000400 0x00000397 0x00100003 2      2      0
            38   0x00000000460db7b0 7     0x00000400 0x00000413 0x0010010f 2      0      0
            38   0x00000000460db7b0 8     0x00000440 0x00000797 0x0010010c 2      0      0
            38   0x00000000460db7b0 9     0x00000402 0x00000403 0x0010010f 2      0      0
            38   0x00000000460db7b0 10    0x00000442 0x00000403 0x00100111 1      0      0
            38   0x00000000460db7b0 11    0x00000442 0x00000403 0x00100110 1      0      0
            38   0x00000000460db7b0 12    0x00000442 0x00000403 0x00100112 1      0      0
            38   0x00000000460db7b0 15    0x00000400 0x00004407 0x00000006 1      0      0
            38   0x00000000460db7b0 16    0x00000400 0x00000413 0x00100119 1      0      0
            
            36   0x00000000460dbf98 0     0x00000400 0x00000397 0x001000af 2      2      0
            36   0x00000000460dbf98 1     0x00000002 0x00000003 0x001000af 2      2      0
            36   0x00000000460dbf98 3     0x00000402 0x00000407 0x0010010a 2      0      0
            36   0x00000000460dbf98 4     0x00000400 0x00000413 0x0010010a 2      0      0
            36   0x00000000460dbf98 6     0x00000442 0x00000797 0x0010010c 1      0      0
            
            37   0x00000000460dc780 0     0x00000400 0x00000397 0x001000af 2      2      0
            37   0x00000000460dc780 1     0x00000002 0x00000117 0x001000af 2      2      0
            37   0x00000000460dc780 2     0x00000400 0x00000407 0x0010010a 2      0      0
            37   0x00000000460dc780 3     0x00000440 0x00000797 0x0010010c 2      0      0
            37   0x00000000460dc780 4     0x00000400 0x00000413 0x0010010f 2      0      0
            37   0x00000000460dc780 5     0x00000400 0x00000407 0x0010010a 2      0      0
            37   0x00000000460dc780 6     0x00000440 0x00000797 0x0010010c 2      0      0
            37   0x00000000460dc780 7     0x00000400 0x00000397 0x00100003 2      2      0
            37   0x00000000460dc780 8     0x00000002 0x00000003 0x00100003 2      2      0
            37   0x00000000460dc780 9     0x00000442 0x00000403 0x00100111 1      0      0
            37   0x00000000460dc780 10    0x00000442 0x00000403 0x00100110 1      0      0
            37   0x00000000460dc780 11    0x00000402 0x00000403 0x0010010f 2      0      0
            37   0x00000000460dc780 12    0x00000400 0x00000413 0x00100119 1      0      0
            37   0x00000000460dc780 13    0x00000442 0x00000403 0x00100112 1      0      0
            37   0x00000000460dc780 14    0x00000400 0x00004407 0x00000006 1      0      0

输出描述

tid (decimal)
当前访问分区资源(表和索引)的线程 ID
rstcb (hexadecimal)
该线程的 RSAM 线程控制 block 的内存地址
isfd (decimal)
与打开分区关联的 ISAM 文件描述符
op_mode (hexadecimal)
使用以下十六进制值组合的分区锁定方式的当前状态:
0x000000 Open for input only
                0x000001 Open for output only
                0x000002 Open for input and output
                0x000004 System catalog
                0x000008 No logical logging
                0x000010 Open if not already opened for alter
                0x000020 Open all fragments data and index
                0x000040 Do not allocate a blob descriptor
                0x000080 Open for alter
                0x000100 Open all data fragments
                0x000200 Automatic record lock
                0x000400 Manual record lock
                0x000800 Exclusive ISAM file lock
                0x001000 Ignore dataskip - data cannot be ignored
                0x002000 Dropping partition - delay file open
                0x004000 Do not drop blobspace blobs when table dropped 
                (alter fragment)
                0x010000 Open table for DDL operations
                0x040000 Do not assert fail if this partnum does not exist
                0x080000 Include fragments of subtables
                0x100000 Table created under supertable
                0x400000 Blob in use by CDR
op_flags (hexadecimal)
分区的当前状态使用以下十六进制值组合:
0x0001  Open data structure is in use
                0x0002  Current position exists
                0x0004  Current record has been read
                0x0008  Duplicate created or read
                0x0010  Skip current record on reverse read
                0x0020  Shared blob information
                0x0040  Partition opened for rollback
                0x0080  Stop key has been set
                0x0100  No index related read aheads
                0x0200  isstart called for current stop key
                0x0400  Pseudo-closed
                0x0800  Real partition opened for SMI query
                0x1000  Read ahead of parent node is done
                0x2000  UDR keys loaded
                0x4000  Open is for a pseudo table
                0x8000  End of file encountered when positioning in table
partnum (hexadecimal)
已打开资源(表和索引)的分区数
ucount (decimal)
当前访问该分区的用户线程数
ocount (decimal)
打开该分区的次数
lockmode (decimal)
使用以下代码值之一保存锁定类型:
0   No locks
              1   Byte lock
              2   Intent shared lock
              3   Shared lock
              4   Shared lock by repeatable read (only on items)
              5   Update lock
              6   Update lock by repeatable read (only on items)
              7   Intent exclusive lock
              8   Shared, intent exclusive lock
              9   Exclusive lock
              10  Exclusive lock by repeatable read (only on items)
              11  Inserter's repeatable read test lock