DBMS_JOB.BROKEN

Hi,
Is it possible that broken jobs (Using DBMS_JOB) executes? I have broken a job for statspack statistics collection using command
execute dbms_job.broken(42,true); and then I checked user_jobs. Broken column was Y that time but still its executed and trying to execute that job.
Can you tell me how this has happened?
Malay

Normally a broken flag is set to Y by Oracle after 16 unsuccessful attempts.
The attempts will be made in a interval which is multiples of 2 like, 2, 4, 6,....
and once it reaches the 16th attempt and still fails it sets the flag to Y.
Now you have to manually run the job, and set the broken flag to N.
Did you commit the operation after dbms_job.broken(42,true) ?

Similar Messages

  • Can we use DBMS_JOB.BROKEN IN PL/SQL CODE

    HI
    below is my code
    CREATE OR REPLACE procedure dept_insert1 is
    X NUMBER;
    y number;
    BROKEN_FLAG CHAR(1);
    begin
    Select count(*) into Y from dept1;
    if y < 20 then
    SELECT trim(BROKEN) INTO BROKEN_FLAG FROM USER_JOBS WHERE JOB='1517';
    DBMS_OUTPUT.PUT_LINE ('FLAG.....'||BROKEN_FLAG);
    IF BROKEN_FLAG='Y' THEN
    DBMS_JOB.BROKEN(1517,FALSE);
    DBMS_OUTPUT.PUT_LINE ('FLAG.....1'||BROKEN_FLAG);
    DBMS_JOB.RUN(1517);
    DBMS_OUTPUT.PUT_LINE ('FLAG.....2'||BROKEN_FLAG);
    END IF;
    for i in 1..5
    loop
    insert into dept1 values (i,'DEPT'||i,'India');
    commit;
    end loop;
    end if;
    DBMS_JOB.BROKEN(1517,TRUE);
    End;
    i have 2 jobs --
    1st is validation job and second will excute if 1st compelete successfully.
    so hw can we do that??
    i did in following way --
    i created 2nd job and load it then set broken flag is Y then i called that job in my 1st job ..above is my proc which i using in my 1st job.
    but my 1st job fails every time and unable to broken flag =n for second job
    Reply ASAP

    1st is validation job and second will excute if 1st compelete successfully.
    so hw can we do that??using DBMS_JOBs to implement this sort of workflow is rather difficult because it is hard to co-ordinate these things, being as how they are background processes and don't talk nicely with each other.
    One way is to just have one job which calls a wrapping procedure which executes the procedure from the first job and then conditionally executes the code from the second job. This is the easiest way so I presume you have a good reason for not implementing things this way.
    Alternatively you could build a progress tracking table. the code in the first job sets a status flag. The code in the second jobs checks this flag to determine whether to continue with its processing or abend.
    Cheers, APC

  • Start one job after another complets using PL/SQL procedure and DBMS_JOB

    All,
    I am attempting to refresh a materialized view using DBMS_JOB and having a PL/SQL program loop through each materialized view name that resides in a table I created. We do the table because they have to be refreshed in a specific order and I utilize the ORDER_OF_REFRESH column to dictate which MV comes first, second, third, etc.
    Now - I have this working to the extent that it kicks off 4 materialized views (currently set the procedure to only do 4 MVs for testing purposes) but I would ultimately like the procedure to create a new DBMS_JOB that calls DBMS_MVIEW.REFRESH of the next view in line ONLY after the preceeding materialized view DBMS_JOB completes.
    The purpose of all of this is to do a few things. One - if I simply create a procedure with the DBMS_MVIEW.REFRESH call to each materialized view in order - that works but if one fails, the job starts over again and will up to 16 times - BIG PROBLEM. Secondly, we want the job that will call this procedure to fail if it encounters 2 failures on any one materialized view (because some MVs may be dependant upon that data and cannot use old stale data).
    This may not be the "best" approach but I am trying to make the job self-sufficient in that it knows when to fail or not, and doesn't kick off the materialized views jobs all at once (remember - they need to start one after the other - in order).
    As you can see near the bottom, my logic doesn't work quite right. It kicks off all four jobs at once with the date of the whatever LAST_REFRESH is in my cursor (which ultimately is from the prior day. What I would like to happen is this:
    1.) 1st MV kicks off as DBMS_JOB and completes
    2.) 2nd MV kicks off with a start time of 3 seconds after the completion of 1st MV (based off LAST_REFRESH) date.
    3.) This conitnues until all MVs are refresh or until 2 failures are encountered, in which no more jobs are scheduled.
    - Obviously I am having a little bit of trouble with #2 and #3 - any help is appreciated.
    CREATE OR REPLACE PROCEDURE Next_Job_Refresh_Test2 IS
    V_FAILURES NUMBER;
    V_JOB_NO NUMBER;
    V_START_DATE DATE := SYSDATE;
    V_NEXT_DATE DATE;
    V_NAME VARCHAR2(30);
    V_DELIMITER VARCHAR2(1);
    CURSOR MV_LIST IS SELECT DISTINCT A.ORDER_OF_REFRESH,
                                  A.MV_OBJECT_NAME
                        FROM CATEBS.DISCO_MV_REFRESH_ORDER A
                        WHERE A.ORDER_OF_REFRESH < 5
                   ORDER BY A.ORDER_OF_REFRESH ASC;
    CURSOR MV_ORDER IS SELECT B.ORDER_OF_REFRESH,
                                  B.MV_OBJECT_NAME,
                                  A.LAST_REFRESH
                             FROM USER_SNAPSHOTS A,
                                  DISCO_MV_REFRESH_ORDER B
                             WHERE A.NAME = B.MV_OBJECT_NAME
                        ORDER BY B.ORDER_OF_REFRESH ASC;
    BEGIN
    FOR I IN MV_LIST
    LOOP
    IF I.ORDER_OF_REFRESH = 1
    THEN V_START_DATE := SYSDATE + (30/86400); -- Start job one minute after execution time
              ELSE V_START_DATE := V_NEXT_DATE;
    END IF;
         V_FAILURES := 0;
         V_JOB_NO := 0;
         V_NAME := I.MV_OBJECT_NAME;
         V_DELIMITER := '''';
    DBMS_JOB.SUBMIT(V_JOB_NO,'DBMS_MVIEW.REFRESH(' || V_DELIMITER || V_NAME || V_DELIMITER || ');',V_START_DATE,NULL);
              SELECT JOB, FAILURES INTO V_JOB_NO, V_FAILURES
              FROM USER_JOBS
              WHERE WHAT LIKE '%' || V_NAME || '%'
              AND SCHEMA_USER = 'CATEBS';
    IF V_FAILURES = 3
    THEN DBMS_JOB.BROKEN(V_JOB_NO,TRUE,NULL); EXIT;
    END IF;
    FOR O IN MV_ORDER
    LOOP
    IF I.ORDER_OF_REFRESH > 2
    THEN V_NEXT_DATE:= (O.LAST_REFRESH + (3/86400)); -- Start next materialized view 3 seconds after completion of prior refresh
    END IF;
    END LOOP;
    END LOOP;
    EXCEPTION
    WHEN NO_DATA_FOUND
         THEN
              IF MV_LIST%ISOPEN
                   THEN CLOSE MV_LIST;
              END IF;
    NULL;
    END Next_Job_Refresh_Test2;
    ---------------------------------------------------------------------------------------------------------------------

    Justin,
    I think I am getting closer. I have a procedure shown just below this that updates my custom table with information from USER_SNAPSHOTS to reflect the time and status of the refresh completion:
    CREATE OR REPLACE PROCEDURE Upd_Disco_Mv_Refresh_Order_Tbl IS
    V_STATUS VARCHAR2(7);
    V_LAST_REFRESH DATE;
    V_MV_NAME VARCHAR2(30);
    CURSOR MV_LIST IS SELECT DISTINCT NAME, LAST_REFRESH, STATUS
                             FROM USER_SNAPSHOTS
                        WHERE OWNER = 'CATEBS';
    BEGIN
    FOR I IN MV_LIST
    LOOP
         V_STATUS := I.STATUS;
         V_LAST_REFRESH := I.LAST_REFRESH;
         V_MV_NAME := I.NAME;
    UPDATE DISCO_MV_REFRESH_ORDER A SET A.LAST_REFRESH = V_LAST_REFRESH
    WHERE A.MV_OBJECT_NAME = V_MV_NAME;
    COMMIT;
    UPDATE DISCO_MV_REFRESH_ORDER A SET A.REFRESH_STATUS = V_STATUS
    WHERE A.MV_OBJECT_NAME = V_MV_NAME;
    COMMIT;
    END LOOP;
    END Upd_Disco_Mv_Refresh_Order_Tbl;
    Next, I have a "new" procedure that does the job creation and refresh show just below this which, when starting the loop, sets the LAST_REFRESH date in my table to NULL and the STATUS = 'INVALID'. Then if the order of refresh = 1 then it uses SYSDATE to submit the job and start right away, else if it's not the first job, it uses V_NEXT_DATE. Now, V_NEXT_DATE is equal to the LAST_REFRESH date from my table when the view has completed and the V_PREV_STATUS = 'VALID'. I think tack on 2 seconds to that to begin my next job.... See code below:
    CREATE OR REPLACE PROCEDURE Disco_Mv_Refresh IS
    V_FAILURES NUMBER;
    V_JOB_NO NUMBER;
    V_START_DATE DATE := SYSDATE;
    V_NEXT_DATE DATE;
    V_NAME VARCHAR2(30);
    V_PREV_STATUS VARCHAR2(7);
    CURSOR MV_LIST IS SELECT DISTINCT A.ORDER_OF_REFRESH,
                                  A.MV_OBJECT_NAME,
                                  A.LAST_REFRESH,
                                  A.REFRESH_STATUS
                        FROM CATEBS.DISCO_MV_REFRESH_ORDER A
                        WHERE A.ORDER_OF_REFRESH <= 5
                   ORDER BY A.ORDER_OF_REFRESH ASC;
    BEGIN
    FOR I IN MV_LIST
    LOOP
    V_NAME := I.MV_OBJECT_NAME;
    V_FAILURES := 0;
    UPDATE DISCO_MV_REFRESH_ORDER SET LAST_REFRESH = NULL WHERE MV_OBJECT_NAME = V_NAME;
    UPDATE DISCO_MV_REFRESH_ORDER SET REFRESH_STATUS = 'INVALID' WHERE MV_OBJECT_NAME = V_NAME;
    IF I.ORDER_OF_REFRESH = 1
    THEN V_START_DATE := SYSDATE;
    ELSE V_START_DATE := V_NEXT_DATE;
    END IF;
    DBMS_JOB.SUBMIT(V_JOB_NO,'DBMS_MVIEW.REFRESH(' || '''' || V_NAME || '''' || '); BEGIN UPD_DISCO_MV_REFRESH_ORDER_TBL; END;',V_START_DATE,NULL);
    SELECT A.REFRESH_STATUS, A.LAST_REFRESH INTO V_PREV_STATUS, V_NEXT_DATE
    FROM DISCO_MV_REFRESH_ORDER A
    WHERE (I.ORDER_OF_REFRESH - 1) = A.ORDER_OF_REFRESH;
    IF I.ORDER_OF_REFRESH > 1 AND V_PREV_STATUS = 'VALID'
    THEN V_NEXT_DATE := V_NEXT_DATE + (2/86400);
    ELSE V_NEXT_DATE := NULL;
    END IF;
    END LOOP;
    EXCEPTION
    WHEN NO_DATA_FOUND
         THEN
              IF MV_LIST%ISOPEN
                   THEN CLOSE MV_LIST;
              END IF;
    NULL;
    END Disco_Mv_Refresh;
    My problem is that it doesn't appear to be looping to the next job. It worked succesfully on the first job but not the subsequent jobs (or materialized views in this case).... Any ideas?

  • How to get a materialized view get to refresh itself after the job is "broken"

    we created a materialized view sometime ago with the following statement:
    create materialized view SXV_PUB_EMPLOYEE_CERT_ALL_M
    refresh complete on demand
    start with to_date('30-08-2009 04:00:00', 'dd-mm-yyyy hh24:mi:ss') next trunc(sysdate) + (28/24)
    as
    select  sxv_emp_cert_all.*
    from    sxv_employee_certification_all sxv_emp_cert_all;
    this week we found out it had not been refresh for about a month
    In dba_jobs the column broken was 'Y', next_date time something like 01-01-4000 and failures 16
    when I ran it manually by executing
    BEGIN DBMS_MVIEW.REFRESH('SXV_PUB_EMPLOYEE_CERT_ALL_M', 'C'); END;
    I found that one of the columns was too small (probably a columns of one of the underlying tables had been extended since the creation of the materialized view)
    After fixing this I ussied yesterday (on 29-8-2013) the statement :
    alter materialized view SXV_PUB_EMPLOYEE_CERT_ALL_M
    refresh complete on demand
    start with to_date('30-08-2009 04:00:00', 'dd-mm-yyyy hh24:mi:ss') next trunc(sysdate) + (28/24)
    after this the table dba_jobs showed me 30-08-2013 04:00:00 as next date
    I was expecting it to run this night at 04:00, but it didn't
    the last_date column value was still from about a month ago, the column broken still shows 'Y'
    and the next date 30-08-2013 04:00:00 (while it should been set to 31-08-2013 01:00:00
    Rrunning
    BEGIN DBMS_MVIEW.REFRESH('SXV_PUB_EMPLOYEE_CERT_ALL_M', 'C'); END;
    gave no errors this time
    and in User_Mview_Analysis the last_refresh_date column showed the date/time I had executed it
    Any idea how to get the job "unbroken" again so that the view refreshes itself every night?
    the database is Oracle Database 10g Release 10.2.0.4.0
    regards,
    Remco

    thanx for all your helpful and correct answers . but eventually I found it myself
    exec dbms_job.broken(<jobnumber>, false);

  • Diagnosing 'broken' job

    Oracle 10.2.0.4.0 EE on HP-UX 11.23
    OEM (dbcontrol) is reporting 1 "broken" job and 2 "failed" jobs. Googling on fixing 'broken' jobs. A select on dba_jobs returns two rows. Following suggestions found elsewhere (mostly Burleson's site) I tried
    SQL> select job from dba_jobs where broken='Y';
           JOB
            50
            51
    2 rows selected.
    SQL> exec dbms_job.broken(JOB=>50, NEXT_DATE=>SYSDATE+1/1440, BROKEN=>FALSE);
    PL/SQL procedure successfully completed.
    SQL> commit;
    Commit complete.
    SQL> select job from dba_jobs where broken='Y';
           JOB
            51
    1 row selected.wait a couple of minutes ....
    SQL> /
           JOB
            50
            51
    2 rows selected.
    SQL> exec dbms_job.run(50);
    BEGIN dbms_job.run(50); END;
    ERROR at line 1:
    ORA-12011: execution of 1 jobs failed
    ORA-06512: at "SYS.DBMS_IJOB", line 413
    ORA-06512: at "SYS.DBMS_JOB", line 275
    ORA-06512: at line 1
    SQL>I keep running into dead ends on how to diagnose why the job is failing ... pointers appreciated.

    sb92075 wrote:
    I keep running into dead ends on how to diagnose why the job is failing ... pointers appreciated.manually invoke same procedure as JOB 50 does & see what happens
    SQL> select what from dba_jobs where job=51;
    WHAT
    BEGIN /*Quest PPCM Bottleneck job */  quest_ppcm_bottleneck.collect_data; END;
    1 row selected.
    SQL> BEGIN /*Quest PPCM Bottleneck job */  quest_ppcm_bottleneck.collect_data; END;
      2  /
    BEGIN /*Quest PPCM Bottleneck job */  quest_ppcm_bottleneck.collect_data; END;
    ERROR at line 1:
    ORA-06550: line 1, column 39:
    PLS-00201: identifier 'QUEST_PPCM_BOTTLENECK.COLLECT_DATA' must be declared
    ORA-06550: line 1, column 39:
    PL/SQL: Statement ignoredAnd the package body for QUEST_PPCM_BOTTLENECK is wrapped, so I'm not able to see what it is -- at least I don't know that I can. But being it is a well used commercial package, I'd not expect something like the error shown.
    FWIW, and should have pointed out in my original, this database was rebuilt from scratch -- used dbca to create a template from it, then create scripts from the template. Run the CREATE DATABASE and related scripts from dbca, then reload the application schemas from the nightly export.
    We could delete and re-install Spotlight (the only Quest product installed there) but as it's not critical at this point, I'd rather work through the problem as a learning exercise.

  • Unable to drop a broken job

    Hi Friends,
    i want to drop a broken job but it is taking long time why?
    i am using below syntax:
    begin
    dbms_job.broken(job=> 345,FALSE);
    commit;
    end;
    Thanx.

    Hi,
    you can drop the job and recreate it. To drop the job :-
    BEGIN
      DBMS_SCHEDULER.drop_job (job_name => 'job_name);
    END;To create a job
    BEGIN
      DBMS_SCHEDULER.create_job (
        job_name        => 'job_name',
        job_type        => 'PLSQL_BLOCK',
        job_action      => 'BEGIN your_procedure; END;',
        start_date      => SYSTIMESTAMP,
        repeat_interval => 'freq=hourly; byminute=0; bysecond=0;',
        end_date        => NULL,
        enabled         => TRUE,
        comments        => 'any_comment_you_want.');
    END;
    /

  • Problem with dbms_job.run

    Guys,
    I've written a simple PL\SQL program to schedule a job once in every 30 seconds.
    After that I ran that job SQL> begin
    dbms_job.run(1);
    end;
    SQL> /
    PL/SQL procedure successfully completed.
    It worked fine doing the task in every 30 seconds.
    After that I marked the job as broken.
    SQL> begin
    dbms_job.broken(3, true);
    end;
    SQL> /
    PL/SQL procedure successfully completed.
    And I marked the same job as not broken.
    SQL> begin
    dbms_job.broken(3, false)
    end;
    SQL> /
    PL/SQL procedure successfully completed.
    [b]Now if I run the job,as below,it doesn't seem to operate(every 30 seconds)SQL> begin
    dbms_job.run(1);
    end;
    SQL> /
    PL/SQL procedure successfully completed.
    Can someone help me out?
    Thanks,
    Bhagat

    Thanks Guys.
    My application access an Oracle server residing in a remote network.
    I've an Oracle job residing in the server,and doing the task of updating a document in my C drive every 3 minutes.
    If I disconnect the remote network and get connected back at a later time,Would the job the marked as broken?
    Or would it carry on with its job every 3rd minute,after I get network connected back?
    Can someone throw ideas?
    Thanks,
    Bhagat

  • Question about activating a broken job

    Dear all;
    I am trying to reactivate a job which was stopped in pl/sql developer. I am trying to do it using the following syntax and I keep getting the error message below.
    see syntax first
    begin
    sys.dbms_job.broken(103,'false',to_date('2010-10-12', 'YYYY-MM-DD'))
    end;error message
    ORA-06550 line 3, column 1:i have removed the end syntax and still get the message I dont know why. I am using oracle 9i

    I have included the ; but Unfortunately, I still get the error message
    ORA-06550
    PLS-00306
    Edited by: user13328581 on Oct 12, 2010 2:32 PM

  • Killing a DBMS_JOB

    How can a running DBMS_JOB in Oracle 9i can be killed. Will the procedure DBMS_JOB.BROKEN serve the purpose??

    Found this in the manual for 9i:-
    "" Note: If you set job as broken while it is running, Oracle resets the job's status to normal after the job completes. Therefore, only execute this procedure for jobs that are not running. ""
    So if its a job that resubmits every 5 mins it will tick again unless you change the next date/time as a parameter to BROKEN.
    DBMS_JOB.BROKEN (
    job IN BINARY_INTEGER,
    broken IN BOOLEAN,
    next_date IN DATE DEFAULT SYSDATE);
    Also from the manual:-
    "" Usage Notes:-
    You must issue a COMMIT statement immediately after the statement.
    BEGIN
    DBMS_JOB.BROKEN (nnnn,TRUE,);
    COMMIT;
    END; ""
    http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96612/d_job2.htm#1001110

  • How to stop a running job in 10g Scheduler?

    The following is a duplicate post. I posted the following to the general database forum before seeing that otn has a new scheduler forum:
    I am not able to find in the Admin Guide a method to stop a currently running instance of a job in the 10g scheduler.
    In 9i, I run the following script calling DBMS_JOB.broken and DBMS_JOB.remove to shut down currently running jobs:
    DECLARE
    jobid NUMBER;
    CURSOR c1
    IS
    SELECT job
    FROM dba_jobs
    WHERE priv_user = 'ME';
    BEGIN
    OPEN c1;
    LOOP
    FETCH c1
    INTO jobid;
    EXIT WHEN c1%NOTFOUND;
    DBMS_JOB.broken (jobid, TRUE);
    COMMIT;
    DBMS_JOB.remove (jobid);
    COMMIT;
    END LOOP;
    CLOSE c1;
    END;
    How may I create similar code to shut down currently running jobs using DBMS_SCHEDULER in 10g? According to the Admin Guide, disabling jobs with the force option will still allow the job to finish.
    How can I terminate a running job in 10g?

    You can stop a currently running job using the STOP_JOB api.
    STOP_JOB Procedure
    This procedure stops currently running jobs or all jobs in a job class. Any instance of the job will be stopped. After stopping the job, the state of a one-time job will be set to SUCCEEDED whereas the state of a repeating job will be set to SCHEDULED or COMPLETED depending on whether the next run of the job is scheduled.
    Syntax
    DBMS_SCHEDULER.STOP_JOB (
    job_name IN VARCHAR2
    force IN BOOLEAN DEFAULT FALSE);
    Parameters
    Table 83-44 STOP_JOB Procedure Parameters
    Parameter Description
    job_name
    The name of the job or job class. Can be a comma-delimited list. For a job class, the SYS schema should be specified.
    If the name of a job class is specified, the jobs that belong to that job class are stopped. The job class is not affected by this call.
    force
    If force is set to FALSE, the Scheduler tries to gracefully stop the job using an interrupt mechanism. This method gives control back to the slave process, which can update the status of the job in the job queue to stopped. If this fails, an error is returned.
    If force is set to TRUE, the Scheduler will immediately terminate the job slave. Oracle recommends that STOP_JOB with force set to TRUE be used only after a STOP_JOB with force set to FALSE has failed.
    Use of the force option requires the MANAGE SCHEDULER system privilege.
    Setting force to TRUE is not supported for jobs of type executable.
    Usage Notes
    STOP_JOB without the force option requires that you be the owner of the job or have ALTER privileges on that job. You can also stop a job if you have the CREATE ANY JOB or MANAGE SCHEDULER privilege.
    STOP_JOB with the force option requires that have the MANAGE SCHEDULER privilege.

  • Job submit error

    Guys,
    simply,
    i want to create temp_undo ( done ) and i want to do the following
    create or replace procedure temp_undo_procedures
    is
    CURSOR c is select a.name, b.status from V$rollname a, v$rollstat b
    where a.name IN (select segment_name from dba_segments where tablespace_name ='TEMP_UNDO')
    AND a.usn=b.usn;
    v_name1 v$rollname.name%type;
    v_status1 v$rollstat.STATUS%type;
    test1 varchar2(50);
    v_job_number number;
    begin
    open c;
    if c%notfound then
    test1 := 'good';
    Dbms_Output.put_line(test1);
    -- drop the tablespace.
    execute immediate 'drop tablespace temp_undo';
    select job INTO v_job_number from dba_jobs WHERE WHAT LIKE 'temp_undo_procedures';
    execute immediate dbms_job.broken(v_job_number,true);_ ==>i think this is error statement because i want to v_job_number come from the select statment and broke the job number that retrieve from select statment,
    end if;
    loop
    fetch c into v_name1, v_status1;
    exit when c%notfound;
    Dbms_Output.put_line(v_name1 || ' ' || v_status1);
    end loop;
    close c;
    end;
    VARIABLE v_jobnum1 NUMBER;
    BEGIN
    dbms_job.submit(:v_jobnum1,
    *'temp_undo_procedures', ==> also here i think this is error as well, coz i want to run this procedure every 5 min.*
    trunc(sysdate,'MI')+1/288,
    *'sysdate + (1/288)'*
    commit;
    END;
    plz help and add suggestion

    Can you try this?
    create or replace procedure temp_undo_procedures
    is
      CURSOR c
      is
        select a.name,
               b.status
        from V$rollname a, v$rollstat b
        where a.name IN (
                          select segment_name
                          from dba_segments
                          where tablespace_name ='TEMP_UNDO'
        AND a.usn=b.usn;
        v_name1 v$rollname.name%type;
        v_status1 v$rollstat.STATUS%type;
        test1 varchar2(50);
        v_job_number number;
    begin
        open c;
        loop
        fetch c into v_name1, v_status1;
        exit when c%notfound;
          if c%notfound then
          test1 := 'good';
          Dbms_Output.put_line(test1);
          -- drop the tablespace.
          execute immediate 'drop tablespace temp_undo';
          select job
          INTO v_job_number
          from dba_jobs
          WHERE WHAT LIKE 'temp_undo_procedures';
          execute immediate dbms_job.broken(v_job_number,true); -- ==>i think this is error statement because i want to v_job_number come from the select statment and broke the job number that retrieve from select statment,
        end if;
        Dbms_Output.put_line(v_name1 || ' ' || v_status1);
        end loop;
        close c;
    end;N.B.: Not Tested....
    Regards.
    Satyaki De

  • How do I submit a job to run only once?

    I have a stored procedure that submits a job. If this job fails, I don't want it to continue trying to run. Does anyone know how to ensure that it will only run once, no matter what?
    I did try something similar to the following:
    procedure proc_submitted_as_job(p_job_no number) is
    begin
    dbms_job.broken(p_job_no, true);
    end;
    However, I found out that if you change the Broken state while a job is running, then it gets reset when the job completes.
    Basically, I'm using the dbms_job utility to run a long-running procedure in the background. If there's another way to obtain this same result, I'd love to hear it.

    I am still haveing problems so I will try and attach my program and see if you can help a little more that. It will probably be easier for you to look at this way. When you look at the diagram sequence 0 is the one the problem is in. In that sequence you will see a case structure and that is where the finite pulse train vi is. When case 1 is selected the finite pulse train will run again and again until I leave case 1. I need to have the program run the finite pulse train once and then wait and do nothing until the case is changed. The finite pulse train will be in all cases inside the case structure I just haven't done that yet, I am waiting until it works. The pulse train is used to move a stepper motor that is why running only once is im
    portant because the stepper motor is used to position something.
    Attachments:
    AMC_Eagle_Both_Inputs_Working_2.vi ‏266 KB

  • Uniques constraint violation error while executing statspack.snap

    Hi,
    I have configured a job to run the statspack snap at a interval of 20 min from 6:00 PM to 3:00 AM . Do perform this task , I have crontab 2 scripts : one to execute the job at 6 PM and another to break the job at 3 AM. My Oracle version is 9.2.0.7 and OS env is AIX 5.3
    My execute scripts look like:
    sqlplus perfstat/perfstat <<EOF
    exec dbms_job.broken(341,FALSE);
    exec dbms_job.run(341);
    The problem is , that the job work fine for weekdays but on weekend get aborted with the error :
    ORA-12012: error on auto execute of job 341
    ORA-00001: unique constraint (PERFSTAT.STATS$SQL_SUMMARY_PK) violated
    ORA-06512: at "PERFSTAT.STATSPACK", line 1361
    ORA-06512: at "PERFSTAT.STATSPACK", line 2471
    ORA-06512: at "PERFSTAT.STATSPACK", line 91
    ORA-06512: at line 1
    After looking on to metalink , I came to know that this is one listed bug 2784796 which was fixed in 10g.
    My question is , why there is no issue on weekdays using the same script. There is no activity on the db on weekend and online backup start quite late at night.
    Thanks
    Anky

    The reasons for hitting this bug are explained in Metalink, "...cursors with same sql text (at least 31 first characters), same hash_value but a different parent cursor...", you can also find the workaround in Note:393300.1.
    Enrique

  • Snapshot refresh interval

    Hi,
    I would like to know how to create a snapshot refresh group that would refresh the snapshot daily between 0800 hrs to 1700 hrs.
    Appreciate any inputs.
    Thanks & Kind Regards,
    Zaid

    Standard disclaimer-- 8.0.5 has been desupported for many years, you really ought to upgrade. Most of the folks on this and other forums haven't seen an 8.0.5 system in quite some time, so there may be version-specific caveats that we've long forgotten.
    When a job fails, the error should be written to the alert log.
    When a job fails, it will be rescheduled with an increasing delay (1 sec, 2 sec, 4 sec, 8 sec, ...) for 16 times. If it fails 16 times in a row, the job is marked as broken.
    You can use the DBMS_JOB.BROKEN method to indicate that a job is no longer broken. You generally want to fix the underlying problem first, though.
    Justin

  • Workflow Process and Mappings restart problem

    Hi All,
    Sometimes our database crashes and shutdowns ( few dba issues) . All the running workflows \ mappings restarts again when our database is restarted. We do not want this to happen. Is there some property which can be set that would not restart the workflows/ mappings which were running at the time of database crash \ shutdown ?
    Thanks,
    Sam.

    Hi Sam ,
    You can configure the Control Center Service in such a way that it will not start (unless you start it) when your database restarted .
    To disable the OWB service from starting up automatically upon database startup, the DBMS job has to be disabled :
    1. Log into sqlplus as Repository Owner.
    2. Find the job number for the 'wb_rti_service_job.check_service' entry in the dba_jobs table :
    SQL> select job, schema_user from dba_jobs where what = 'wb_rti_service_job.check_service(1);';
    3. Disable the corresponding job :
    SQL> exec dbms_job.broken(<job#>,TRUE);
    Thanks,
    Sutirtha

Maybe you are looking for

  • Accommodation of multiple space characters without using nbsp - request

    I have dot matrix printer and i want to generate a report using character position and line position. For example a line can accommodate 80 chacters and in a page generally accoomdates 72 lines. I need to display column value padded with space charac

  • Remote Access VPN Support in Multiple Context Mode (9.1(2))?

    Hi Guys, I am currently running two Cisco ASA5520 (ASA Version: 9.1(2)) firewalls in Active/Standby failover and was contemplating the option of migrating my remote access VPN to these firewalls. However seeing that the new IOS now support mixed mult

  • ITunes doesn't communicate with Nano

    I have tried forfive days to get my Nano to work... I always get the same error message saying that iTunes cannot comunicate with the iPod and that I have to install it again. I also get an error in the iPod updater. I already tried everything in the

  • Temporary Tablespace Issue

    Hello, Oracle 10g when checking temporary tablespace through sql query it gives the below output. whereas when i check through enterprise manager it shows autoextentible upto 2GB. SQL>  select *from DBA_TABLESPACES   2   where   3   tablespace_name=

  • Emailing/Opening/Sending a Pages Document

    When I save a file in Pages, it never seems to be compatible with any windows machine. When sending the file by email, it doesn't even give me an option to send the Pages file. They are still all in grey. Not sure why or what I need to do. Ideas? Tha