---
title: "查看表空间的使用率"
author: "linder"
date: "2011-07-02T16:42:04Z"
tags: []
categories: ["数据库"]
slug: "untitled"
draft: false
lastmod: "2011-07-02T16:42:04Z"
id: 1113075
url: "https://linder.iteye.com/blog/1113075"
---

```
select a.tablespace_name,a.bytes/1024/1024 "Sum MB",(a.bytes-b.bytes)/1024/1024 "Used MB",b.bytes/1024/1024 "Free MB",round(((a.bytes-b.bytes)/a.bytes)*100,2) "Percent_userd" 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;
```