1.oracle查询工作空间使用情况
select b.file_name 物理文件名,
b.tablespace_name 表空间,
b.bytes / 1024 / 1024 大小M,
(b.bytes - sum(nvl(a.bytes, 0))) / 1024 / 1024 已使用M,
substr((b.bytes - sum(nvl(a.bytes, 0))) / (b.bytes) * 100, 1, 5) 利用率
from dba_free_space a, dba_data_files b
where a.file_id = b.file_id
group by b.tablespace_name, b.file_name, b.bytes
order by b.tablespace_name;
2.查询版本信息
select * from v$version;
3.查询用户下所有表的字段
select * from user_tab_columns;
4.查看某用户下的所有表
select * from user_tables;
5.查看某用户的表的表空间使用情况
select OWNER,
t.segment_name,
t.segment_type,
sum(t.bytes / 1024 / 1024) mmm
from dba_segments t
where t.owner = '用户名(注意大小写)'
and t.segment_type = 'TABLE'
group by OWNER, t.segment_name, t.segment_type
order by mmm desc;
6.释放某张表的表空间
alter table 表名称 deallocate UNUSED KEEP 0;