Chinaunix首页 | 论坛 | 博客
  • 博客访问: 981409
  • 博文数量: 358
  • 博客积分: 8185
  • 博客等级: 中将
  • 技术积分: 3751
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-15 16:27
个人简介

The views and opinions expressed all for my own,only for study and test, not reflect the views of Any Company and its affiliates.

文章分类

全部博文(358)

文章存档

2012年(8)

2011年(18)

2010年(50)

2009年(218)

2008年(64)

我的朋友

分类: Oracle

2009-01-20 22:43:26

SELECT a.tablespace_name,a.bytes bytes_used,b.largest,round(((a.bytes-b.bytes)/a.bytes)*100,2)percent_used
FROM
(SELECT tablespace_name,sum(bytes) bytes FROM dba_data_files GROUP BY tablespace_name)a,
(SELECT tablespace_name,sum(bytes) bytes,max(bytes) largest FROM dba_free_space GROUP BY tablespace_name)b
WHERE a.tablespace_name =b.tablespace_name
ORDER BY ((a.bytes-b.bytes)/a.bytes) DESC
 
检查表空间的使用情况
SELECT tablespace_name, max_m, count_blocks free_blk_cnt, sum_free_m,
TO_CHAR (100 * sum_free_m / sum_m, ‘99.99′) || ‘%’ AS pct_free
FROM (SELECT tablespace_name, SUM (BYTES) / 1024 / 1024 AS sum_m
FROM dba_data_files
GROUP BY tablespace_name),
(SELECT tablespace_name AS fs_ts_name,
MAX (BYTES) / 1024 / 1024 AS max_m,
COUNT (blocks) AS count_blocks,
SUM (BYTES / 1024 / 1024) AS sum_free_m
FROM dba_free_space
GROUP BY tablespace_name)
WHERE tablespace_name = fs_ts_name ;
检查剩余表空间
/* Formatted on 2007/03/01 15:56 (Formatter Plus v4.8.7) */
SELECT tablespace_name, SUM (blocks) AS free_blk,
TRUNC (SUM (BYTES) / (1024 * 1024)) AS free_m,
MAX (BYTES) / (1024) AS big_chunk_k, COUNT (*) AS num_chunks
FROM dba_free_space
GROUP BY tablespace_name;
阅读(873) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~