Import specific tables from oracle dump file?

I have a dump of a huge oracle database, so it cannot be imported. I want to import a specific table named X. The problem is that X has foreign keys. If I import only 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 

I already have all the db locally (but without data), I want to import all the tables related to X. How can I achieve this? I have plsql installed. I also need to know the order of these tables in order to know for import first.

+6
source share
2 answers

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

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

There is nothing to guess, because, as you know, you do not have a parent record for table X. By the way, you can also use the CONSTRAINTS=N flag, because you already have db, as you said.

"I want to import all tables related to X. How can I achieve this?"

Well, there is no option but to find all the dependencies manually (or use user_cons_columns , user_constraints , etc. data dictionary tables for searching) and import these tables. Think about it if you do not. You will violate data integrity. If you still need this data in table X with no dependencies, disable the restrictions and then import. But you wonโ€™t be able to turn on your restriction again, and I donโ€™t know what you want to do with the broken data.

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

Disable restrictions before importing, and then enable them after importing. In this case, you do not need to worry about the order.

+1
source

You will disable all DB restrictions before importing and enable them again. Cm:

+3
source

Source: https://habr.com/ru/post/922198/


All Articles