MySQL :
SELECT CONCAT(table_schema,'.',table_name) AS 'Table Name',
table_rows AS 'Number of Rows',
CONCAT(ROUND(data_length/(1024*1024),6),' M') AS 'Data Size',
CONCAT(ROUND(index_length/(1024*1024),6),' M') AS 'Index Size' ,
CONCAT(ROUND((data_length+index_length)/(1024*1024),6),' M') AS'Total'
FROM information_schema.TABLES
WHERE table_schema LIKE 'database';
DB2: (命令查看)
1.连接到数据库: db2 connect to "tablebase"
2. db2 list tablespaces show detail
Oracle: (查看总的使用情况)
SELECT t.tablespace_name, round(SUM(bytes / (1024 * 1024)), 0) ts_size
FROM dba_tablespaces t, dba_data_files d
WHERE t.tablespace_name = d.tablespace_name
GROUP BY t.tablespace_name;
SQLserver:(查看单个表使用情况)
exec sp_spaceused table_name;
"视不同情况, 解决不同问题"