How to pass parameters to export/import utility via Oracle forms using host

882 views
Skip to first unread message

Durai Rajkumar

unread,
Mar 15, 2008, 12:22:52 AM3/15/08
to Oracle...@googlegroups.com
Hi,
I know how to take imp/exp through DOS...but samething I want to do through forms..
can anyone explain, how to pass parameters to export/import utility via Oracle forms using host...

--
Regards,
Durai Rajkumar.

Adam [HUNGARY]

unread,
Mar 15, 2008, 1:41:22 PM3/15/08
to Oracle PL/SQL
> Hi,
> I know how to take imp/exp through DOS...but samething I want to do through
> forms..
> can anyone explain, how to pass parameters to export/import utility via
> Oracle forms using host...

Hello,
it depends on (version of) Windows that your forms client runs on.
(http://en.wikipedia.org/wiki/Windows_command_line)

(Oracle Forms version?! I think there is an example in Forms Help how
to use host built-in.)

An example for WinXP...

declare
vv_command varchar2(100) := 'exp userid=test/test@test';
begin
host('cmd /C '||vv_command);
end;

Hope this helps.
--
Adam

Rob Wolfe

unread,
Mar 17, 2008, 6:25:47 AM3/17/08
to Oracle PL/SQL
Adam, sorry to disagree but ...

you don't need to do anything special .. you simply enter the command
line exactly as you would in a dos box.

host('exp userid=test/test@test');

works just fine as long as your execution path is set correctly (which
it should be by the installer)

The thing that you do have to remember is ...the host command runs on
the SERVER .. not on the machine that is displaying the form.

This means that you get no feedback from the process so you have check
FORM_SUCCESS after running the command. And you are right if you guess
that this trips up a lot of people the first time they use it.

Durai Rajkumar

unread,
Mar 17, 2008, 7:08:40 AM3/17/08
to Oracle...@googlegroups.com
Hi,
Thanks for your reply..
we are using 10G forms & 9i database..winXP sevicepack2
1st i tell how we will take exp through dos...
C:\> CD ORACLE\ORA92\BIN
C:\ORACLE\ORA92\BIN> EXP DEVIIND/DEVIIND@EIS
BUFFER SIZE: 4096 > 10000
EXPDAT.DMP > C:\TEST1.DMP
(2)U, OR (3)T:(2)U >  U
EXPORT GRANTS > Y
EXPORT TABLE DATA > Y
COMPRESS CONTENTS > Y
 
I have to do the samething from forms...
IN when-button-pressed trigger i wrote

declare
vv_command varchar2(100) := 'exp deviind/deviind@eis' ;
begin
host('cmd /C:\oracle\ora92\bin '||vv_command);
end;
 
this is poping up dos window & shows like this
c:\>devsuitehome\forms\cmd >
i am not able to pass the path of cd c:\oracle\ora92\bin & exp deviind/deviind@eis
 
if i do that in manually when dos prompt opens through cmd command
like  cd c:\oracle\ora92\bin
       exp deviind/deviind@eis
i am getting error as follow :
exp-00056:ORACLE ERROR 12538 ENCOUNTERED
0RA-12538: TNS:NO SUCH PROTOCOL ADAPTER
EXP-00000: EXPORT TERMINATED UNSUCCESSFULLY....
 
please can you do the needful for me...
 
Regards
Durai Rajkumar.
--
Endrum Anbudan,
Durai Rajkumar.

Rob Wolfe

unread,
Mar 17, 2008, 8:51:58 AM3/17/08
to Oracle PL/SQL
You need to use a parameter file ...and that file will have to be
located on the SERVER

For details see

http://download.oracle.com/docs/cd/B14117_01/server.101/b10825/exp_imp.htm#sthref2246

Again .. reminding you that you do NOT need to do the 'cmd /c'
contstruct (and in fact I would recommend NOT using it)

And again reminding you that it is the server on which it will be
running ... not on your workstation .. even though that is where it
may look like it is executing.

And again reminding you that you have to check the FORM_SUCCESS value
when HOST() returns.

In other words .. I am not shocked that what you did didn't work
because it isnt correct. I would also suggest that you look at the
documentation for the HOST builtin for Oracle Forms in the Online
Help. It gives a good example of how to use the function.


On Mar 17, 7:08 am, "Durai Rajkumar" <duraai.rajku...@gmail.com>
wrote:
> Hi,
> Thanks for your reply..
> we are using 10G forms & 9i database..winXP sevicepack2
> 1st i tell how we will take exp through dos...
> C:\> *CD ORACLE\ORA92\BIN
> *C:\ORACLE\ORA92\BIN> *EXP DEVIIND/DEVIIND@EIS*
> BUFFER SIZE: 4096 > *10000*
> EXPDAT.DMP > *C:\TEST1.DMP
> *(2)U, OR (3)T:(2)U >  *U
> *EXPORT GRANTS > *Y*
> EXPORT TABLE DATA > *Y*
> COMPRESS CONTENTS > *Y*
>
> I have to do the samething from forms...
> IN when-button-pressed trigger i wrote
>
> declare
> vv_command varchar2(100) := 'exp deviind/deviind@eis' ;
> begin
> host('cmd /C:\oracle\ora92\bin '||vv_command);
> end;
>
> this is poping up dos window & shows like this
> c:\>devsuitehome\forms\cmd >
> i am not able to pass the path of cd c:\oracle\ora92\bin & exp
> deviind/deviind@eis
>
> if i do that in manually when dos prompt opens through cmd command
> like  cd c:\oracle\ora92\bin
>        exp deviind/deviind@eis
> i am getting error as follow :
> exp-00056:ORACLE ERROR 12538 ENCOUNTERED
> 0RA-12538: TNS:NO SUCH PROTOCOL ADAPTER
> EXP-00000: EXPORT TERMINATED UNSUCCESSFULLY....
>
> please can you do the needful for me...
>
> Regards
> Durai Rajkumar.
>

Adam [HUNGARY]

unread,
Mar 17, 2008, 9:24:50 AM3/17/08
to Oracle PL/SQL
> Adam, sorry to disagree but ...

> you don't need to do anything special .. you simply enter the command
> line exactly as you would in a dos box.

OK, i suggested to use 'cmd' (command interpreter on NT based systems)
because it shows the process in a window... but you can call exp/imp
utilitis without it, of course.

> The thing that you do have to remember is ...the host command runs on
> the SERVER .. not  on the machine that is displaying the form.

Actually the problem is that. The host is running on server side, in
Forms 10g we have to use client_host. (See webutil package.)

Durai, which side do you run the exp utility? Which side needs to run
under Forms?

> This means that you get no feedback from the process so you have check

Cmd is a feedback on the screen, isn't it?

> FORM_SUCCESS after running the command. And you are right if you guess
> that this trips up a lot of people the first time they use it.

Yes, we need check FORM_SUCCES... but there is no connection with exp
utility cause it is called by host. So if something happens during
export host gives back nothing about it.

--
Adam

Adam [HUNGARY]

unread,
Mar 17, 2008, 9:48:18 AM3/17/08
to Oracle PL/SQL
> Hi,
> Thanks for your reply..
> we are using 10G forms & 9i database..winXP sevicepack2

Ok, it is 10g. No needs 'cmd'. (I think under Forms 6i and Winxp we
need... i don't remember exactly.)

Which side needs to run export, server or client?

If you want to do on application server then use host built-in as Rob
explained.
If client side i suggest client_host. (Same as host but runs on
client.)
http://www.oracle.com/technology/products/forms/htdocs/webutil/webutil.htm

> IN when-button-pressed trigger i wrote
>
> declare
> vv_command varchar2(100) := 'exp deviind/deviind@eis' ;
> begin
> host('cmd /C:\oracle\ora92\bin '||vv_command);
> end;

host ('cmd /c C:\oracle\ora92\bin ' || vv_command');

("/c" if only for close the cmd window after process, you can leave
it. Forget it, it was important only in Forms version 6.)

--
Adam

Adam [HUNGARY]

unread,
Mar 17, 2008, 12:40:18 PM3/17/08
to Oracle PL/SQL
> host ('cmd /c C:\oracle\ora92\bin ' || vv_command');

Sorry, Durai, it is totally malfunctioning: backslash is missing and
there is an unneccessary apostrophe.

It works fine on WinXP via OC4J:

DECLARE
vv_command VARCHAR2 (1000)
:= ' exp test/test@test tables=(test) file=c:\temp\test.dat';
BEGIN
--host() runs at server side
HOST (vv_command);
END;

...and the alternate (client-side) version on WinXp via OC4J:

DECLARE
vv_command VARCHAR2 (1000)
:= ' exp test/test@test tables=(test) file=c:\temp
\test.dat';
BEGIN
client_host ('cmd /c ' || vv_command);
END;

Rob, it is from the Online help of Forms 10g:

"Running HOST Commands If you have a host command of the form:
HOST ('DEL c:\temp.txt')

This will work in both client/server and Web deployed environments,
but in web deployed environments the command runs on the middle tier.
If you change this to:
CLIENT_HOST('DEL c:\temp.txt') This does not work.

You must use:
CLIENT_HOST('cmd /c DEL c:\temp.txt'); You must ensure that the
command will run from the Start |Run box on Windows."

--
Adam

Rob Wolfe

unread,
Mar 17, 2008, 1:43:35 PM3/17/08
to Oracle PL/SQL
in other words ..

your original post was incorrect and your subsequent posts were
incomplete or not QUITE correct.

which was my point.

That is why we try very hard not to say on here "do it exactly like
this" because it is so easy to get things slightly wrong.(god knows I
do it all the time)

It is far better in the long run to tell someone HOW to do it ... and
where to go to get more information.

You have now posted 4 times with slightly different information each
time and only this last post was actually correct in all details.
Please do not take this as a personal criticism of you because all of
us that have posted on here for any length of time have fallen into
the same trap at one time or another. It is just an observation that
shows why we have to be so careful when holding out what we are
telling people as "the right answer".

I do want to say that it is nice to have someone pitch in with a full
answer to this because it is something that is indeed confusing and
has tripped up almost everyone at one time or another. And i really
really really want you to keep posting ... just remember that
sometimes folks just cut and paste our answers so if you post code ..
know that it has to be perfect. Which is why i rarely post code ... I
am far from perfect.

Adam [HUNGARY]

unread,
Mar 17, 2008, 7:53:37 PM3/17/08
to Oracle PL/SQL
> your original post was incorrect

Why was my first post incorrect?
We didn't know the version of Forms (i asked Durai it), we didn't know
the OS... I just tried to find out exactly what Durai needs and I gave
him an example which works. (Doesn't it?)
I placed emphasis on how to pass parameters (it was Durai's question),
that's why i put exp and a parameter together into a variable.

> and your subsequent posts were
> incomplete or not QUITE correct.

I agree, my 2nd and 3rd posts were unwanted cause i just guessed by
memory.

> which was my point.
>
> That is why we try very hard not to say on here "do it exactly like
> this"

We still don't know what he exactly wants to do through Forms.
(On client-side or server-side?)

> I do want to say that it is nice to have someone pitch in with a full
> answer to this because it is something that is indeed confusing and
> has tripped up almost everyone at one time or another. And i really
> really really want you to keep posting ... just remember that
> sometimes folks just cut and paste our answers so if you post code ..
> know that it has to be perfect. Which is why i rarely post code ... I
> am far from perfect.

OK, i absolutely understand you.

Durai, did you get an answer?

--
Adam
Reply all
Reply to author
Forward
0 new messages