How to run a batch file in Oracle Pl/sql [message #418865] |
Tue, 18 August 2009 23:23  |
subhadip.chanda
Messages: 64 Registered: May 2007
|
Member |
|
|
Hi,
I have a .bat file in my client system,which will open a web page after executing(after double clicking on it).I want to execute the same batch file from my pl/sql block.So,after executing my pl/sql block that .bat file should execute,and it should open the same web page.Can any body suggest me,how to do the same ..
Regards,
|
|
|
|
|
|
|
|
|
|
Re: How to run a batch file in Oracle Pl/sql [message #419156 is a reply to message #419001] |
Thu, 20 August 2009 02:33   |
tahpush
Messages: 961 Registered: August 2006 Location: Stockholm/Sweden
|
Senior Member |

|
|
This may or may not serve your purpose, thats up for you to decide.
The bat file(residing on the databasserver) has to contain the logic for connecting and running executables on remote "servers".
1. First configure the server so that you can execute external jobs, try this link
Dont forget to grant create external job
2.If everything has been done correctly you should be able to create an external job
BEGIN
DBMS_SCHEDULER.create_job (job_name => 'MYJOB',
job_type => 'EXECUTABLE',
job_action => 'c:\test.bat',
enabled => FALSE,
comments => 'runs test.bat'
);
END;
3. Write a procedure that starts the job
CREATE OR REPLACE PROCEDURE execute_bat_file
IS
BEGIN
DBMS_SCHEDULER.run_job ('MYJOB', TRUE);
END execute_bat_file;
Then you can call the execute_bat_file from "whatever", which will start the job and execute the bat file,which in turn can operate on remote "servers".
Done it on hp-ux platform, takes a bit of work thou.
|
|
|
Re: How to run a batch file in Oracle Pl/sql [message #419160 is a reply to message #419156] |
Thu, 20 August 2009 02:36   |
JRowbottom
Messages: 5933 Registered: June 2006 Location: Sunny North Yorkshire, ho...
|
Senior Member |
|
|
The problem is that the purpose of the .BAT is to open a browser and display a web page.
That's just not going to work in this case.
Nice, concise summary of how to call an external script with DBMS_SCHEDULER though.
|
|
|
|
Re: How to run a batch file in Oracle Pl/sql [message #419203 is a reply to message #419185] |
Thu, 20 August 2009 06:34   |
Frank
Messages: 7901 Registered: March 2000
|
Senior Member |
|
|
Of course it is doable, the point is that the actual displaying of the html page has nothing to do with PL/SQL.
There are several ways to do it; if this is meant to show some status-info on an unattended workstation (hey, I would not like a browser to pop-up on my workstation!), RSS or some Queuing-mechanism seems more fit, for example.
|
|
|
|