增加oracle表空间

查找用户对应的表空间

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;

扫描二维码关注公众号,回复: 3507808 查看本文章

猜你喜欢

转载自www.cnblogs.com/lingxiao102/p/9764595.html
今日推荐