修改表空間尺寸

2021-07-05 18:49:58 字數 892 閱讀 7747

第一步:檢視所有表空間及表空間大小:

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

第二步:檢視所有表空間對應的資料檔案:

select tablespace_name,file_name from dba_data_files;

第三步:修改資料檔案大小

alter database datafile 'h:\oracle\product\10.1.0\oradata\oracle\users01.dbf' resize 10240m; 

or 新增資料檔案到表空間

alter tablespace users add datafile 'd:\oracle\oradata\orcl\users02.dbf' size 10g;

注意:在linux作業系統下,資料庫檔案應該在opt目錄下

select a.tablespace_name "表空間名",total 表空間大小,free 表空間剩餘大小,

(total-free) 表空間使用大小,

round((total-free)/total,4)*100 "使用率 %"

from (select tablespace_name,sum(bytes) free from dba_free_space

group by tablespace_name ) a,

(select tablespace_name,sum(bytes) total from dba_data_files

group by tablespace_name) b

where a.tablespace_name=b.tablespace_name

修改表的表空間

表做表空間遷移 alter table tb name move tablespace tbs name 索引表空間做遷移 alter index index name rebuild tablespace tbs name 對於含有 lob欄位的表,在建立時,oracle 會自動為 lob欄位建立...

修改表空間大小

修改表空間大小有兩種方法 一是修改當前資料檔案大小 alter database tempfile data hybzdb tempfile temp.263.792523499 resize 3g 說明 data hybzdb tempfile temp.263.792523499是乙個資料檔案的...

修改oracle表空間

修改oracle表空間 檢視表空間的位置 select a.tablespace name,b.file name,a.block size,a.block size,b.bytes 1024 1024 sum mb from dba tablespaces a,dba data files b w...