ITPub博客

首页 > 数据库 > Oracle > Oracle数据库中表空间(数据文件)的扩展方法

Oracle数据库中表空间(数据文件)的扩展方法

原创 Oracle 作者:morigejile 时间:2016-12-28 21:48:14 0 删除 编辑

第一步:首先要确定表空间名字及数据文件的位置:

    select tablespace_name, file_id, file_name,

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

    from dba_data_files

    order by tablespace_name;


第二步:选择一种适合的扩展表空间的方式,一般有有三种方式可以扩展表空间:

     方法一:数据文件的resize来扩:

    SQL> alter database datafile '/Oracle/oradata/orcl/user_test02.dbf' resize 20m;

    方法二:添加数据文件的方式来扩:

    SQL> alter tablespace USER_TEST add datafile '/oracle/oradata/orcl/user_test02.dbf' size 10M;

    第三种方法:设置数据文件自动扩展:

    alter tablespace USER_TEST add datafile '/oracle/oradata/orcl/user_test02.dbf' size 10M; 


最后查看表空间使用情况:

    查看表空间大小:

select tablespace_name,sum(bytes)/1024/1024 from dba_data_files group by tablespace_name;

    查看表空间已使用大小:

select tablespace_name,sum(bytes)/1024/1024 from dba_free_space group by tablespace_name;

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/28285942/viewspace-2131573/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: 没有了~
请登录后发表评论 登录
全部评论

注册时间:2015-07-23

  • 博文量
    2
  • 访问量
    10888