---
title: "查询表空间使用情况"
author: "aviva"
date: "2009-03-24T09:57:00Z"
tags: []
slug: "untitled"
draft: false
lastmod: "2009-03-24T09:57:00Z"
id: 360736
url: "https://aviva.iteye.com/blog/360736"
---

Select Owner,Tablespace\_name,Segment\_Name,Segment\_Type,Sum(bytes)/1024/1024 sums From Dba\_Extents  
 where owner='NBCHECK' and Segment\_Type='TABLE'  
    Group By Owner,Tablespace\_name,Segment\_Name,Segment\_Type  
    Order By sums

 

 

 

表空间的大小与用户的配额大小是两种不同的概念。表空间的大小是指实际的用户表空间的大小，而配额大小指的是用户指定使用表空间的的大小

把表空间文件增大，还是出现这个问题，用户在使用表空间的同时使用空间的限额，如果超出限制，就算有空的地方，也不会让用户使用。

遇到ORA-01536错误，首先要查看用户的表空间的限额

   select * from dba\_ts\_quotas;

   select * from user\_ts\_quotas;

max\_bytes字段-1是代表没有限制,其它值多少就是多少. 

&lt;meta. content="text/html; charset=utf-8" http-equiv="Content-Type"&gt; &lt;meta. content="OneNote.File" name="ProgId"&gt; &lt;meta. content="Microsoft OneNote 12" name="Generator"&gt;

dba\_ts\_quotas ：描述所有用户表空间的限额

&lt;meta. content="text/html; charset=utf-8" http-equiv="Content-Type"&gt; &lt;meta. content="OneNote.File" name="ProgId"&gt; &lt;meta. content="Microsoft OneNote 12" name="Generator"&gt;

user\_ts\_quotas ：描述当前用户表空间的限额。

如果查询结果中max\_bytes字段不为-1，修改为无限制或者指定的大小。

&lt;meta. content="text/html; charset=utf-8" http-equiv="Content-Type"&gt; &lt;meta. content="OneNote.File" name="ProgId"&gt; &lt;meta. content="Microsoft OneNote 12" name="Generator"&gt;

不对用户做[**表空间限额**](http://www.cnblogs.com/aviva/admin/javascript:;)控制:

    GRANT UNLIMITED TABLESPACE TOuser;

这种方式是全局性的。  或者

    alter useruserquota unlimited onuser\_tablespace;

 这种方式是针对特定的表空间的.

回收表空间限额控制:

    revoke unlimited tablespace fromuser;

或者

    alter useruserquota 0 onuser\_tablespace;

 

 

 

ITPUB个人空间"F6P\*Zt%HZ(BGo