Calling batch file using dbms_scheduler

Hello,
i have created a schedule, program and a Job to using the DBMS_SCHEDULER. creates all those fine but when i try to run i get errors.
here is the code:
begin
dbms_scheduler.create_schedule(
schedule_name => 'dailyjob',
repeat_interval => 'FREQ=DAILY; INTERVAL=1;
BYDAY=TUE; BYHOUR=4',
comments => 'schedule to run daily');
dbms_scheduler.create_program
( program_name => 'runord',
program_type => 'EXECUTABLE',
program_action => 'd:\oracle\product\admin\scripts\ord.bat >nul',
enabled => TRUE,
comments => 'ORDERS.'
dbms_scheduler.create_job (
job_name=>'TEST',
program_name =>'runord',
schedule_name=> 'DAILYjob',
enabled => true,
comments => 'TESTING the Orders Job.'
end;
exec dbms_scherduler.run_job('TEST');
gives me the errors.
in the batch file i am calling connecting to the database and calling the sql file. is there any way that i can connect to the database directly from scheduler itself? i dont like to save username and passwords in a file to connect and invoke sqlplus?
could any one help.....

Pass them to the external command line as parameters? That exposes the name and password even more.
We use a tightly controlled directory with this information in it and access to the directory is controlled. The scripts are also in a controlled directory and have read privileges where the credentials are stored.
That way the scripts don't have the data exposed and don't use it until they run.

Similar Messages

  • Call batch file using IBOT

    Hi ,
    We are using OBIEE 10G
    and I need to transfer folder from one machine to another machine(both are windows) so I have written a dos command (batch file). Now I need to call this batch file from IBOT ,how I can do this. any suggestion pls.

    Hi ,
    U can use a javascript to call the batch file and attach the script to your IBOT :
    For example :
    <html><head><script type="text/javascript">function runApp(st) {  WshShell = new ActiveXObject("WScript.Shell");  WshShell.Run (st,1,false);}</script></head><body><!-- Two ways to create a link to run the app. --><font onClick="runApp('file://c:/winnt/notepad.exe');" style="cursor: hand;"><u>Notepad</u></font><br><!-- Or use <a> descriptor -->Batch File</body></html>

  • Why do I get error -17500 when calling a batch file using the call executable step type?

    I am calling a batch file using the call executable step type. If the path to the batch file contains a space I get error -17500 and a message stating there was an error in "Post". For example the path to the batch file is "c:\TestWin\Test Files\...\Program.bat" When I run this I get the above mentioned error, however if I change my directory structure so the path is now "c:\TestWin\TestFiles\...\Program.bat" it runs fine. I use the browse feature to find my batch file so it is not me typing in a path incorrectly. I have removed the batch file and I get a different error stating that it couldn't find the file so it appears that for my error it can find the file but can't run it. I am
    sure that this has something to do with the fact that batch files are written in DOS but really don't want to resort to changing my directory structure on all my test stations. Is there any way to fix this problem so I can leave a space in my path?

    It appears I have figured it out. This was on another computer so I was unaware of how they used their computer. I like you got it to work in the temp directory and in fact got the program.bat file to work as long as I put it under the temp directory, but when I switched out to my TestWin directory it wouldn't work, so I removed everything from the directory except the batch file it self and it work. What I found out after adding files in one at a time is that the person had a file called "Test" with no file extension in there "c:\TestWin\" directory. Removing this file made it work. Putting the file back broke it. So it appeares that when teststand was running it followed the path saw a space and attempted to grab the "Test" file instead of bro
    wsing into the "Test Files" directory. If you create a file in your temp directory called "temp" with no file extension you will see the same problem. Thank you for your help.

  • Question about calling batch file by using the System Exec+.vi?

    Hi
    I have a problem about calling batch file. I know that the system exec is equivalent to "run" in Windows. I called the batch file c:\rtxdos\bs\ch0.bat successfully in the "run" but it didn't work in the LabVIEW program. The dos prompt had an error message "Bad command or file name" and it just happen when I call this batch file in LabVIEW. Why?
    Bill.

    Hi,
    Try to set the "working directory" parameter of System exec.vi to the directory where the batch file is located. It may help.
    Good luck.
    Oleg Chutko.

  • Running a Batch file Using Java

    hi All ,
    I am executing a DOS batch file using the Java .
    I am using it as
    Process P;
    Runtime rt = Runtime.getRuntime();
    P = rt.exec("C:\\X12TST\\BATCH1.BAT ");
    But in case BATCH1.bat have call to some other Batch File Say Bactch2.bat , i am not getting the output of BATCH2.BAT .
    My Java Program exits as soon as it enters to the point where BATCH1 is calling BATCH2 using (call BATCH2.bat).
    Any help is resolving the problem is highlt appreciated .
    Please advise me if you have any alternative to solve the problem .
    Thanx in advace

    The Runtime.exec() should'nt be used with a .bat or .cmd file since .bat and .cmd are not really executable. I think the expected behaviour you experimentred is a process hang at the last command line of the .bat file.
    Insert "echo XXX" or "net send mycomputer XXX" debug messages in your .bat, you'll see the .bat executes until last line. But the last one NEVER terminates, resulting in a hang in the Java thread doing a process.waitFor().
    The only workaround (or right use of exec) is to call the cmd.exe (with FULL PATH OF cmd.exe SPECIFIED in the exec() call). An exec() calling C:\WINNT\System32\cmd.exe /C mybatch.bat should return properly, cause cmd.exe is a standard Win32 program that will be launched to interpret mybatch.bat then terminate.
    PLEASE UNIX/LINUX USERS : report if the behaviour you get is the same on your plat-form, or if it is -one more- bug in win32 OS. Can you exec() a shell script direcly or do you have to exec() a "bash" or "ksh" or "csh" with you shell script as command line argument ?

  • How read shell log file using DBMS_SCHEDULER

    Hi All,
    I am running a shell script file using DBMS_SCHEDULER and it creates couple of log file. I am trying to run other DBMS_SCHEDULER job2 to read current log file written by job1 display on APEX web page. I am using oracle 10g version. Any suggestions are much appreciated.
    Regards

    james. wrote:
    Thank you Purvesh K. I want to read the log file as soon as I started the my shell script.
    " Just call the Stored program to read the files "
    Can you give me an example of the stored program you mentioned?
    RegardsOracle UTL_File contains example of reading from a UTL_File. (Just in case you are not aware of doing so.)
    What I intended to say was:
    1. You might be having a Job Scheduled/Calling a stored program to create a Log File.
    2. You can directly call the Stored Program (Function/Procedure) that contains the logic to Read the Log File.

  • Calling batch file from java Program

    I have made the java program in which i have called the batch file.But the problem is this that when i call batch file locally it executes normally but when i try to execute batcvh file from remote machine it doesn't runrather it gives Runtime IO execption.Error123.Can anyone provide me the solution for this?

    Not without a lot more information. Like for example how you are trying to execute this remote batch file, the code you are using to do that, what kind of server you have no the remote machine to let you remotely execute code, and so on.

  • Can we run the batch file using simple java application

    Hello sir,
    we want to run the batch file using simple java application. i tried with some example, we run the exe files but not batch file.
    Runtime r = Runtime.getRuntime();
    r.exec("D:\\jboss\\bin\\run.bat");
    My application is server will run when we run the java appliation.
    any suggestion? plz give me the solutions

    yes you can run html file
    WEB.SHOW_DOCUMENT is a built-in that is used in Forms to call URL from a Web Form. It works much like the similar way that a link on an HTML page works and it takes two arguments, one is URL and second one is TARGET, in your case use following.
    WEB.SHOW_DOCUMENT('http://channas.iil.informatics.lk:8890/forms/frmservlet?config=abc.html', '_blank');
    Hope this will work for you
    Abbas

  • How to run a batch file using tigger....

    Hi, i am trying run a batch file using a trigger on a table.
    say i have a table XYZ(col_1 varchar2 primary key, col_2 varchar2)
    the values of col_2 keeps changing and col_1 are constant
    whenever the value of col_2 in any row changes from "on" to "off" i want to run a batch file C:\Users\ABC\Desktop\test.bat
    i did some searching but couldn't find any solution. Thanks in advance
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    sorry wrong foum to post.
    will post in the correct one
    how to run batch file using trigger?

    Hallo,
    welcome to the forum.
    This is the forum for the tool {forum:id=260}. Your question should be placed in {forum:id=75} or {forum:id=61}.
    When you post your question there please provide additional information like db version, what kind of trigger you want to use, how you want to prevent the execution when the transaction is rolled back... {message:id=9360002}
    Regards
    Marcus

  • Know steps names of called sequence file using sequence call step type in TestStand

    Hi,
        I have a problem in accessing step names in called sequence file using "Sequence call"step type in TestStand 4.0.
    I would list out all step names of called sequence file. Is it possible to do through C#.NET? If, yes, Please explain to me in detail with possible example.
    Thank you,
    regards
    RKK

    Hey RKK,
    I want to first set your expectations for the forums.  This is not a place for people to review and rewrite your code for you; this is a place for specific and general questions.  I am not saying your question in this thread is inappropriate, because it is a good questions.  We should just not post code and ask others to fix it here.  If you are looking for this type of service we have alliance members that can help you write your TestStand Operator Interface (www.ni.com/alliance).
    As for you question about getting the sequence names for a sequence file that is not the currently running sequence file, you will need to open a reference to that sequence files and then use the API calls that I mentioned in my previous posts.  You can use the Enigine.GetSequenceFileEx function to open a reference to sequence file, and you will need to close the reference with the Engine.ReleaseSequenceFile function when you are done using it.  After you have a reference to this external Sequence File, you can use the example dll and sequence I previously sent you.  I also attach a new sequence file (SeqFile2.seq) plus an updated GetNames.seq to illustrate how to use the above mentioned functions.  I hope this helps.  Have a great day!
    Best Regards,
    Software Engineer
    Jett R
    Attachments:
    GetNamesOfSequencesInFile.zip ‏52 KB

  • How to run batch file using trigger?

    Hi, i am trying run a batch file using a trigger on a table.
    say i have a table XYZ(col_1 varchar2 primary key, col_2 varchar2)
    the values of col_2 keeps changing and col_1 are constant
    whenever the value of col_2 in any row changes from "on" to "off" i want to run a batch file C:\Users\ABC\Desktop\test.bat
    i did some searching but couldn't find any solution. Thanks in advance
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production

    >
    the script will be started around 60-70 times a day
    >
    No - as marwim said the script will be executed every time the trigger is fired. And that trigger, depending on how it is written, might be fired several times for the same transaction.
    And if the trigger is fired the script will be executed even if the transaction that caused the trigger to fire issues a ROLLBACK.
    Triggers are non-transactional. You need to clearly define the business rules for when the script should run. Should it run only when the transaction is COMMITTED? Or should it run if the transaction executes even if the transaction performs a ROLLBACK?
    A trigger is the wrong solution for your problem.
    Please clarify what the business rules are that should control the execution of the script.

  • Calling Remote Batch File Using 'Execute Process Task'

    I have a remote batch file on machine B that I need to execute using 'Execute process task' control from a package on machine
    A.
    How can i achieve this...

    You also need to make sure you run the job using a domain account proxy http://www.mssqltips.com/sqlservertip/2163/running-a-ssis-package-from-sql-server-agent-using-a-proxy-account/
    Arthur
    MyBlog
    Twitter

  • Calling Batch files in PLSQL Procedure

    Hi all,
    I am working on a PLSQL procedure and having issues when I am trying to call a batch file.
    Issue:-
    I have a procedure which have to kick off a batch file. And that batch file needs to run in Windows not in Unix box. 
    Can someone please help me out in providing some samples or anything?
    Thanks a lot in advance.

    Thank you rp0428 and sb92075,
    I have tried to create a sample of what I am trying to get and so I have created the following code in a batch file and named as Check.bat:-
    @set a=3
    @set b=4
    @set /a c=%a%+%b%
    echo %c%
    So based on those links you guys provided I have created an
    Scheduler Job:-
    BEGIN
    DBMS_SCHEDULER.create_job (job_name        => 'MYJOB1',
                               job_type        => 'EXECUTABLE', JOB_ACTION      => 'c:\Check.bat', enabled         => TRUE,comments        => 'runs Check.bat' );
    END;
    And the following Procedure :-
    CREATE OR REPLACE PROCEDURE execute_bat_file
    IS
    BEGIN
       DBMS_SCHEDULER.RUN_JOB ('MYJOB1', TRUE);
    END execute_bat_file;
    And used the following exec command:-
    exec execute_bat_file;
    I am getting the following error:-
    Error starting at line 1 in command:
    exec execute_bat_file
    Error report:
    ORA-27475: "ACTUATE.MYJOB1" must be a job
    ORA-06512: at "SYS.DBMS_ISCHED", line 150
    ORA-06512: at "SYS.DBMS_SCHEDULER", line 441
    ORA-06512: at "ACTUATE.EXECUTE_BAT_FILE", line 4
    ORA-06512: at line 1
    27475. 00000 -  "\"%s.%s\" must be a %s"
    *Cause:    An object of the wrong type was specified. For example, a table
               could have been passed to the drop_job() procedure.
    *Action:   Reissue a different command applicable to this object type or
               reissue the same command using an object of the valid type.
    Can you guys please help with this?
    Thank you once again

  • Executing batch file using SM49 Tcode

    Hi,
    Theirs a batch file which is used to encrypt a text file ie from '.txt' to '.enc'.
    Seperate Encryption software and Java Pakage is used.
    When in SM49 the operating system command is executed,its throwing error
    File Not Found Exception.
    ie call failed
    Java.io.filenotfoundexception :  ..\logs\star_pkcs7-client-events.log(The system cannot find the path specified)
    OS is WinNt,File is encrypting at OS level seperately.
    All authorisation issue has been taken care of.
    If any questions or need information then plz ask
    Help me on this...its urgent

    hi,
    well try the following
           String cmdLine[] = {"cmd.exe","/c","copy.bat"};       Runtime.getRuntime().exec(cmdLine);it works fine in Win NT, the process terminates normally.
    cheerz
    ynkrish

  • Pass Passord Variable to a Batch File using Execute Process Task

    I have an FTP batch file that I want to execute using Execute Process Task. The content of the ftp (ftpscript.cmd) is as below:
    open ftpsite
    UserName
    Password
    ASCII
    get file  c:\temp\test.txt
    bye
    Using SSIS Execute process task, I was able to download data. I configured the Execute Process task as follows:
    Executable: ftp.exe
    Arguments: -s:"c:\temp\ftpscript.cmd"
    The above works fine. But the problem is that I don't want to store the password value in the batch file for security/policy reasons. Please, is there a way I can pass the password value to the ftp executable or the batch file at run time?
    I know how to get and store variables in SSIS but I don't know how to pass this kind of variable to the batch file just before execution.
    Any suggestions will be appreciated. Thanks.

    you can dynamically generate the source (CMD) for the FTP and delete after the execution. The password can be stored in a secure database for example, not 100 % secure, but the best you can do.
    Another option I did was an encrypted VBScript (also quite easy to open in plain text to some people).
    Finally it can be a binary e.g. an EXE with the FTP called as process in it.
    Arthur My Blog

Maybe you are looking for

  • CD's burned on G4 will not open in Windows 98 or Vista.

    Running a G-4 Quicksiler, OS 10.3.9, using Toast Lite 5.2.1. In the past I have been able to burn CD's with Toast Lite in the Mac OS and PC (Hybrid) format and was able to open them in Windows 98 and send them to Vista users that could view them. Wit

  • Date format in XML sys.dbms_xmlgen

    hello all, i have posted this question in "general XML " forum also....so please dont mind i am using following query to generate insert SQL statements SELECT 'insert into ' || table_name || ' (' || (select rtrim(extract(xmlagg(xmlelement(e, t.column

  • Can't create 2nd local currency

    I would like to add 2nd local currency of leading currency. But the system show the error message as below. The currency type for an additional local currency cannot be changed for company code , since documents were already posted in this company co

  • Cant bypass agreement screen

    i've been tring for 6h and not any luck, I have internet and no SIM but still don't load the licence agreement and can't use the phone. I've search how to solve this but any lock. Can anyone please help me??? THX

  • Event handling without new class

    I'm new to Java, so please bear with me. I'm working with a file management software called Intralink which allows automating tasks by recording keystrokes or writing instructions in Java. A typical recorded script would look like: // Start Macro Rec