oracle 大数据量表迁移,备份

 

原表数据 table1  , 177万

需要迁移 并备份 到 table2

首先创建原始表 table2,保证字段跟 table1 一致

依次执行以下sql ,  关闭 日志
create table OA.CRM_DL_DELIVERY_TMP as select * from OA.CRM_DL_DELIVERY where 1=2;

alter table table2 nologging; 

insert  into table2 select * from table1; 

commit; 

注意:使用insert语句时一定要commit,否则写不进数据库中。

alter table table2 logging;

上面如果不关闭日志,会产生大量归档日志。删除索引约束后可能要好点。数据量大有风险,可能会导致归档日志撑爆。

简单几步,便可以分分钟进行数据备份了。

猜你喜欢

转载自blog.csdn.net/qq_41165981/article/details/112171797
今日推荐