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

相关内容