【DB2】查看表空间对应的物理文件地址

使用的命令:

db2 list tablespaces show detail

db2 list tablespace containers for [Tablespace ID] [show detail]

说明:在语句末尾添加show detail,则能查看表空间大小以及使用的信息

以下是具体实现案例:

在日常使用db2的过程中,有时候我们需要查询db2表空间所存储的位置来判断磁盘空间是否还够用,下面为查询表空间TEMPTS16K的位置

db2inst1@Linux:/opt> db2 list tablespaces show detail

           Tablespaces for Current Database

Tablespace ID                        = 0
  Name                                 = SYSCATSPACE
  Type                                 = Database managed space
  Contents                             = All permanent data. Regular table space.
  State                                = 0x0000
    Detailed explanation:
      Normal
  Total pages                          = 24576
  Useable pages                        = 24572
  Used pages                           = 22552
  Free pages                           = 2020
  High water mark (pages)              = 22552
  Page size (bytes)                    = 4096
  Extent size (pages)                  = 4
  Prefetch size (pages)                = 4
  Number of containers                 = 1

Tablespace ID                        = 1
  Name                                 = TEMPSPACE1
  Type                                 = System managed space
  Contents                             = System Temporary data
  State                                = 0x0000
    Detailed explanation:
      Normal
  Total pages                          = 1
  Useable pages                        = 1
  Used pages                           = 1
  Free pages                           = Not applicable
  High water mark (pages)              = Not applicable
  Page size (bytes)                    = 4096
  Extent size (pages)                  = 32
  Prefetch size (pages)                = 32
  Number of containers                 = 1

Tablespace ID                        = 2
  Name                                 = USERSPACE1
  Type                                 = Database managed space
  Contents                             = All permanent data. Large table space.
  State                                = 0x0000
    Detailed explanation:
      Normal
  Total pages                          = 49152
  Useable pages                        = 49120
  Used pages                           = 45984
  Free pages                           = 3136
  High water mark (pages)              = 45984
  Page size (bytes)                    = 4096
  Extent size (pages)                  = 32
  Prefetch size (pages)                = 32
  Number of containers                 = 1

Tablespace ID                        = 3
  Name                                 = TEMPTS16K
  Type                                 = System managed space
  Contents                             = System Temporary data
  State                                = 0x0000
    Detailed explanation:
      Normal
  Total pages                          = 1
  Useable pages                        = 1
  Used pages                           = 1
  Free pages                           = Not applicable
  High water mark (pages)              = Not applicable
  Page size (bytes)                    = 16384
  Extent size (pages)                  = 32
  Prefetch size (pages)                = 32
  Number of containers                 = 1

db2inst1@Linux:/opt> db2 list tablespace containers for 3

            Tablespace Containers for Tablespace 3

Container ID                         = 0
  Name                                 = /db2home/db2inst1/db2inst1/NODE0000/QINDB/T0000003/C0000000.TMP
  Type                                 = Path

从上述显示结果我们可以看出,表空间TEMPTS16K对应的物理文件路径为:/db2home/db2inst1/db2inst1/NODE0000/QINDB/T0000003/C0000000.TMP

posted @ 2019-01-02 10:45  OLIVER_QIN  阅读(6032)  评论(0编辑  收藏  举报