Problem solve Get help with specific problems with your technologies, process and projects.

Importing via a VB program

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:

  1. 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?
  2. 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=y
If 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

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.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.