oracle數據庫之----表空間相關操作

1.創建表空間
SQL> create tablespace testspace
datafile 'd:/OracleTest/test001.dbf' size 10m autoextend on next 5m maxsize unlimited
extent management local ;

2.給表空間添加文件
SQL> alter tablespace testspace add datafile 'd:/OracleTest/test002.dbf' size 5m
autoextend on next 3m maxsize 50m;

3.刪除表空間中的文件
SQL> alter tablespace testspace drop datafile 'd:/OracleTest/test002.dbf';

4.修改表空間文件的大小
SQL> alter database datafile 'd:/OracleTest/test001.dbf' resize 10m;

5.修改表空間文件的自動增長屬性
SQL> alter database datafile 'd:/OracleTest/test001.dbf' autoextend off;

6.修改表空間的讀寫屬性
SQL> alter tablespace testspace read only;(只讀)
SQL> alter tablespace testspace read write;(讀寫)

7.設置表空間脫/聯機
SQL> alter tablespace testspace offline;
SQL> alter tablespace testspace online;

8.轉移物理文件路徑的操作
(1)設置表空間脫機alter tablespac testspace offline;
(2)物理轉移表空間文件;即把你的表空間物理文件轉移到你想移動的路徑
(3)邏輯轉移:alter tablespace testspace rename  datafile  'd:/OracleTest/test001.dbf' to 'e:/test001.dbf';
(4)設置表空間聯機alter tablespace testspace online;

9.刪除表空間
(1)不刪文件drop tablespace testspace;
(2)刪除文件drop tablespace testspace including contents and datafiles;

10.物理文件被非法刪除時,怎樣啓動數據庫
(1)關閉數據庫服務   shutdown
(2)alter database datafile 'd:/test001.dbf' offline drop;
(3)alter database open;
(4)開啓數據庫服務startup;
 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章