I am using Visual Basic to invoke the Oracle 'imp' utility to import a .dmp file into a Oracle 9.1 database. I
have two questions:
- Since I am invoking this program (imp.exe) from Visual Basic, how do I suppress the command dialog that comes up when I run imp.exe?
- I would like to display the status of the import in my Visual Basic program, so how do I get the current status of the import from imp.exe?
If you invoke the IMP utility with no command line options, then IMP will prompt you for more information. This is the dialog that you are hoping to avoid so that you can script running IMP from within your VB program. This can be done quite simply by providing all of the options on the command line for IMP. For instance, a call to IMP might look like the following:
imp.exe userid=system/manager file=exp.dmp full=yIf you provide these options on the command line, IMP will not prompt you for them.
Getting the current status of IMP is much harder. You can force IMP to write information to a log file with the 'log=filename.log' option on the command line. And you can read this log file at any time. The unfortunate problem with this is that the IMP utility will store the log in a small buffer and only write to that log once this buffer fills up. So reading the log file can be behind.
If you know which tables are being imported, then you can query DBA_TABLES to see if they have been created. The last table that is being imported, that is also in DBA_TABLES, is the table that IMP is currently working on. This assumes that you have not precreated the tables and are importing with IGNORE=Y.
If the table that is being imported is very large, you can query V$SESSION_LONGOPS for the import session. This isn't always accurate as short running operations (i.e. importing small tables) won't appear in this list of long operations.
Finally, depending on how you code your VB program, you may be able to capture the output of the IMP utility similar to capturing the utilities output to standard out. This way, you can get the information as it would appear on your screen.
Unfortunately, there is no quick and easy way for your VB program to see the current status of the IMP utility.
For More Information
- Dozens more answers to tough Oracle questions from Brian Peasland are available.
- The Best Oracle Web Links: tips, tutorials, scripts, and more.
- Have an Oracle or SQL tip to offer your fellow DBAs and developers? The best tips submitted will receive a cool prize. Submit your tip today!
- Ask your technical Oracle and SQL questions -- or help out your peers by answering them -- in our live discussion forums.
- Ask the Experts yourself: Our PL/SQL, database administration and data warehousing gurus are waiting to answer your toughest questions.
Dig deeper on Oracle database design and architecture
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.