1.oracle查询工做空间使用状况sql
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.查询版本信息oracle
select * from v$version;
3.查询用户下全部表的字段spa
select * from user_tab_columns;
4.查看某用户下的全部表code
select * from user_tables;
5.查看某用户的表的表空间使用状况io
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.释放某张表的表空间table
alter table 表名称 deallocate UNUSED KEEP 0;