當(dāng)數(shù)據(jù)刪除時(shí),怎么縮小相應(yīng)的表空間
1.檢查數(shù)據(jù)庫(kù)表空間占用空間情況:
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.確認(rèn)文件
select file_name,bytes/1024/1024 from dba_data_files
where tablespace_name like 'USERS';
3.檢查UNDO Segment狀態(tài)
select usn,xacts,rssize/1024/1024/1024,hwmsize/1024/1024/1024,shrinks
from v$rollstat order by rssize;
3.創(chuàng)建新用戶表空間
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.改變默認(rèn)用戶表空間
alter database default tablespace NEWUSERS;
5.刪除Users表空間
drop tablespace USERS including contents and datafiles
posted on 2007-03-07 13:41 強(qiáng)強(qiáng) 閱讀(610) 評(píng)論(0) 編輯 收藏 所屬分類: Oracle數(shù)據(jù)庫(kù)