『ORACLE』 对永久表空间进行DDL操作(11g)

查看数据库默认表空间
SQL> select property_value from database_properties where property_name = 'DEFAULT_PERMANENT_TABLESPACE';

PROPERTY_VALUE
--------------------------------------------------------------------------------
USERS

查看用户所使用的表空间

SQL> select owner,tablespace_name,round(sum(bytes) / 1024 / 1024,2) "used(M)"
2 from dba_segments
3 where owner = 'SCOTT'
4 group by owner,tablespace_name
5 order by sum(bytes) desc;

OWNER TABLESPACE_NAME used(M)
-------- --------------- ----------
SCOTT USERS .31

查看用户中所有对象所占用空间大小

SQL> select owner,tablespace_name,segment_name,round(sum(bytes) /1024/1024) "USERD(M)"
2 from dba_segments
3 where owner = 'SCOTT'
4 group by owner,tablespace_name,segment_name,segment_type
5 order by sum(bytes) desc;

OWNER TABLESPACE_NAME SEGMENT_NA USERD(M)
-------- --------------- ---------- ----------
SCOTT USERS EMP 0
SCOTT USERS PK_EMP 0
SCOTT USERS PK_DEPT 0
SCOTT USERS DEPT 0
SCOTT USERS SALGRADE 0

查看表空间剩余空间大小

SQL> select tablespace_name, sum(bytes) / (1024*1024) free_space from dba_free_space group by tablespace_name;

TABLESPACE_NAME FREE_SPACE
--------------- ----------
SYSAUX 34.1875
UNDOTBS1 98
USERS .8125
SYSTEM 9.75
EXAMPLE 2.9375

 

posted @ 2017-05-24 20:01  九號栈長  阅读(278)  评论(0编辑  收藏  举报