oracle移動表
oracle移動表
在創建表時可以為表指定存儲空間,如果不指定,oracle會將該表存儲到默認的表空間中。根據需要可以將表從一個表空間移動到另一個表空間中。語法如下:
alter table table_name move tablespace tablespace_name;
SQL> select table_name,tablespace_name from user_tables;
TABLE_NAME
----------------------------------------
TABLESPACE_NAME
------------------------------
USERS
USERS
STUDENT
USERS
MESSAGE
USERS
如上所示,在該用戶的tablespace中有三張表,他們都位於users表空間中,
使用該語句移動student表:
SQL> alter table student move tablespace testspace;
表已更改。再次查詢
SQL> select table_name,tablespace_name from user_tables;
TABLE_NAME
----------------------------------------
TABLESPACE_NAME
------------------------------
USERS
USERS
MESSAGE
USERS
STUDENT
TESTSPACE