使用的命令:
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 = 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
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
db2檢視表空間和系統鎖狀態以及索引
使用db2inst1使用者登陸資料庫,檢視schema sysibmadm下檢視container utilization 檢視當前系統鎖狀態 使用db2inst1使用者登陸資料庫,在schema sysibmadm下檢視lock held當前鎖和檢視lockwaits鎖等待 實際上在schema ...
DB2 檢視所有表空間占用磁碟空間大小
db2 檢視表空間使用情況,占用磁碟空間大小 select a.snapshot timestamp,a.tbsp name,b.tbsp type,a.tbsp state,a.tbsp usable pages b.tbsp page size 1024 1024 1024 as total,a...
db2資料庫的表空間檢視及增添表空間
db2檢視表空間 連線db2資料庫 db2 connect to user using 檢視資料庫下所有的表空間情況 db2 list tablespaces show detail 檢視表空間下的檔案 db2 list tablespace containers for 表空間對應的數字編號 增加...