oracle数据库表空间 追加数据库文件

来源:互联网 发布:知乎live 百度网盘 编辑:程序博客网 时间:2024/06/10 06:44
1、查看表空间的使用情况
select   b.file_id 文件ID号,   b.tablespace_name 表空间名,   b.bytes/1024/1024||'M'字节数,   (b.bytes-sum(nvl(a.bytes,0)))/1024/1024||'M' 已使用,   sum(nvl(a.bytes,0))/1024/1024||'M' 剩余空间,   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_name,autoextensible from dba_data_files where autoextensible='YES';

3、查看表空间的路径
select t1.name,t2.name from v$tablespace t1,v$datafile t2 where t1.ts# = t2.ts#;


4、修改表空间
针对非大文件方式表空间,允许追加文件进行表空间的扩展,单个文件最大大小是32G 
第一种方式:表空间增加数据文件 
1)alter tablespace web01 add datafile 'D:\web01.dbf' size 30000M; 
第二种方式:表空间增加数据文件,设置自增长,限制最大值 
2)alter tablespace web01 add datafile 'D:\web01.dbf' size 500M autoextend on maxsize 8196M; 
第三种方式:已存在表空间数据文件设置自增长 
3)alter datapace datafile 'D:\web01.dbf' autoextend on maxsize 8196M; 
第四种方式:已存在表空间数据文件重新设置大小 
4)alter datapace datafile 'D:\web01.dbfF' resize 8196M; 
原创粉丝点击