方法一:
exp ... imp
expdp ....impdp
--->影响应用,速度慢,安全
方法二:
move
--->简单,但是需要2倍磁盘空间来处理
方法三:
建立一个存放行迁移的表
SQL> @?/rdbms/admin/utlchain.sql
Table created.
SQL> desc chained_rows
Name Null? Type
----------------------------------------- -------- ----------------------------
OWNER_NAME VARCHAR2(30)
TABLE_NAME VARCHAR2(30)
CLUSTER_NAME VARCHAR2(30)
PARTITION_NAME VARCHAR2(30)
SUBPARTITION_NAME VARCHAR2(30)
HEAD_ROWID ROWID
ANALYZE_TIMESTAMP DATE
SQL> analyze table scott.dept list chained rows;
Table analyzed.
建立中间表暂时存放迁移的数据
SQL> create table dept_bak as
2 select * from scott.dept where rowid in
3 (select HEAD_ROWID from chained_rows);
Table created.
删除原来表中所有的行迁移的行:
SQL> delete from scott.dept where rowid in (select HEAD_ROWID from chained_rows);
再将被删除的行从中间表中反插回去
insert into scott.dept select * from dept_bak;
commit;
如何处理行迁移?
最新推荐文章于 2024-05-24 06:35:14 发布