六步了解Oracle表空間狀態(tài)
本人很喜歡Oracle表空間,在工作中也很喜歡總結(jié)關(guān)于Oracle表空間狀態(tài)的經(jīng)驗(yàn)教訓(xùn),下面就這個(gè)問題來詳細(xì)說說吧。
1、查詢Oracle表空間狀態(tài)
- select tablespace_name,status from dba_tablespaces;
 
2、更改Oracle表空間狀態(tài)
- alter tablespace book offline/online/read only/read write;
 
離線/在線/只讀/讀寫
3、數(shù)據(jù)文件移動(dòng)
- select tablespace_name,file_name from dba_data_files;
 - alter tablespace book offline;
 
將要修改的文件移動(dòng)到新目錄下
- alter tablespace book rename datafile '/u01/oradata/oracle8i/sales01.dbf' to '/u02/oradata/oracle8i/sales01.dbf';
 
4、修改數(shù)據(jù)文件的online/offline屬性
archivelog模式下
- alter database datafile '/u01/oradata/oracle8i/sales01.dbf' offline;
 
noarchivelog模式下
- alter database datafile '/u01/oradata/oracle8i/sales01.dbf' offline drop;
 
5、數(shù)據(jù)字典表空間與本地化管理表空間的轉(zhuǎn)化為
- select tablespace_name,extent_management,allocation_type from dba_tablespace;
 - exec dbms_space_admin.tablespace_migrate_to_local('book')
 
系統(tǒng)表空間system和臨時(shí)表空間temp不得轉(zhuǎn)換
- exec dbms_space_admin.tablespace_migrate_from_local('book')
 
6、刪除表空間
- drop tablespace student including contents;
 
including contents將表空間及實(shí)體刪除
- create table test(id number(3)) tablespace test_tablesapce;
 
以上介紹Oracle表空間狀態(tài),這里我發(fā)表一下個(gè)人理解,和大家討論討論。
【編輯推薦】















 
 
 


 
 
 
 