分享java带来的快乐

我喜欢java新东西

当数据删除时,怎么缩小相应的表空间

1.检查数据库表空间占用空间情况:

select tablespace_name,sum(bytes)/1024/1024/1024 GB
from dba_data_files group by tablespace_name
union all
select tablespace_name,sum(bytes)/1024/1024/1024 GB
from dba_temp_files group by tablespace_name order by GB;

2.确认文件
select file_name,bytes/1024/1024 from dba_data_files
where tablespace_name like 'USERS';

3.检查UNDO Segment状态
select usn,xacts,rssize/1024/1024/1024,hwmsize/1024/1024/1024,shrinks
from v$rollstat order by rssize;

3.创建新用户表空间
CREATE TABLESPACE USERS DATAFILE '/opt/oracle/oradata/insight/users_01.dbf' SIZE 128M REUSE
AUTOEXTEND ON NEXT 1280K
MINIMUM EXTENT 128K
DEFAULT STORAGE ( INITIAL 128K NEXT 128K MINEXTENTS 1 MAXEXTENTS 4096 PCTINCREASE 0);
4.改变默认用户表空间
alter database default tablespace NEWUSERS;
5.删除Users表空间
drop tablespace USERS including contents and datafiles

posted on 2007-03-07 13:41 强强 阅读(593) 评论(0)  编辑  收藏 所属分类: Oracle数据库


只有注册用户登录后才能发表评论。


网站导航: