space 管理

输入:表空间名字

输出:表空间下的一个文件即退出



/tmp/1.sql

select name from v$database;

set serveroutput on;


declare
 i1 varchar2(100);
 i2 varchar2(50); 
 i3 number(16);
begin
for i in (select distinct(tablespace_name) name from dba_data_files) 
loop
select max(file_name) into i1 from  dba_data_files where tablespace_name=i.name;
select tablespace_name,bytes/1024/1024 into i2,i3 from dba_data_files  where file_name=i1;
dbms_output.put_line(i1);
dbms_output.put_line(i2);
dbms_output.put_line(i3);
dbms_output.put_line('-------');
end loop;
end;
/

 

posted @ 2016-10-14 09:02  feiyun8616  阅读(207)  评论(0编辑  收藏  举报