【每天进步一点点】 Oracle如何导入带有约束关系的数据

前端之家收集整理的这篇文章主要介绍了【每天进步一点点】 Oracle如何导入带有约束关系的数据前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

这篇文章对于熟悉Oracle的老手老说,可以略过,作为新手,要进行数据库备份和恢复,不得不面对一个新的问题,那就是导入数据后,因为外键关系,导致了数据导入不全。现在来介绍一下如何解决这个问题。

1、备份数据库

2、导入表结构
3、禁用约束

理由该语句获得Sq语句禁用约束

1   alter table BM_USER_SYS_SORT disable constraint FK_USER_SYS_SORT_SYSID;
2   alter table BUSI_FORESTPOLICE disable constraint BUSI_FORESTPOLICE_DQCODE_FK;
3   alter table BUSI_FORESTRYINDUSTRY disable constraint BUSI_FORESTRY_DQCODE_FK;
4   alter table BUSI_MULTICOOPERATION disable constraint BUSI_COOP_DQCODE_FK;
5   alter table BUSI_TECHNOLOGY disable constraint BUSI_TECHNOLOGY_DQCODE_FK;
6   alter table BS_USER disable constraint FK_BSUSER_UNITID;
7   alter table BS_USER disable constraint FK_BSUSERID;
8   alter table BUSI_DESERTIFICATION disable constraint BUSI_BUSI_DESERTID_SMHLX_FK;
9   alter table BUSI_FORESTPOLICE disable constraint BUSI_FORESTPOLICE_DIC_ID_FK;
10  alter table BUSI_GYL disable constraint BUSI_GYLY_TYPE_TYPEID_FK;
11  alter table BUSI_LAWSSTATUTE disable constraint BUSI_LAWSSTATUTE_DIC_ID_FK;
12  alter table BUSI_PLEVEL disable constraint BUSI_PLEVEL_FK;
13  alter table BUSI_YZLZHHC disable constraint BUSI_YZLZHHC_YLCS_FK;
14  alter table BUSI_ZHGL_QLZR disable constraint BUSI_ZHGL_QLZRBH;
15  alter table BUSI_WLFOREASTFARM disable constraint FK_FOREASTFARM;
16  alter table BUSI_WLFOREASTPARK disable constraint FK_WLFOREASTPARK;
17  alter table BUSI_WLPARK disable constraint FK_WLPARK;
18  alter table BUSI_WLPROTECTAREA disable constraint FK_WLPROTECT;
19  alter table SYS_FUNC_EXT disable constraint SYS_FUNC_TYPE_FK;

4、导入数据
5、启用约束

猜你在找的Oracle相关文章