oracle19c表空间扩容怎么操作?
50Moracle19c表空间扩容怎么操作?
我来答
添加附件
收藏
复制链接
微信扫码分享
在小程序上查看
分享
添加附件
问题补充
1条回答
默认
最新
1、查看表空间
col TABLESPACE_NAME for a20
select tbs_used_info.tablespace_name,
tbs_used_info.alloc_mb,
tbs_used_info.used_mb,
tbs_used_info.max_mb,
tbs_used_info.free_of_max_mb,
tbs_used_info.used_of_max || '%' used_of_max_pct
from (select a.tablespace_name,
round(a.bytes_alloc / 1024 / 1024) alloc_mb,
round((a.bytes_alloc - nvl(b.bytes_free,
0)) / 1024 / 1024) used_mb,
round((a.bytes_alloc - nvl(b.bytes_free,
0)) * 100 / a.maxbytes) used_of_max,
round((a.maxbytes - a.bytes_alloc + nvl(b.bytes_free,
0)) / 1048576) free_of_max_mb,
round(a.maxbytes / 1048576) max_mb
from (select f.tablespace_name,
sum(f.bytes) bytes_alloc,
sum(decode(f.autoextensible,
'YES',
f.maxbytes,
'NO',
f.bytes)) maxbytes
from dba_data_files f
group by tablespace_name) a,
(select f.tablespace_name,
sum(f.bytes) bytes_free
from dba_free_space f
group by tablespace_name) b
where a.tablespace_name = b.tablespace_name(+)) tbs_used_info
order by tbs_used_info.used_of_max desc;
##查询表空间的文件路径
SELECT file_name, tablespace_name, bytes/1024/1024/1024 AS size_gb
FROM dba_data_files
WHERE tablespace_name = 'SYSAUX';
2、扩容
2.1、扩容当前文件
- 这种扩容是在当前大小下扩容,如果当前表空间为50G,按照下面这个语句,那么本次扩容为50G,扩容后表空间为100G。
ALTER DATABASE DATAFILE '/data/DB1/sysaux01.dbf' RESIZE 100G;
2.2、新增文件扩容
- 新增大小
###新增文件,并扩容10G,表空间时间大小=原空间大小+10G
ALTER TABLESPACE SYSAUX ADD DATAFILE '/data/DB1/sysaux02.dbf' SIZE 10G;
##使用`AUTOEXTEND ON NEXT 1024M`,表示在数据文件满时会自动扩展,并且每次扩展时增加1024MB(1GB)的空间。
ALTER TABLESPACE SYSAUX ADD DATAFILE '/data/DB1/sysaux02.dbf' SIZE 10G AUTOEXTEND ON NEXT 1024M;
评论
有用 0
回答交流
提交
问题信息
请登录之后查看
邀请回答
暂无人订阅该标签,敬请期待~~
墨值悬赏

