增加oracle表空間

凌霄102發表於2018-10-10

查詢使用者對應的表空間

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;

 

相關文章