[Oracle]增加数据库表空间

查询目前表空间使用情况

select 	a.tablespace_name, 
		a.bytes/1024/1024 || 'M' total, 
		b.bytes/1024/1024 || 'M' used, 
		c.bytes/1024/1024 || 'M' free, 
		(b.bytes * 100) / a.bytes "% USED ", 
		(c.bytes * 100) / a.bytes "% FREE " 
from sys.sm$ts_avail a, sys.sm$ts_used b, sys.sm$ts_free c 
where a.tablespace_name = b.tablespace_name 
and a.tablespace_name = c.tablespace_name; 

查询目前表空间数据文件使用情况

select files.file_id 数据文件序号, files.file_name 数据文件路径, files.tablespace_name 表空间名称, 
       to_char(files.maxbytes /1024/1024/1024, '9999.00') || 'G' 数据文件最大容量,
       to_char(files.bytes    /1024/1024/1024, '9999.00') || 'G' 数据文件目前大小,
       to_char(sum(nvl(free.bytes, 0))/1024/1024/1024, '9999.00') || 'G' 数据文件空闲大小,
       to_char((sum(nvl(free.bytes, 0))/1024/1024/1024)*100 / (files.maxbytes /1024/1024/1024), '999.0') || '%'
       from dba_data_files       files
       inner join v$datafile     filesInf on files.file_id = filesInf.file#
       left  join dba_free_space free     on files.file_id = free.file_id
       group by files.file_id, files.file_name, files.tablespace_name, 
             files.maxbytes /1024/1024/1024,
             to_char(files.maxbytes /1024/1024/1024, '9999.00') || 'G',
             to_char(files.bytes    /1024/1024/1024, '9999.00') || 'G'
       order by files.file_id;

增加30G大小的数据文件

alter tablespace 表空间名 add datafile '/u02/app/oracle/oradata/orcl/users03.dbf' size 50M autoextend on next 50M maxsize 30720M;

创建一个新的表空间

create tablespace 表空间名 datafile  '数据文件名'  size 表空间大小;
create tablespace 表空间名 datafile '数据文件名' size 50M autoextend on next 50M maxsize 30720M;
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值