oracle 表移动表空间

简介: 在oracle中有时需要把表移动到其他表空间中,下面是移动的步骤。 首先,使用下面的命令移动: alter table table_name move tablespace tablespace_name; 然后,如果有索引的话必须重建索引: alter index index_name rebuild tablespace tablespace_name; 需要注意的地方是: 1、若表中需要同时移动lob相关字段的数据,就必需用如下的含有特殊参数据的语句来完成。

在oracle中有时需要把表移动到其他表空间中,下面是移动的步骤。
首先,使用下面的命令移动:
alter table table_name move tablespace tablespace_name;
然后,如果有索引的话必须重建索引:
alter index index_name rebuild tablespace tablespace_name;

需要注意的地方是:
1、若表中需要同时移动lob相关字段的数据,就必需用如下的含有特殊参数据的语句来完成。

alter table tb_name move tablespace tbs_name lob (col_lob1,col_lob2) store as(tablesapce tbs_name);

如果表特别多,可以生产一个执行的脚本。
select 'alter index '||OWNER||'.'||index_NAME||' rebuild tablespace tablespace_name;' from dba_indexes where OWNER='USERS';
select 'alter table '||OWNER||'.'||TABLE_NAME||' move tablespace tablespace_name;' from dba_tables where OWNER='USERS';

相关文章
|
2月前
|
存储 Oracle NoSQL
Oracle 表空间、数据文件、schema的关系
Oracle 表空间、数据文件、schema的关系
32 2
|
6月前
|
Oracle 关系型数据库 数据库
9-4 Oracle管理表空间和数据文件
9-4 Oracle管理表空间和数据文件
|
7月前
|
SQL 监控 Oracle
Oracle创建和管理表空间
Oracle创建和管理表空间
59 1
|
3月前
|
Oracle 关系型数据库 数据库
Oracle查询优化-复制表的定义及数据
【1月更文挑战第5天】【1月更文挑战第14篇】在Oracle数据库中,复制表定义和复制表数据是两个常见的操作。
50 1
|
7月前
|
存储 SQL Oracle
Oracle数据库批量删除表、视图、序列、存储过程、函数脚本
Oracle数据库批量删除表、视图、序列、存储过程、函数脚本
68 0
|
1月前
|
存储 Oracle 关系型数据库
Oracle系列之七:表的创建与管理
Oracle系列之七:表的创建与管理
|
1月前
|
Oracle 关系型数据库 数据库
Oracle系列之五:Oracle表空间
Oracle系列之五:Oracle表空间
|
4月前
|
SQL Oracle 关系型数据库
Oracle查看表空间 及表空间是否需要扩展
Oracle查看表空间 及表空间是否需要扩展
26 0
|
4月前
|
Oracle 关系型数据库
Oracle - 表操作语句
Oracle - 表操作语句
25 0
|
7月前
|
Oracle 关系型数据库 数据库
Oracle数据库 查询所有表
Oracle数据库 查询所有表
116 1

推荐镜像

更多