Tuesday, 10 July 2007

Oracle Import/Export 2: IMP

For getting data back into Oracle that you have previously exported from Oracle using using the EXP command, you need to use the IMP Command. Below I have given a couple of examples of how to use the IMP command.

To IMPORT a complete database, open a Command Shell and type the following:


IMP USERID=USERNAME/PASSWORD@DATABASENAME COMMIT=Y FEEDBACK=10000 FULL=Y FILE=C:\EXPORTFILE.DMP INDEXES=Y DESTROY=Y ROWS=Y LOG=LOG=C:\IMPORTFULL.LOG

For this to work you do of course have to DROP the database before the import.

To IMPORT one database table, open a Command Shell and type the following:

IMP USERID=USERNAME/PASSWORD@DATABASENAME COMMIT=Y FEEDBACK=10000 TABLES=(TABLENAME) FILE=C:\EXPORTSINGLEFILE.DMP INDEXES=Y DESTROY=Y ROWS=Y LOG=C:\IMPORTSINGLEFILE.LOG

And in this case you need to drop the table before importing, ie: Open SQLPlus and issue the following command:

drop table TABLENAME;

“And how is education supposed to make me feel smarter? Besides, every time I learn something new, it pushes some old stuff out of my brain. Remember when I took that home winemaking course, and I forgot how to drive?” - Homer Simpson

No comments: