--查看数据库中所有数据文件的名称位置,所属表空间,以及大小等等
select file_name , tablespace_name from dba_data_files;
--扩充表空间
ALTER DATABASE DATAFILE '/u01/app/oracle/oradata/PESTALARM/system01.dbf'
RESIZE 20G;
--设置表空间自增
ALTER DATABASE DATAFILE '/u01/app/oracle/oradata/PESTALARM/system01.dbf'
AUTOEXTEND ON NEXT 500M MAXSIZE 50G;
--查询空间使用情况
select dbf.tablespace_name,
dbf.totalspace "总量(M)",
dbf.totalblocks as 总块数,
dfs.freespace "剩余总量(M)",
dfs.freeblocks "剩余块数",
(dfs.freespace / dbf.totalspace) * 100 "空闲比例"
from (select t.tablespace_name,
sum(t.bytes) / 1024 / 1024 totalspace,
sum(t.blocks) totalblocks
from dba_data_files t
group by t.tablespace_name) dbf,
(select tt.tablespace_name,
sum(tt.bytes) / 1024 / 1024 freespace,
sum(tt.blocks) freeblocks
from dba_free_space tt
group by tt.tablespace_name) dfs
where trim(dbf.tablespace_name) = trim(dfs.tablespace_name)