从oracle转储文件导入特定表? [英] Import specific tables from oracle dump file?

查看:160
本文介绍了从oracle转储文件导入特定表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个巨大的oracle数据库的转储,因此不可能全部导入.我想导入一个名为X的特定表.问题是X具有外键.如果仅导入X,则会出现以下错误:

I have a dump of a huge oracle database so it is impossible to import it all. I want to import a specific table called X. The problem is that X has foreign keys. If I import just X, I will get the following error:

imp user/pass@dbName tables=X  rows=y ignore=Y
ORA-02291: integrity constraint violated - parent key not found

我已经在本地拥有整个数据库(但是没有数据),我想导入与X关联的所有表.如何实现呢?我已经安装了plsql.我还需要知道这些表的顺序,才能首先知道要导入哪个表.

I already have the whole db locally (but without data), I want to import all tables that are associated to X. How can I achieve that? I have plsql installed. I also need to know the order of these tables to know which to import at first.

推荐答案

问题很少,所以我将尝试一个一个地回答.

There are few questions so I will try to answer one by one.

ORA-02291: integrity constraint violated - parent key not found

不用担心,因为您知道您没有表X的父记录.顺便说一句,您可能还想使用标记CONSTRAINTS=N,因为您已经说了数据库.

No brainer to guess this because as you know you don't have parent record for table X. By the way you may also want to use flag CONSTRAINTS=N because you already have db as you said.

我要导入与X关联的所有表.如何实现?"

"I want to import all tables that are associated to X. How can I achieve that?"

别无选择,只能手动查找所有依赖项(或使用数据字典表user_cons_columnsuser_constraints等进行查找)并导入这些表.如果不这样做,请考虑一下.您将破坏数据完整性.如果您仍然希望表X中的数据没有依赖项,请禁用约束,然后导入.但是您不会再启用约束,而且我也不知道要对损坏的数据做什么.

Well no option but to find all the dependencies manually (or use data dictionary tables user_cons_columns, user_constraints etc to lookup) and import those tables as well. Think of it if you don't do that. You will break your data integrity. If you still want that data in table X without dependencies then disable the constraints and then import. But you won't be enable your constraint again and I don't know what you want to do with broken data.

我还需要知道这些表的顺序,以便首先了解要导入的表."

"I also need to know the order of these tables to know which to import at first."

在导入之前禁用约束,然后在导入之后启用它们.在这种情况下,您不必担心顺序.

Disable the constraints before import and then enable them after import. You don't have to worry about order in that case.

这篇关于从oracle转储文件导入特定表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆