在ASM中:查询所有磁盘名称、总大小、剩余大小:单位MB
-----查看组的信息(总大小)
select name,total_mb, free_mb from v$asm_diskgroup;
---查看磁盘成员信息分别大小
select name,total_mb,free_mb from v$asm_disk;
或者:
[[email protected]]asmcmd
ASMCMD>lsdg
查询表空间数据文件路径和总大小:单位MB
SELECT tablespace_name,
file_id,
file_name,
round(bytes / (1024 * 1024), 0) total_space
FROM dba_data_files
ORDER BY tablespace_name;
查询表空间已使用、剩余、使用百分比:单位GB
SELECT a.tablespace_name,
b.size_GB,
a.free_GB,
round((a.free_GB/b.size_GB) * 100) "FREE_%"
FROM (SELECT tablespace_name,
round(Sum(bytes)*10/1024/1024/1024)/10 free_GB
FROM
dba_free_space
GROUP BY tablespace_name) a,
(SELECT tablespace_name,
round(Sum(bytes)*10/1024/1024/1024)/10 size_GB
FROM dba_data_files
GROUP BY tablespace_name) b
WHERE a.tablespace_name = b.tablespace_name
order by 4 desc
/
测试一个表空间最多能有几个数据文件:
create tablespace qiu datafile ‘/u01/app/oracle/oradata/qiu1.dbf‘ size 1M;
declare
v_str varchar2(200);
begin
for i in 2..1024 loop
v_str:=‘alter tablespace qiu add datafile ‘||‘‘‘/u01/app/oracle/oradata/qiu‘||i||‘.DBF‘‘‘||‘ size 1M‘;
execute immediate v_str;
end loop;
end;
/