一、查看表空间
SELECT a.tablespace_name tbsname,trunc(a.total,2) space_allocated, trunc((a.total-nvl(b.free,0.0)),2)space_used, trunc((a.total-NVL(b.free,0.0))/a.max * 1000) / 10 USED__PRC, trunc(a.max,2) space_max FROM (SELECT tablespace_name,sum(bytes)/1024/1024/1024 total,sum(maxbytes)/1024/1024/1024 max FROM (SELECT tablespace_name,bytes,decode(maxbytes,0,bytes,maxbytes)maxbytes FROM dba_data_files) GROUP BY tablespace_name) A, (SELECT tablespace_name,sum(bytes)/1024/1024/1024 free FROM dba_free_space GROUP BY tablespace_name) B WHERE a.tablespace_name=b.tablespace_name order by 4;
二、查看单个表空间
select file_name,bytes/1024/1024/1024 from dba_data_files where tablespace_name='PCM_OC'; select file_name,bytes/1024/1024/1024 from dba_data_files where FILE_NAME like '%shfw%';
三、添加或resize数据文件
alter database datafile '/路径/数据文件' resize 30G; alter tablespace TBS_YUTONG_SHPJ add datafile '/路径/数据文件f' size 30G;