1. 查看所有表空间大小
select tablespace_name,(sum(bytes)/1024/1024) tablespace_size from dba_data_files group by tablespace_name;
2. 未使用的表空间大小
select tablespace_name,(sum(bytes)/1024/1024) tablespace_size from dba_free_space group by tablespace_name;
3.查询用户所对应的表空间:
select username,default_tablespace from dba_users;
4.查询所有的表空间
select tablespace_name from dba_tablespaces;
5.查看具体表单所占空间
select Segment_Name,Sum(bytes)/1024/1024 From User_Extents Group By Segment_Name
6. 查看表空间中分布的用户信息
select tablespace_name,owner,sum(bytes) from dba_segments group by tablespace_name,owner;
7.为用户指定表空间:
alter user 用户名 default tablespace 表空间名字 ;
8.为用户指定临时表空间:
alter user 用户名 temporary tablespace 表空间名字;
9.删除表空间:
drop tablespace 表空间名字 including contents and datafiles cascade constraint;
10.查找工作空间的路径:
select * from dba_data_files;
11.增加表空间大小的四种方法
11.1:给表空间增加数据文件
alter tablespace cwy_DE0630 add datafile '/u01/app/oracle/admin/orcl/cwy_DE0630_01.dbf' size 5000M;
11.2:新增数据文件,并且允许数据文件自动增长
alter tablespace cwy_DE0630 add datafile '/u01/app/oracle/admin/orcl/cwy_DE0630_02.dbf' SIZE 5000M AUTOEXTEND ON NEXT 5000m MAXSIZE UNLIMITED;
11.3:允许已存在的数据文件自动增长
alter tablespace datafile '/u01/app/oracle/admin/orcl/cwy_DE0630_01.dbf' AUTOEXTEND ON NEXT 5M MAXSIZE 10240M;
11.4:手工改变已存在数据文件的大小
alter tablespace datafile '/u01/app/oracle/admin/orcl/cwy_DE0630_01.dbf' RESIZE 1000M;