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;