可以使用以下命令來查看DB2數據庫中表的磁盤空間占用情況:
db2 connect to <database_name>
db2 "SELECT TABNAME, SUM(DATA_OBJECT_P_SIZE + INDEX_OBJECT_P_SIZE + LONG_OBJECT_P_SIZE) AS TOTAL_SIZE FROM SYSIBMADM.ADMINTABINFO GROUP BY TABNAME"
該命令將返回包含表名和總的磁盤空間占用大小的結果集。
如果你只想查看特定表的磁盤空間占用情況,可以在查詢中添加過濾條件,例如:
db2 "SELECT TABNAME, SUM(DATA_OBJECT_P_SIZE + INDEX_OBJECT_P_SIZE + LONG_OBJECT_P_SIZE) AS TOTAL_SIZE FROM SYSIBMADM.ADMINTABINFO WHERE TABNAME = '<table_name>' GROUP BY TABNAME"
替換<database_name>
為你要連接的數據庫名稱,替換<table_name>
為你要查看磁盤空間占用情況的表名。