Home » Developer & Programmer » Forms » Executing imp command through a form
Executing imp command through a form [message #303884] Mon, 03 March 2008 02:18 Go to next message
alister
Messages: 101
Registered: August 2007
Location: India
Senior Member
Hi Everybody
I want to Know if the given statement below can be executed in a form.
host ('\\accdatserver\d\oracle\ora81\bin\imp.EXE estt/prime@afrestpj ile=\\accappser\e\dump\afres270208.dmp fromuser=prime touser=estt ignore=y');

If yes please let me know how to do it, I also want to use the file name 'afres270208.dmp' of the example as a variable.

Thank you

Alister
Re: Executing imp command through a form [message #303886 is a reply to message #303884] Mon, 03 March 2008 02:22 Go to previous messageGo to next message
alister
Messages: 101
Registered: August 2007
Location: India
Senior Member
Hi to all once again

The host command should be

host ('\\accdatserver\d\oracle\ora81\bin\imp.EXE estt/prime@afrestpj file=\\accappser\e\dump\afres270208.dmp fromuser=prime touser=estt ignore=y');

It was wrong typed as ile for file

Thank you


Alister
Re: Executing imp command through a form [message #304054 is a reply to message #303886] Mon, 03 March 2008 22:21 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
Have you tried it?

David
Re: Executing imp command through a form [message #304087 is a reply to message #304054] Tue, 04 March 2008 00:22 Go to previous messageGo to next message
Littlefoot
Messages: 20891
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
As I understood it, "ile" instead of "file" was the problem (which is now resolved).
Re: Executing imp command through a form [message #304671 is a reply to message #303884] Thu, 06 March 2008 01:37 Go to previous messageGo to next message
alister
Messages: 101
Registered: August 2007
Location: India
Senior Member
Hi Everybody

I tried out the command, there is just a flicker on the screen but no import takes place. I do not know what could be the problem.

Alister.
Re: Executing imp command through a form [message #305762 is a reply to message #304671] Tue, 11 March 2008 22:37 Go to previous messageGo to next message
alister
Messages: 101
Registered: August 2007
Location: India
Senior Member
Hi Everybody

Can anyone tell me if there is a way to use the imp command using a form. I want to decentralise the operation. Now only an administrator is able to do it. If I could use it through a form then I could ask the end users to do it themselves.

Thank you,

Alister.
Re: Executing imp command through a form [message #307431 is a reply to message #305762] Tue, 18 March 2008 20:21 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
Have you searched this forum for 'host cmd'?

Is it wise to let the users import data?

David
Re: Executing imp command through a form [message #307583 is a reply to message #303884] Wed, 19 March 2008 03:46 Go to previous messageGo to next message
alister
Messages: 101
Registered: August 2007
Location: India
Senior Member
Hello David,

Thanks for you reply. What is being done is that a few records from a table is send as a dmp file because there is no physical connection between a data base called PRIME and another data base called AFRES to which the data has to be inserted. So as and when there are new records created in PRIME a dmp file is created and send. This dmp file is inserted into AFRES for the end users. So everytime a dmp file arrives the administrator has to import it. Thus I thought that if a form can be created then any end user can import it without having to logon to the data base server. If there is anyother way of doing this operation please let me know. I am using oracle 8.1.7

Thanks again

Alister
Re: Executing imp command through a form [message #307764 is a reply to message #307583] Wed, 19 March 2008 18:05 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
Give each dump file a unique name, copy/move them to a 'known' location on the second machine, run a 'kron' job, get it to rename the file and do the import for you.

Alternatively, extract the new records as 'insert' statements (see TOAD for an example of what this may look like), copy the file to a 'known' location on the second machine, run a 'dbms_job' which will take these files and run the 'insert' statements in a SQL/Plus session.

David
Re: Executing imp command through a form [message #308568 is a reply to message #303884] Mon, 24 March 2008 22:51 Go to previous messageGo to next message
alister
Messages: 101
Registered: August 2007
Location: India
Senior Member
Thank you Sir,

I shall try out the second option.What is a kron job.


Thanks once again

Alister
Re: Executing imp command through a form [message #309236 is a reply to message #308568] Wed, 26 March 2008 19:23 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
My apologies. It should be 'cron'. Its a Unix thing and I don't do Unix.

David
Re: Executing imp command through a form [message #309801 is a reply to message #303884] Fri, 28 March 2008 20:56 Go to previous messageGo to next message
amdabd
Messages: 91
Registered: November 2007
Location: My Computer
Member
hi,
create your backup folder [i.e: 'c:\backup'],
on a PushButton [ WHEN-BUTTON-PRESSED] insert the following code
declare
  alrt         number;
  v_directory  varchar2(200) := 'c:\backup';
-------
  path          varchar2(100):='back_up'||to_char(sysdate,'dd-mm-yyyy-hh-mi-ss');
v_exp varchar2(200) := 'exp scott/tiger@orcl file = '
                       ||v_directory||'\'||path
                       ||'.dmp owner=scott grants=yes';  --for specify user use owner=user
-------
begin 
	host(v_exp);
if form_success then
	
set_alert_property('msg',alert_message_text,'Form success');
alrt:=show_alert('msg');
else
    message('there are errors ');
end if; 
end;

------
enjoy it
---------------------------------
Quote:
Executing imp command through a form
I'm sorry
however I still enjoy it

[Updated on: Tue, 06 May 2008 19:13] by Moderator

Report message to a moderator

Re: Executing imp command through a form [message #310409 is a reply to message #303884] Tue, 01 April 2008 02:48 Go to previous messageGo to next message
alister
Messages: 101
Registered: August 2007
Location: India
Senior Member
Hi amdabd

I shall try enjoy the script that you have given me and get back to you with some feed back later. Thank you very much for the same.

Alister
Re: Executing imp command through a form [message #313912 is a reply to message #303884] Tue, 15 April 2008 03:00 Go to previous messageGo to next message
alister
Messages: 101
Registered: August 2007
Location: India
Senior Member
Hi amdabd
I believe that the imp command can work only on the machine that oracle is installed. I think that it cannot be invoked from another machine, because when I try to execute it from another machine there is only a flicker and nothing happens.

Thanks to all my friends

Alister
Re: Executing imp command through a form [message #313928 is a reply to message #303884] Tue, 15 April 2008 03:45 Go to previous messageGo to next message
dillango
Messages: 145
Registered: January 2008
Senior Member
Mr.alister,

Did you tried after instllaing the database client?.

While importing, if the same table exist with valid data, how did you come across the import errors like table creation error, referential intergrity, order of the table import etc..?

Ilango


Re: Executing imp command through a form [message #313946 is a reply to message #303884] Tue, 15 April 2008 05:10 Go to previous messageGo to next message
irfan.ocp
Messages: 29
Registered: February 2008
Location: Karachi, Pakistan
Junior Member
Dear Alister.

Oracle Export/Import/Sqlldr Command only execute on those PC where Oracle Client or Oracle Database or Specific Component had installed.

Best Option in my view that you installed the Oracle Client which will take less Space as compared to other.

Best Regards,
Muhammad Irfan Bakali.
Re: Executing imp command through a form [message #314182 is a reply to message #303884] Wed, 16 April 2008 00:03 Go to previous messageGo to next message
alister
Messages: 101
Registered: August 2007
Location: India
Senior Member
Dear Muhammad Irfan Bakali.

Thank you for your suggestion. I shall install the client on a machine and try it out.


Thank you

Alister.
Re: Executing imp command through a form [message #317853 is a reply to message #303884] Sun, 04 May 2008 05:04 Go to previous messageGo to next message
mudabbir
Messages: 235
Registered: April 2006
Location: Kuwait
Senior Member

Quote:
Hello David,

Thanks for you reply. What is being done is that a few records from a table is send as a dmp file because there is no physical connection between a data base called PRIME and another data base called AFRES to which the data has to be inserted. So as and when there are new records created in PRIME a dmp file is created and send. This dmp file is inserted into AFRES for the end users. So everytime a dmp file arrives the administrator has to import it. Thus I thought that if a form can be created then any end user can import it without having to logon to the data base server. If there is anyother way of doing this operation please let me know. I am using oracle 8.1.7

Thanks again

Alister


Hi Alister,

From what i understood above. This is what i have in mind.

1. Create a folder on the "C" drive or any other drive of your "PRIME" server.create the same folder on your "AFRES" server also in the same drive.

2. Create a batch file(.BAT file) on your "PRIME" server in the folder which you have created and write the EXPORT command in it.

3. Create a smilar batch file(.BAT file) on your "AFRES" server in the same folder and write the IMPORT command in it.

PRIME SERVER SCHEDULAR
Create a schedular which runs on a specific interval. lets assume there are new records inserted every 10 mins. Then create the schedular to run every 15 mins to create the dmp file in the folder.
you can write the MOVE command in the batch file itself to move the dmp file once it is created to the "AFRES" server.

AFRES SERVER SCHEDULAR
Create a schedular to atomatically run the batch file to import.

I hope you have understood what i am trying to get at.

In this way probably you wouldnt have to create a form or manually move the records from one server to the other.

Let me know if it works.

Mudabbir
Re: Executing imp command through a form [message #317914 is a reply to message #303884] Sun, 04 May 2008 22:36 Go to previous messageGo to next message
alister
Messages: 101
Registered: August 2007
Location: India
Senior Member
Hi Everybody
Thank you mudabbir for your procedure. Everything is fine up to creating and moving the dmp file from the PRIME Server to to AFRES server. But how do I automatically run the scheduler. Is there a way in which I can check to see if there is a new file in the folder an run it just like outlook express looks and alerts the users for new mail. I cannot run the scheduler periodically because the dmp file is created as and when there are a certain number of records. Sometimes every 10 minutes, sometimes no dmp file is created during the entire day. I hope you are able to get my problem. If there is a way of knowing that there is a dmp file then an imp can be executed and the file deleted on the completion of the import.

Thank you once again.

Alister
Re: Executing imp command through a form [message #317938 is a reply to message #303884] Mon, 05 May 2008 01:15 Go to previous messageGo to next message
mudabbir
Messages: 235
Registered: April 2006
Location: Kuwait
Senior Member

Hi Alister,

The answer lies in the creation of the Batch file. Let me explain

You have created a folder on your "C" Drive called "BACKUP".
This folder will contain:
1. The batch file which you are running on the "AFRES" server called "MyBatch.bat".
2. The dump file created to be imported "MyDump.dmp".
3. A Folder called "ARCHIVES"

Assume we have created a schedular to run every 10 mins.


MyBatch.bat file
Assume this is the import command which you will have in this file

imp estt/prime@afrestpj file=C:\BACKUP\MyDump.dmp fromuser=prime touser=estt ignore=y

The following lines you will have to add.

set yymmdd=%date:~12,2%%date:~4,2%%date:~7,2% - This will create the date stamp. If today is 5th of may 2008. it creates "080505".

Ren MyDump.dmp MyDump%yymmdd%.dmp - This will rename your MyDump.dmp file to MyDump080505.dmp

Move C:\BACKUP\MyDump%yymmdd%.dmp C:\BACKUP\ARCHIVES\ - This will move the MyDump080505.dmp file to the "Archives" folder.

The reason for this is that when the MyBatch.bat file runs it will look for the MyDump.dmp file in the location and import the file. If it does not find the file, the import command doesnt execute, the ren command doesnt execute and also the move doesnt execute.

I hope you have got it.

Mudabbir
Re: Executing imp command through a form [message #317989 is a reply to message #303884] Mon, 05 May 2008 04:17 Go to previous messageGo to next message
*munnabhai*
Messages: 157
Registered: March 2008
Location: Riyadh
Senior Member
You can use this as a batch file with log file and put into a window built in schedule as per your desire time

create a directory in D:\drive called backup

d:\backup

copy the below code into text file and change the username and password and save the file as a batch xx.bat

c:\oracle\ora81\bin\EXP USERNAME/PASSWORD FILE=D:\backup\xxx.DMP FULL=Y LOG=D:\backup\xx.LOG

Hope this will work fine.


Regards

Re: Executing imp command through a form [message #318456 is a reply to message #317938] Tue, 06 May 2008 22:35 Go to previous message
alister
Messages: 101
Registered: August 2007
Location: India
Senior Member
Hi mudabbir & *munnabhai*

Thanks very much for the batch file and the procedure to use it. It has servered my objectives and works fine. Thanks once again.


Regards.


Alister
Previous Topic: Forms
Next Topic: FRM-40735 with ORA-105100 when calling JavaBean in Forms6i deployed to Web with Forms Server
Goto Forum:
  


Current Time: Sun Dec 04 10:36:55 CST 2016

Total time taken to generate the page: 0.14917 seconds