1. 程式人生 > >oracle擴充套件表空間的三種方法

oracle擴充套件表空間的三種方法

1.增加資料檔案

alter tablespace tablespace_name add datafile 'd:\test\sp01.dbf' size 20m;

2.增加資料檔案的大小

alter tablespace tablespace_name 'd:\test\sp01.dbf' resize 20m;

這裡需要注意的是資料檔案的大小不超過500m;

3.設定檔案的自動增長

alter tablespace tablespace_name 'd:\sp01.dbf' autoextend on next 10m maxsize 500m;

4.查詢某表空間下有哪些資料檔案

select * from dba_data_files where tablespace_name='ARCHIVES';

5.刪除某個資料檔案

alter tablespace tablespace_name drop datafile 'd:\sp01.dbf';

6.移動資料檔案

有時,如果你的資料檔案所在的磁碟損壞時,該資料檔案將不能在使用,為了能夠重新使用,需要將這些檔案的副本移動到其他的磁碟,然後恢復。 下面以移動資料檔案sp01.dbf為例來說明: 1.確定資料檔案所在的表空間
select tablespace_name from dba_data_files where fille_name='d:\sp01.dbf';
2.使表空間離線 確保資料檔案的一致性,將表空間轉變為offline的狀態。
alter tablespace sp01 offline;
3.使用命令移動資料檔案到指定的目標位置
host move d:\sp01.dbf c:\sp01.dbf;
4.執行alter tablespace命令 在物理上移動了資料之後,還必須執行alter tablespace命令對資料庫檔案進行邏輯修改
alter tablespace sp01 rename datafile 'd:\sp01.dbf' to 'c:\sp01.dbf';
5.使表空間聯機
alter tablespace sp01 online;