Submitting Oracle job via OCCI using dbms_job package

I am using 10g client to connect to a 9i Database on Redhat Linux AS 3.0.
I am trying to submit a job via OCCI. I get back a jobId, but don't see the job in the user_jobs table or the result of the job being executed.
I am using occi::Statement in the following way :
stmt = connection->createStatement("begin dbms_job.submit(:v1, 'submitJobTest;', sysdate,'sysdate+1'); end;");
// where submitJobTest is a stored procedure
stmt->registerOutParam(1, OCCIINT);
stmt->executeUpdate();
int jobId = stmt->getInt(1);
I get back a job id, but can't find it in the user_jobs. The first time I executed the program, i got back jobId 0, then 1 and so on..
Any ideas? Do I need to use dbms_scheduler package?
Thanks, Nilofer

Good catch!
Had a bug, in that my autocommit was not being set!
Works now.
Thanks,
Nilofer

Similar Messages

  • Issue in submitting job using dbms_job() package

    Hello all,
    I need a st procedure to run on every 06:00 AM of the morning , kindly give me the syntax for submitting this job
    Also give me the syntax for submitting this job to run for every 10 minutes.
    Regards
    Karthik Dinakaran

    SQL>  select sysdate from dual;
    SYSDATE
    22-dec-2005 12:40:02
    SQL>  select sysdate + 17.39/24, (sysdate + 17.39/24) + 10/60/24 from dual;
    SYSDATE+17.39/24     (SYSDATE+17.39/24)+1
    23-dec-2005 06:03:29 23-dec-2005 06:13:29

  • Schedule a job using dbms_job package

    SQL to schedule a job using DBMS_JOB.
    variable jobno number;
    variable status number;
    begin
    dbms_job.submit(:jobno, 'x(:status);', trunc(sysdate)+8/24,
    'trunc(sysdate)+1+8/24', null);
    commit;
    end;
    It fails and returns the following error ...
    ORA-01008: not all variables bound
    Is it possible to schedule a job to run a procedure with "IN OUT" parameter? I would appreciate any assistance.
    Proc runs if I execute it from command mode and there are no issues.

    You cannot pass parameters back from a job-- Oracle spawns a separate session to run your job, so that session would receive any OUT parameters and end immediately after the job finishes. Even if Oracle let you do this, you would lose the OUT value as soon as the job ended.
    If you want a job to return a status, you can-
    1) Store the status in a table
    2) Queue a status message in an Oracle Advanced Queue
    3) Use dbms_alert to alert another process
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Using dbms_job package

    1.I wanted to know if I can run a .sql file from the dbms_job package.
    2. I also wanted to know the feature in oracle that I can use to send email to myself once the job is executed- showing successful execution or errors.
    Thanks for your suggestions.

    You cannot pass parameters back from a job-- Oracle spawns a separate session to run your job, so that session would receive any OUT parameters and end immediately after the job finishes. Even if Oracle let you do this, you would lose the OUT value as soon as the job ended.
    If you want a job to return a status, you can-
    1) Store the status in a table
    2) Queue a status message in an Oracle Advanced Queue
    3) Use dbms_alert to alert another process
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Scheduling stored procedure using DBMS_JOB package

    I have stored procedure called “extract_every_day”, I want this procedure to run automatically at 7:00 PM every day.
    I used DBMS_JOB.SUBMIT to achieve this, below is pl/sql block
    DECLARE
    v_jobno number ;
    BEGIN
    DBMS_JOB.SUBMIT
    (v_jobno,
    ' extract_every_day ',
    TRUNC (SYSDATE) + 1 + 9/24,
    'TRUNC (SYSDATE) + 1 + 9/24');
    COMMIT;
    END;
    When I run above pl/sql block is that mean procedure “extract_every_day” executes every day and what is the significance of “job” OUT parameter in “DBMS_JOB.SUBMIT “ procedure. Also how can I see list of jobs submitted.
    Any help is appreciated.
    Thanks

    The OUT parameter is the unique number of the job being executed. This is the Sequence generated from sequence sys.jobseq
    Also, in the example you have provided, the Job will run at 9Am and not 7PM.
    To make it run at 7PM every day change the following lines :
    'TRUNC (SYSDATE) + 1 + 9/24'
    'TRUNC (SYSDATE) + 1 + 9/24'
    To ,
    'TRUNC (SYSDATE) + 19/24' <-- Changed
    'TRUNC (SYSDATE) + 1 + 19/24' <-- Changed
    Also do remember to include the parameter "job_queue_processes" parameter within the init.ora file. This parameter is used to determine the max no
    of concurrently running jobs (i.e. Set in Init.ora).
    NOTE :- Job_queue_process cannot be set to 0. If set to 0, no jobs is run.
    he view dba_jobs and dba_jobs_running should be used to view the jobs.
    -- Shailender Mehta --

  • Integrating Oracle APPS with APEX using popay_apex package...

    Hi,
    I am a newbie in APEX and tried to explore it only a few months back...
    I must admit that this tool is Awesome..!!!
    Also, I tried to integrate Oracle EBS 11i with APEX using [popay package |https://sites.google.com/a/popay.be/apex-on-apps/integration] and the integration was absolutely fantastic...!!!
    h6. (Thanks Thierry for your impecabble work on developing and releasing this excellent package under BSD License !!!)
    My question is,
    I have created an Online Leave Application (OLA) in APEX which should retrieve the username from EBS Login and display the leave information of that particular user.
    I have created the OLA in APEX and registered it in EBS as a form function and also attached it to a user responsibility.
    When I run the form thru the EBS Responsibility logged in as a EBS user, the OLA Application opens in a new window...
    But,
    The username is retrieved as APPS instead of the user's login info.
    because of this retrieval the global variable :APP_USER is storing the username as APPS and all my internal references with :APP_USER has been erroring with "NO DATA FOUND", since there is no user login as APPS.
    Is there any way to overcome this bottleneck...?
    Or Do I need to add any code in the APEX >Application >Security > VPD
    Thanks in Advance...
    Ben

    Hi,
    I have solved the issue, Thanks to Rod & Thierry !
    I have created a cookie to send the apps username to my APEX application.
    (Added this code snippet in the popay_apex.start_application procedure)
    --------<CODE>------------------------------------------
    l_user := fnd_global.USER_NAME;
    OWA_COOKIE.send
    +(NAME=>'APEX',+
    VALUE=>l_user,
    path=>'/');
    ---------<ENDS>----------------------------------------
    (Created an on-load before header process at page 1 and fetched the cookie value to an application item.)
    -----------<CODE>-------------------------------------
    DECLARE
    c OWA_COOKIE.cookie;
    a wwv_flow_global.vc_arr2;
    BEGIN
    c := OWA_COOKIE.get('APEX');
    a := htmldb_util.string_to_table(c.vals(1));
    +:F101_USER := a(1);+
    EXCEPTION WHEN OTHERS THEN
    NULL;
    END;
    -------------<ENDS>---------------------------------------
    It's a mashup of Rod & Thierry's work....!
    Hat's off to Rod & Thierry !
    Ben

  • Oracle 9i OEM fails using RMAN but RMAN Okay from DOS Prompt

    I am using Oracle 9i Enterprise on Windows NT 4 with dual 400 MHZ Pentiums with 1GB of ram. I am able to run RMAN from the DOS prompt and the backup file is created fine. When I run either by a job or by using the Backup wizard from the OEM, the job fails with a TNS:protocol adapter error from the target database.
    Error Message that I get is as follow:
    Recovery Manager: Release 9.0.1.1.1 - Production
    (c) Copyright 2001 Oracle Corporation. All rights reserved.
    RMAN> connect target jungle/gonzo@(ADDRESS=(PROTOCOL=BEQ)(PROGRAM=ORACLE)(ARGV0=ORACLEDEV)
    (ARGS='(DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))'))
    2> connect catalog RMAN/rman@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)
    (HOST=testhost.crane.navy.mil)(PORT=1521)))(CONNECT_DATA=(SID=TestOEM)(SERVER=DEDICATED)))
    3> @E:/oracle/ora90/work/706143955.21
    4> run{allocate channel c1 type disk;
    5> backup database format 'F:\OracleDumps\%u';
    6> release channel c1;
    7> }
    8> **end-of-file**
    9>
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-00579: the following error occurred at 06/21/2002 14:39:57
    RMAN-04005: error from target database: ORA-12560: TNS:protocol adapter error
    Recovery Manager complete.
    child process exited abnormally
    nms-915: The Job failed, error code=
    My TNSnames.ora contents are as follows:
    # TNSNAMES.ORA Network Configuration File: c:\oracle\ora90\NETWORK\ADMIN\tnsnames.ora
    # Generated by Oracle configuration tools.
    Test.CRANE.NAVY.MIL =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = testhost.crane.navy.mil)(PORT = 1521))
    (CONNECT_DATA =
    (SERVICE_NAME = Test)
    TESTOEM.CRANE.NAVY.MIL =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = Testhost.crane.navy.mil)(PORT = 1521))
    (CONNECT_DATA =
    (SERVICE_NAME = TESTOEM)
    My Listener.ora file is as follows:
    # LISTENER.ORA Network Configuration File: c:\oracle\ora90\NETWORK\ADMIN\listener.ora
    # Generated by Oracle configuration tools.
    LISTENER =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 164.227.54.52)(PORT = 1521))
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (GLOBAL_DBNAME = Test)
    (ORACLE_HOME = E:\oracle\ora90)
    (SID_NAME = Dev)
    (SID_DESC =
    (GLOBAL_DBNAME = TestOEM)
    (ORACLE_HOME = E:\oracle\ora90)
    (SID_NAME = DEVOEM)
    (SID_DESC =
    (PROGRAM = extproc)
    (SID_NAME = PLSExtProc)
    (ORACLE_HOME = E:\oracle\ora90)
    (SID_DESC =
    (GLOBAL_DBNAME = SQLSRV_testhost.crane.navy.mil)
    (PROGRAM = tg4msql)
    (SID_NAME = test1)
    (ORACLE_HOME = E:\oracle\ora90)
    I believe the problem is with the TNSNames file not having BEQ set up in it. I tried to set up using the Oracle Net Manager and could not find BEQ as an available protocol. Anyone know where to direct me to look in the documentation or can give me some help.
    I am a newbie on the Oracle DBA scene and any help would be appreciated. Just been trying to do this since January.

    Gordon,
    Considering that this is a military server I would not post the logon information and server address on a public forum such as this :)
    If you are getting the TNS error when submitting the job via OEM, then check that your local tnsnames.ora file on the OEM machine has the tnsnames alias to connect to the target database. When issuing RMAN backups via DOS on the target server you are using BEQ. However, when issuing commands via OEM, you will be using the tnsnames.ora file on the monitoring machine that you've installed OEM on. You will need the tnsnames alias for the RMAN catalog on the target server.
    try the following:
    set up a tnsnames alias for the target database on the OEM server
    open up DOS on the OEM server and type:
    rman target jungle/gonzo@<target_database> connect catalog RMAN/[email protected]
    Is the target database,catalog and OEM server all on different machines?

  • How can event driven scheduling will be acheived using DBMS_JOB

    Hi,
    I am running oracle jobs using DBMS_JOB package . I need to check for particular event is happend or not then only It should run my job.Can I acheive this using dbms_job.What is the syntax for it.Where Can i add dependencies in dbms_job
    Thanks

    Job 1 - finishes 2 AM
    Job 2 should start right after Job 1 , this is a dependency tree and dbms_job is not good at this.
    If this is your requirement then you have to build your own wrappers on top of dbms_job to make it happen. Simplest is to loop and wait till job 1 finishes and then launch job 2.

  • About DBMS_JOB Package

    Hi Everyone,
    I assinged a job using dbms_job package whose interval is after every 5 minutes. But the jobs are not activated i.e, not running. Can anybody explain me to solve this problem.
    Thanks
    Krishna

    Hi, Krishna
    Also, you may need to change some initialization parameters in your database.
    In order for jobs to be executed, you have to define how many processes will be ready to execute jobs.
    You will also have to define how frequently the database checks for jobs (the default is every 10 minutes).
    Both values are defined in the INIT<databasename>.ORA file.
    Examples:
    job_queue_processes = 2
    job_queue_interval = 60 (seconds)
    The lower the interval, the slower the database. Adjust the number of processes according to the number of simultaneous jobs.
    You can check if the values are already defined by the following query:
    select name, value from v$parameter
    where name like '%job%';If you change the init.ora file, remember to shutdown and restart your database.
    Hope this gets you started,
    Pedro.

  • Scheduling job using DBMS_JOB.SUBMIT()

    Hi people I hav esubmitted a job using DBMS_JOB.SUBMIT() package.I have set the time it should run after 5 minutes from the time i created.but now my question is how do we know the submitted job has been executed within specified interval?.am using oracle 9i.please suggest me.
    Regards
    VIDS

    You should refer to DBA_JOBS and DBA_JOBS_RUNNING views to get information about your jobs
    Please refer to this address to get more information about these views
    http://pandazen.wordpress.com/2007/12/19/oracle-job-to-be-continued/
    Kamran Agayev A. (10g OCP)
    http://kamranagayev.wordpress.com

  • Scheduling jobs via DBMS_JOB

    Hi,
    Can anyone please help me to schedule a job via DBMS_JOB.
    I have to execute a procedure p_upload_data from Tuesday to saturday at 1:00 AM.
    Please provide me the code that i can use.
    Thanks

    cofusracle wrote:
    Can anyone please help me to schedule a job via DBMS_JOB.Have a look at the Oracle® Database PL/SQL Packages and Types Reference manual
    I have to execute a procedure p_upload_data from Tuesday to saturday at 1:00 AM.
    Please provide me the code that i can use.Scheduling a job is as easy as follows:
    declare
      j number;
    begin
      DBMS_JOB.Sumbit(
        job => j, --// job id created for the job in USER_JOBS
        what => 'P_Upload_Data;', --// PL/SQL code block scheduled for execution
        next_date => sysdate, --// when to start executing the job (e.g. immediate)
        interval => 'trunc(sysdate+1)' --// function to use to calculate when next to execute the job (midnight each day)
      commit; --// the DBMS_JOB package updates the SYS.JOB$ table and changes need to be comitted
    end;I leave the interval calculation up to you to figure out.

  • How to schedule a job to run after completion of each run using DBMS_JOB ?

    Hi Gurus,
    Please let me know if the subject requirement can be fulfilled. I want to schedule a job using DBMS_JOB to run a script sequentially after completion of each run.
    Thanks in advance.
    Santosh

    Hi Santosh
    Instead to use the old dbms_job package use the dbms_scheduler and raise / catch events.
    Oracle create dbms_scheduler also for this purpose you need.
    You can find tons of examples on the web.
    Aurelio

  • Hide user/pwd when  running sqlplus job via HOST cmd in oracle forms

    I have a oracle procedure that returns the run_command string. Ex . ‘sqlplus ui/pwd @report.sql’. The run_command string returned by the procedure is run via the HOST command in oracle Forms.
    HOST(run_command) submits the job but it exposes the ui and pa that is used in the run_command string. On UNIX, if I do ps –ef | grep sqlplus after the job is submitted by the HOST command, I can see the ui/pwd in the run_command.
    How can I submit the job via HOST command without exposing the ui/pwd ?
    Thanks
    GP

    Of course, the Operating System Authenticated account method should only be used if you are running this job on the machine with that's running the Oracle instance. You absolutely do not want to turn on remote authentication. If you're not on the same machine, I would suggest you put the credentials in a file and secure it with filesystem privileges. I generally use a single generic script initiator that logs on and then runs some other script specified on the command line. Something like ...
    username/password
    @&1Note: the extra "--/--" lines ensure that the script fails with invalid login if the credentials are wrong but they get interpreted as comments if the logon succeeds.

  • Hide ui/pw when submitting job via FORMS HOST cmd

    I have a oracle procedure that returns the run_command string. Ex . ‘sqlplus ui/pwd @report.sql’. The run_command string returned by the procedure is run via the HOST command in oracle Forms.
    HOST(run_command) submits the job but it exposes the ui and pa that is used in the run_command string. On UNIX, if I do ps –ef | grep sqlplus after the job is submitted by the HOST command, I can see the ui/pwd in the run_command.
    How can I submit the job via HOST command without exposing the ui/pwd ?
    Thanks
    GP

    Thanks for the reply.
    The users have individual userid and passwords and I will have to pass it to the shell script that runs the report.
    That will be exposed by ps -ef.
    I can't create a single query only id because I have some reports that do inserts and updates.
    Is there a way I can hide the userid and password that I am passing to the shell script.
    Thanks.

  • To submit a job in dbms_job package with specific durations

    Hi,
    Want to set a job to run everyday from 8.00 am to 6.00 pm for every 30 min after that every hour.I want to set this in dbms_job package.The database is 10.2.0.3
    The implementation notation used is
    variable jobno number;
    exec dbms_job.submit(:jobno,'begin procedurename; end;',sysdate,
    'case when sysdate-trunc(sysdate)>=8/24 and sysdate-trunc(sysdate)<18/24 then sysdate+30/1440 else sysdate+1/24');
    but the error resulted is parameter value not appropriate.

    Hi,
    Obviously because you have two different interval strings 'sysdate+30/1440' and 'sysdate+1/24'.
    (The interval strings are inaccurate, but that's a different story)
    The preferred solution in 10g would be to use dbms_scheduler.
    A workaround using dbms_job would be to use 2 ancilliary jobs to change the interval of your main job twice a day, calling dbms_job.interval.
    Your interval strings will cause the time to drift.
    You need to use trunc(sysdate,'HH24') instead of just sysdate.
    Hth
    Sybrand Bakker
    Senior Oracle DBA

Maybe you are looking for

  • Using Site Content and Structure unable to move documents,pages and getting weird error message

    Hi , earlier we are moving a page ,document from one site to another sub site with in the Site Collection. Now,we are getting a un-readable format error. After selecting the destination we are getting the error. and the file can't move. What might me

  • SQL Insert Syntax erro !!! please help

    I am getting an a Syntax Error Sending query: INSERT INTO Customer (custNo, name, address, date) VALUES ('3001005', 'John Ped', '32 Lake st La', '05/07/2004') java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INT

  • Manage multiple Time Machines

    I have about 10 users with Macs. Is there any application/tool I can use to manage all of their Time Machines in one place? I'd love to be able to see success/failure of their backups.

  • How to add data into JTable

    How can I add data into JTable, for instance ("Mike", "Gooler", 21).

  • How to solve :  java.lang.OutOfMemoryError: Java heap space

    Dear all, Am using Jdeveloper 11.1.1.3 with weblogic10... I keep getting out of memory error while working on the application , here is the exact error message that i copied from the server log : ####<28/11/2010 GMT 09:17:58 ص> <Critical> <Health> <j