Simon said:
If we have the dmp file, is it possible to extract just 1 table from the dmp file ?
In Oracle, we refer to the results of an export as a "dump file" (or, as you call it, a "dmp" file). The problem with using a dump file is that it allows you to only "restore" a table, not "recover" a table. This means that if you use that version of your corrupted table's data that you will be pushing that table "back" in time to its state at the time that you did the export.
If that is acceptable to you and your organisation, then importing that single table is certainly the easiest scenario for restoring that table.
Another condition for your importing that table to be an acceptable scenario is that the "corruption" that you are experiencing cannot be a "hard corruption" on your disk media. That is, the problem that you had with the corrupted table must not have resulted from a physical defect on the magnetic surface of the disk drive.
The other issue with which you must deal on the corrupted table is that of referential integrity: Are there child tables that have Foreign Keys that point to the corrupted table? If so, you must alter those child tables to get rid of their Foreign Keys that point to the corrupted table:
Code:
ALTER <child-table-name> DROP CONSTRAINT <FK-constraint name>;
You must later re-create the Foreign Key constraint once we have restored the parent table.
If you have met all of the above conditions, then, yes, you can restore a single table from your dump file. You should first DROP the corrupted table:
Code:
DROP TABLE <corrupted-table name>;
Next, (not from SQL, but from the operating-system prompt) you issue an import command (in a form similar to the following), on a single o/s command line:
Code:
[o/s prompt] imp buffer=15000000 grants=y feedback=1000 tables=<name of corrupted table> file=<fully qualified dump-file name> userid=<username/password of exporting user>
Once the import is complete, re-create the Foreign Keys on the child tables (as I mentioned above) and you should be good to go.
Let us know how this works for you.
![[santa] [santa] [santa]](/data/assets/smilies/santa.gif)
Mufasa
(aka Dave of Sandy, Utah, USA)
[I can provide you with low-cost, remote Database Administration services: see our website and contact me via
www.dasages.com]