第一范文网 - 专业文章范例文档资料分享平台

Oracle 表空间增加新数据文件

来源:用户分享 时间:2025/5/28 15:17:20 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

Oracle 在原有的表空间(Tablespace)上增加新的数据文件

一、查询原数据文件所在的位置(以及数据文件大小),以便新数据文件创建到该位置 selecttablespace_name,

file_id,

file_name,round(bytes/(1024*1024*1024),0)

total_space_size_GB from dba_data_files where tablespace_name=表空间名称 order by tablespace_name

二:增加数据文件

alter tablespace表空间名称

add datafile '新的数据文件地址' size 初始数据文件大小

altertablespace BI

adddatafile 'D:\\DATA\\BI02.DBF' size 1024m

三:设置表空间自动扩展。

注意:Oracle 的最大数据文件大小为32G,因此,建议设置最大大小为30G alter database datafile '数据文件位置'

autoextend on next 自动扩展大小 maxsize 最大扩展大小

alter database datafile 'D:\\DATA\\BI02.DBF' autoextend on next 1024m maxsize 30720m

四:查询表空间使用情况: select

a.tablespace_name,

a.bytes/1024/1024/1024 \

(a.bytes-b.bytes)/1024/1024/1024 \b.bytes/1024/1024/1024 \

round (((a.bytes-b.bytes)/a.bytes)*100,2) \ from

(selecttablespace_name,sum(bytes) bytes from dba_data_files group by tablespace_name) a,

(selecttablespace_name,sum(bytes)

bytes,max

(bytes)

largest

from

dba_free_space group by tablespace_name) b wherea.tablespace_name=b.tablespace_name order by ((a.bytes-b.bytes)/a.bytes) desc;

--附:查看当前用户每个表的大小,可能会花较长时间

Select Segment_Name,Sum(bytes)/1024/1024 as table_size_MB From User_Extents Group By Segment_Name

搜索更多关于: Oracle 表空间增加新数据文件 的文档
Oracle 表空间增加新数据文件.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c4h4wk4u6fw6cyp27lz4y3h0qq02ukg01byg_1.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top