增加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;

 

(0)
上一篇 2022年3月22日
下一篇 2022年3月22日

相关推荐