Home » Infrastructure » Windows » import a dmp file (Oracle, 9.2.0.6.0, winXP)
import a dmp file [message #339777] Fri, 08 August 2008 08:02 Go to next message
samfuerte
Messages: 7
Registered: May 2008
Junior Member
Does anyone know how can we make touser parameter in imp as a variable so if the script is run by someone as a part of a patch to be able to declare the user he wants to import the dmp file into?
Is possible something like this?
Re: import a dmp file [message #339784 is a reply to message #339777] Fri, 08 August 2008 08:19 Go to previous messageGo to next message
Michel Cadot
Messages: 68641
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Yes, use a variable in your batch: "touser=%MYUSERVAR%"

Regards
Michel
Re: import a dmp file [message #339786 is a reply to message #339784] Fri, 08 August 2008 08:26 Go to previous messageGo to next message
samfuerte
Messages: 7
Registered: May 2008
Junior Member
Thank you Michel.
Re: import a dmp file [message #340106 is a reply to message #339784] Mon, 11 August 2008 08:32 Go to previous messageGo to next message
samfuerte
Messages: 7
Registered: May 2008
Junior Member
Actually I used touser=%MYUSERVAR% in imp syntax and it didn't work. Maybe I should use some special chars in it?

Thanks
Re: import a dmp file [message #340110 is a reply to message #340106] Mon, 11 August 2008 08:43 Go to previous messageGo to next message
Michel Cadot
Messages: 68641
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
You have to set the variable.
If you don't post what you actually did we can't help.

Regards
Michel
Re: import a dmp file [message #340136 is a reply to message #340110] Mon, 11 August 2008 10:39 Go to previous messageGo to next message
samfuerte
Messages: 7
Registered: May 2008
Junior Member
ok I found it in command shell help:
echo put touser
set /p touser=
and then in imp script you set touser=%touser%

thanks again
Re: import a dmp file [message #340139 is a reply to message #340136] Mon, 11 August 2008 11:26 Go to previous messageGo to next message
Michel Cadot
Messages: 68641
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
You can also directly use:
set /p touser="touser? "
and remove the "echo" line.

Regards
Michel

Re: import a dmp file [message #340580 is a reply to message #340139] Wed, 13 August 2008 06:07 Go to previous messageGo to next message
samfuerte
Messages: 7
Registered: May 2008
Junior Member
Thanks Michel,
I need to ask one more question. I have created a sql script like this:

clear SCR

prompt
prompt Updating TABLE table
prompt ==========================
prompt

SET ECHO OFF
SET VERIFY OFF
set feedback off
SET serveroutput ON
prompt

prompt
prompt
prompt Checking table ...
prompt

set termout off

DECLARE
v_exist number;

BEGIN
v_exist := -1;

select COUNT(*)
INTO v_exist
FROM TABLE t
WHERE t.columnA='STP';

IF v_exist=0 THEN
............;
else
............;
END IF;

END;
/
COMMIT;

I want in the IF statement to add the sqlldr (HOST sqlldr &&CONN_STRING sam.ctl). Ctl file inserts one row in TABLE table.
Is it possible?
Any idea if and how can I do that?

Thanks in advance.
Sam
Re: import a dmp file [message #340582 is a reply to message #340580] Wed, 13 August 2008 06:12 Go to previous message
Littlefoot
Messages: 21807
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Quote:
Ctl file inserts one row in TABLE table.

This "one row" is in a file, right? Instead of calling an operating system command (which SQL*Loader, in a way, is) from PL/SQL, wouldn't you, rather, use Oracle's external tables feature?

It would make this task very simple (as you'd use an INSERT INTO ... SELECT ... FROM external_table).
Previous Topic: [Oracle8.1 Client] Silent install
Next Topic: the stupid TNS Listener!
Goto Forum:
  


Current Time: Thu Apr 18 00:00:51 CDT 2024