查找用戶對應的表空間
1、查詢表空間物理文件路徑
select tablespace_name, file_id, file_name,
round(bytes/(1024*1024),0) total_space
from dba_data_files
where tablespace_name='NXWSPT';
2、增加數據文件個數
alter tablespace NXWSPT add datafile '+DATA/nxwspt03.dbf' size 32767m;
******************************************
1、查詢表空間使用情況
select b.file_id 文件ID號,
b.tablespace_name 表空間名,
b.bytes / 1024 / 1024/ 1024 字節數G,
(b.bytes - sum(nvl(a.bytes, 0))) / 1024 / 1024 / 1024 已使用G,
sum(nvl(a.bytes, 0)) / 1024 / 1024/ 1024 剩余空間G,
100 - sum(nvl(a.bytes, 0)) / (b.bytes) * 100 占用百分比
from dba_free_space a, dba_data_files b
where a.file_id = b.file_id
group by b.tablespace_name, b.file_id, b.bytes
order by b.file_id;
2、查詢表空間物理文件路徑
SELECT tablespace_name,
file_id,
file_name,
round(bytes / (1024 * 1024), 0) total_space
FROM dba_data_files
ORDER BY tablespace_name;
3、增加表空間
(1)允許已存在的數據文件自動增長
alter database datafile '+DATA/orcl/datafile/system.260.879527735' autoextend on next 5m maxsize unlimited;
(2)手工改變已存在數據文件的大小
ALTER DATABASE DATAFILE '+DATA/orcl/datafile/system.260.879527735'
RESIZE 10240M;
