Q

Importing via a VB program

This Content Component encountered an error

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


This was first published in August 2003

Dig deeper on Oracle database design and architecture

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

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.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide

SearchDataCenter

SearchContentManagement

SearchFinancialApplications

Close