免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 9114 | 回复: 4
打印 上一主题 下一主题

如何查看表空间? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-09-27 10:20 |只看该作者 |倒序浏览
如题,谢谢各位解答,不甚感激

论坛徽章:
0
2 [报告]
发表于 2009-10-13 14:32 |只看该作者
参考我博客:http://hi.baidu.com/smallfish_xy ... 0ccb36b80e2d8f.html

SELECT spcname FROM pg_tablespace;

论坛徽章:
0
3 [报告]
发表于 2009-10-13 15:57 |只看该作者
\db

论坛徽章:
0
4 [报告]
发表于 2009-10-21 11:57 |只看该作者
查看表空间使用情况的SQL语句:
   SELECT a.tablespace_name "表空间名",total 表空间大小,free 表空间剩余大小,
(total-free) 表空间使用大小,
ROUND((total-free)/total,4)*100 "使用率 %"
FROM  (SELECT tablespace_name,SUM(bytes) free FROM DBA_FREE_SPACE
GROUP BY tablespace_name ) a,
(SELECT tablespace_name,SUM(bytes) total FROM DBA_DATA_FILES
GROUP BY tablespace_name) b
WHERE a.tablespace_name=b.tablespace_name

论坛徽章:
0
5 [报告]
发表于 2009-11-16 14:24 |只看该作者
楼上说的是Oracle的

Name Return Type Description
pg_column_size(any) int Number of bytes used to store a particular value (possibly compressed)
pg_database_size(oid)  bigint Disk space used by the database with the specified OID
pg_database_size(name)  bigint Disk space used by the database with the specified name
pg_relation_size(relation regclass, fork text)  bigint Disk space used by the specified fork ('main', 'fsm' or 'vm') of the table or index with the specified OID or name  
pg_relation_size(relation regclass)  bigint Shorthand for pg_relation_size(..., 'main')  
pg_size_pretty(bigint)  text Converts a size in bytes into a human-readable format with size units
pg_tablespace_size(oid)  bigint Disk space used by the tablespace with the specified OID
pg_tablespace_size(name)  bigint Disk space used by the tablespace with the specified name
pg_total_relation_size(regclass)  bigint Total disk space used by the table with the specified OID or name, including indexes and TOAST data
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP