DBMS_JOB and LOG_USER

We have a procedure, ("START_JOBS"), which executes a series of DBMS_JOBS. As part of the running of those jobs, which insert and update data, the Oracle user id is captured and stored in the table as the "last_update_user_id". The problem is, as the database is being brought up, our DBA runs this "START_JOBS" procedure as SYS, thus SYS is stored in the tables as the "last_update_user_id". I would like these jobs to execute as the schema_user, not as the log_user(SYS). I realize I could use triggers to change the LAST_UPDATE_USER_ID from SYS to the schema_user, but I was wondering if there's a way to set up the "START_JOBS" procedure to run as the schema user, and not who executes the procedure.
Thanks in advance.

I have couple of packages which are presently scheduled in dbms_job
In this one package is running by connecting as USER1(log_user,privilige_user,schema_user in dbms_job table)
and the other package is running by connecting as USER2.
we are planning to move these to shell scripts due to some business reasons.
In our shell scripts we dont hard code the username/password. It seems like there is a
oracle wallet setup for this.
As of now all the packages that we have run with 1 user (user 3).
But the above packages that i mentioned have to run with user1 and user2 only..
How shall we set up the wallet in this scenario?If you are using Oracle 10g or later, you might want to consider changing to dbms_scheduler (as opposed to dbms_job), as it contains much more features.
Alternately, if you want to move to shell scripts, create an externally identified user.

Similar Messages

  • DBMS_JOBS and UTL_FILE

    Hi,
    I use a stored proc to read a file using utl_file. The file is owned by an OS user other then oracle, but both are in the same group and the file has rw permission for the group. If I run the procedure by sqlplus or toad it's all ok. If I use a dbms_job.submit I get an invalid operation exception. With Oracle 8.1.7 all went fine. It seems to be an os user related problem, but I cannot see anything wrong. I use Oracle 9.2 and IBM AIX 5.3.
    Any idea?
    Thank you
    Pierandrea

    I resolved the problem. I was sure to have shutted down/restarted the db and the listener. instead i did not. As soon as I bounced all the procedure worked fine.
    Thank you all
    Pierandrea

  • Dbms_job and rman

    Hi,
    I am interestd to know whether it is possible to execute an RMAN stored script by using dbms_job to schedule the job.
    thanks,
    Shai

    No, it is not possible. You need to use
    a scheduling tool to run RMAN scripts.
    Use one of the following:
    1) "cron" on UNIX
    2) Oracle Enterprise manager
    3) Third-party scheduling tool (like ECS/Control-M)
    4) Some backup software (like Legato) also has scheduling capabilities
    Regards,
    Sev

  • 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?

  • DBMS_JOB

    I'm sure you have all had enough questions from me in the past few days! but you all are so helpful i can't stop my self from attempting to get as much help as i can :D its hard to read through documentation 50 pages long when you all usually have a paragraph answer that gives me the important stuff that i am missing linking together...
    I've figured out how to send an e-mail using a trigger and a procedure when an employee is inserted into the employee table. (this is for school- but showing that you can e-mail someone to notify them that an event has occured within the database).
    I've been reading about DBMS_JOB and it looks like i could use this in the procedure so intead of sending the e-mail right away, i could add this to a list of jobs and it would take place after the commit?
    I don't understand the documentation on dbms_job very well...
    Is it possible to make dbms_job occur when commit has taken place?
    Would this work for my situation? i've included some code.
    Any ideas on where i'd get started with it?
    Any input would be wonderful- thanks again everyone.
    create or replace
    PROCEDURE proc (p_sender IN VARCHAR2,
    p_recipient IN VARCHAR2,
    p_message IN VARCHAR2, p_subject IN VARCHAR2)
    as
    l_mailhost VARCHAR2(255) := 'my smtp';
    l_mail_conn utl_smtp.connection;
    nline VARCHAR2(2):= UTL_TCP.CRLF;
    BEGIN
    l_mail_conn := utl_smtp.open_connection(l_mailhost, 25);
    utl_smtp.helo(l_mail_conn, l_mailhost);
    utl_smtp.mail(l_mail_conn, p_sender);
    utl_smtp.rcpt(l_mail_conn, p_recipient);
    utl_smtp.open_data(l_mail_conn );
    utl_smtp.write_data(l_mail_conn, nline || 'From' || ': ' || p_sender || nline);
    utl_smtp.write_data(l_mail_conn, 'To' || ': ' || p_recipient || nline);
    utl_smtp.write_data(l_mail_conn, 'Subject'|| ': ' || p_subject || nline);
    utl_smtp.write_data(l_mail_conn, 'Message' || ': ' ||p_message || nline);
    utl_smtp.close_data(l_mail_conn );
    utl_smtp.quit(l_mail_conn);
    end;
    CREATE OR REPLACE TRIGGER emailInsertTrigger
    BEFORE INSERT ON EMPLOYEE
    FOR EACH ROW
    DECLARE msg varchar2(2000);
    BEGIN
    msg := chr(13) || chr(10) || chr(13) || chr(10) || 'New Employee Information: ' || chr(13) || chr(10) || 'SSN: ' || to_char(:new.ssn) || chr(13) || chr(10) || 'Name: ' || :new.fname || ' ' || :new.minit || ' ' || :new.lname || chr(13) || chr(10) || 'Birth Date: ' || to_char(:new.bdate, 'Month DD, YYYY') || chr(13) || chr(10) || 'Address ' || :new.address || chr(13) || chr(10) || 'Sex: ' || :new.sex || chr(13) || chr(10) || 'Salary: ' || to_char(:new.salary,'$9999,999.00') || chr(13) || chr(10) || 'Supervisor SSN: ' || to_char(:new.super_ssn) || chr(13) || chr(10) || 'Department Number: ' || to_char(:new.dno);
    proc('my e-mail','my e-mail','msg','subject');
    dbms_output.put_line('e-mail sent');
    END;
    Edited by: user12264910 on Nov 30, 2009 12:19 PM

    It is giving me an error- i can't figure out these last two variables.... i tried the one you suggested and got error as well.
    CREATE OR REPLACE TRIGGER emailInsertTrigger
    BEFORE INSERT ON EMPLOYEE
    FOR EACH ROW
    DECLARE
    msg varchar2(2000);
    l_jobno integer;
    BEGIN
    msg := chr(13) || chr(10) || chr(13) || chr(10) || 'New Employee Information: ' || chr(13) || chr(10) || 'SSN: ' || to_char(:new.ssn) || chr(13) || chr(10) || 'Name: ' || :new.fname || ' ' || :new.minit || ' ' || :new.lname || chr(13) || chr(10) || 'Birth Date: ' || to_char(:new.bdate, 'Month DD, YYYY') || chr(13) || chr(10) || 'Address ' || :new.address || chr(13) || chr(10) || 'Sex: ' || :new.sex || chr(13) || chr(10) || 'Salary: ' || to_char(:new.salary,'$9999,999.00') || chr(13) || chr(10) || 'Supervisor SSN: ' || to_char(:new.super_ssn) || chr(13) || chr(10) || 'Department Number: ' || to_char(:new.dno);
    dbms_output.put_line('e-mail sent');
    dbms_job.submit(l_jobno, 'execute proc(''[email protected]'', ''[email protected]'', ' || msg || ' , ''TESTINGNEW'');', SYSDATE, SYSDATE);
    dbms_output.put_line( 'Job ' || l_jobno || ' submitted.');
    END;
    SQL> @newtrig.sql
    Trigger created.
    SQL> insert into EMPLOYEE values ('test1f','test1l1','A','111135111', to_date('2001/01/01','yyyy/mm/dd'), '1 test rd', 'M', 11111, '123411111' , 1)
    ERROR at line 1:
    ORA-06550: line 1, column 166:
    PLS-00103: Encountered the symbol "" when expecting one of the following:
    ( - + case mod new not null others <an identifier>
    <a double-quoted delimited-identifier> <a bind variable> avg
    count current exists max min prior sql stddev sum variance
    execute forall merge time timestamp interval date
    <a string literal with character set specification>
    <a number> <a single-quoted SQL string> pipe
    ORA-06512: at "SYS.DBMS_JOB", line 79
    ORA-06512: at "SYS.DBMS_JOB", line 136
    ORA-06512: at "MDIBLA1.EMAILINSERTTRIGGER", line 7
    ORA-04088: error during execution of trigger 'MDIBLA1.EMAILINSERTTRIGGER'
    any suggestion?

  • Error in sending mail with dbms_job

    Hello,
    I have a procedure, that sends e-mails. Procedure works fine and sends the e-mails as far as I execute it from APEX "SQL Commands". It also causes no errors when I have submitted it to DBMS_JOB, but the procedure does not need to send any e-mails. However, as soon as it is executed by DBMS_JOB and the procedure calls htmldb_mail.send, there is a failure. Alert log:
    Errors in file /usr/lib/oracle/xe/app/oracle/admin/XE/bdump/xe_j000_31507.trc:
    ORA-12012: error on auto execute of job 185
    ORA-20001: This procedure must be invoked from within an application session.
    ORA-06512: at "FLOWS_030000.WWV_FLOW_MAIL", line 109
    ORA-06512: at "FLOWS_030000.WWV_FLOW_MAIL", line 139
    ORA-06512: at "RAHEL.P_SEND_CASE_INFO", line 80
    I suppose, that there is some security problem for DBMS_JOB to execute htmldb_mail.send?
    What could be the solution?

    Alar:
    Please see this thread for a solution
    Re: wwv_flow_api.set_security_group_id and sending mail external to ApEx
    Varad

  • Calling RMAN script with DBMS_JOB

    Hi,
    Maybe someone can help me out. I'm perfecting my skills on 9i in the backup area before I have a need to use them and am taking notes.
    What I want to do is to store the backup script in the recovery catalog (which I already did under the name BACKUP) and call that script on a daily basis using DBMS_JOBS.
    Here is my script:
    RMAN>CREATE SCRIPT 'BACKUP'
    {ALLOCATE CHANNEL C1 TYPE DISK;
    BACKUP INCREMENTAL LEVEL 0 DATABASE
    FILESPERSET 4;
    BACKUP ARCHIVELOG ALL;
    DELETE ARCHIVELOG UNTILTIME 'SYSDATE-7';}
    This script compiled and is stored in rman. I ran it and it worked. I also autoconfigured the parameters to backup the controlfile automatically when the backup or copy is done.
    Now my next goal is to get this script to run automatically everyday using DBMS_JOBS and this is where it is not working.
    I used the DBMS_JOB.SUBMIT parameters to store the job in this feature but first the procedure 'RUNBACKUP' must compile successfully.
    DBMS_JOB.SUBMIT(:1,'RUNBACKUP', SYSDATE,'SYSDATE+1');
    This RUNBACKUP is a procedure that has to be called by the DBMS_JOBS PACKAGE. But the procedure is where Im having problems trying to write.
    I am assuming that rman is not connected to the target database here. So this is what I think it should look like:
    CREATE OR REPLACE PROCEDURE RUNBACKUP
    BEGIN
    RMAN; --the first thing that           
    has to be called is rman executable.
    CONNECT TARGET AL/AL@BBROWN
    --now we have to connect the target db to rman.
    CONNECT CATALOG RMAN/RMAN@RCAT;
    -- connecting to the recovery catalog.
    RUN {EXECUTE SCRIPT 'BACKUP';} --execute the stored backup script
    END;
    Also, at the end of this procedure I would like to exit rman as the final command.
    Any ideas on this would be appreciated and thanks for your help in advance.
    Al

    You need to create a shell script to execute rman and add that script to cron, something like this:
    #!/bin/ksh
    # Script name: whole_db_backup.ksh
    export PATH=/oracle/app/9i/bin:$PATH
    export ORACLE_HOME=/oracle/app/9i
    export ORACLE_SID=MDR
    rman <<EOF
    connect target /
    connect catalog rmancat/PASS@RMANCAT
    run {execute script whole_db_backup;}
    exit
    EOF

  • Oracle RAC and datacontrol

    Hello, I have an Oracle RAC 10gR2 with 2 nodes on Suse Linux Enterprise Server 10. When I enter on the enterprise manager database control (no grid control). I see the follow message:
    "Availability calculations for the cluster database target are disabled. Please enable the DBMS JOB EMD_MAINTENANCE.EXECUTE_EM_DBMS_JOB_PROCS for Database Control."
    What is it? How can I clean it?
    Thanks in advance.

    Check out MOS note :
    What is EMD_MAINTENANCE.EXECUTE_EM_DBMS_JOB_PROCS dbms_job and how to Remove / Re-create it [ID 444033.1]
    Regards
    Rajesh

  • DBMS_JOB.REMOVE procedure

    Hi,
    I submitted a Stored Proc as an Oracle JOB using DBMS_JOB.SUBMIT procedure to execute everyday. I checked it in DBMS_JOBS and USER_JOBS views, I couldn't find it. I submitted the job again. Now that I could see two jobs scheduled (the same procedure) for a daily execution. If I remove the jobs using DBMS_JOB.REMOVE procedure and check the dbms_jobs view in the same session, I cannot see the jobs as scheduled. When I check from another session, the jobs are still scheduled and both of them gets executed on a daily basis now, which I don't need. Why the DBMS_JOB.REMOVE is not removing the job from the job queue? Any clue?
    My Oracle Version is 9.2
    meetme

    If you have exited from the session using exit, then, the job which you remove should have gone. I mean, when you use exit from the session pre-commit take place.

  • Help with Interval for DBMS_JOB

    Hi,
    I'd like to create a job using DBMS_JOB and schedule it to run once every month on the first Saturday of the month at 10 in the morning. How would i write the interval for this?
    Thanks.

    user629987 wrote:
    I have created the job in TOAD (the easy way) and now I am trying to reset the interval using the following statement....
    exec dbms_job.interval(81460, next_day(last_day(trunc(sysdate)),'SAT'));
    ...so that it executes on the first saturday of every month ( i haven't figured out how to include the time component yet so that it will execute at 10am), The expression you gave always returns midnight on Saturday. 10 AM on Saturday is 10/24 of a day after that, so add (10/24).
    but the statement gives me the following error:
    >
    ORA-23319: parameter value "03-MAR-12" is not appropriate
    Any ideas how to fix this? Thanks.The 2nd argument of interval is supposed to be a string, such as 'SYSDATE + 7', taht can be evaluated dynamically. You're passing a DATE. Try:
    exec dbms_job.interval (81460, 'next_day (last_day (trunc(sysdate)), ''SAT'') + (10/24)');Edited by: Frank Kulash on Feb 14, 2012 7:59 AM
    Repeated the single-quotes around SAT, since that's inside a string literal.

  • RW_SERVER_JOB_QUEUE differencies between 10g AS and 10g AS R2

    I opened a SR on this and got asked to post here..
    What are the differences between the RW_SERVER_JOB_QUEUE table between the 2 versions?? I'm not that interested in table definition changes but more how the contents of the record especially "COMMAND_LINE" differ.
    Many thanks in advance
    Ian L.

    Another case of the documentation being less than precise - it happens.
    Without personally having investigated, that's my understanding as well bearing in mind the following observation/explanation in the same article which seems to apply for all except 11gR2:
    Although you typically use the JOB_QUEUE_PROCESSES initialization parameter to limit
    the number job queue processes for DBMS_JOB and you use the Scheduler attribute
    max_job_slave_processes to limit the number of job slave processes for the Scheduler,
    the Scheduler is affected by the JOB_QUEUE_PROCESSES parameter.
    The maximum number of job slave processes for Scheduler is determined by the lesser
    of the values of JOB_QUEUE_PROCESSES and max_job_slave_processes. For example:
    If JOB_QUEUE_PROCESSES is set to 10 and max_job_slave_processes is set to 20,
    the job coordinator will start no more than 10 job slave processes to be shared
    between DBMS_JOB and the Scheduler.
    If JOB_QUEUE_PROCESSES is 20 and max_job_slave_processes is 10, the coordinator
    will start up to 20 job slave processes. The Scheduler can use only 10 of these,
    but DBMS_JOB can use all 20.
    If JOB_QUEUE_PROCESSES is 0, DBMS_JOB is disabled, and the maximum number of
    job slave processes for Scheduler is controlled by the max_job_slave_processes
    Scheduler attribute.

  • Help needed for replication environment. atleast get me good URL links.

    Hi friends,
    Our database is having nearly 150 tables and 200 views, 10 database procedures, 5 database triggers, 5 DBMS_JOB, and 15 users are using. it is ORACLE 8i under win 2000 environemnt. daily 5000 new records are inserted into the database.
    now i want to have a standby database, read and write complete replication of master database, in this following scenario.
    all the clients are conneting uisng connect string "terminal", if any thing happens to the "terminal" computer, the users could be able able to connect using "terminal1" lets say this "terminal1" is the stand by database and it should be functional as original.
    any body can give documentation, easy methods, or step by step documentation. we have access to metalink also. but failed to get easy methods to achieve this.
    thanks in advance

    is a very complicated thing you want to do: it is what Oracle call the Standby database or Dataguard - it's part of the Enterprise Edition, but I don't know whether Oracle charge extra for it. If you are not an experienced Oracle DBA (and, forgive me, but some of your other posts suggest you are not) you do not want to try doing this yourself. Pay Oracle's wergild and get their solution for this.
    Replication is really not suitable for this sort of process as it doesn't function well in real-time; this means you cannot guarantee keeping the two databases usably up-to-date. That causes a problem later on when you need to switch to your back-up database. And again when your original database is back online. Plus replication is flaky and has performance costs (voice of experience).
    Cheers, APC

  • PL/SQL code written in db or in application...????

    Hi ,
    Which is the best...at performance , maintability... e.t.c.???
    To write PL/SQL as validation process of data values going to be inserted in db:
    1) as db trigger (before insert or update row-level trigger)
    2) in application level - in Forms10g...
    This PL/SQL code compares some pairs of data values only.... there DML statement....
    Both db server and App server are considered to be or in the same machine or in two machines very close to each other...
    Note: i use Db10g .
    Thanks...
    Sim

    It is all about moving parts. How many there are. Where they are located.
    The less moving parts, the less the complexity, the bugs - and the better the performance (less wheels to turn to crunch data), the easier the maintenance and the better the flexibility.
    Part of this is having the moving parts close to the data. Kind of obvious - what is faster? Shipping data from the db engine to a front-end application via a app server and web server? Or shipping the data from the db (SQL) engine to a PL/SQL process running as part and parcel of db instance? IPC is significantly faster than TCP/IP.
    Having the moving parts close to the data also means that it can scale with the data. Oracle is good at scalability. It is designed at its very core to be scalable. Partitions to reduce I/O. Shared Server to reduce o/s resource footprint per client session. Shared pool to re-use SQL. DB buffer to cache data. RAC to run multiple db instances for a single physical database. Etc. Etc.
    With the application moving parts being close to the data, it inherits this scalability. You can "multi-thread" application code using table pipelines. You have access to forking application code using background processes (DBMS_JOB and DBMS_SCHEDULER). You have bulk processing in order to transfer more data per SQL engine call, between the buffer cache and your application, and thus also reduce expensive context switching.
    This list goes on and on.
    All this is summarised into the following rules.
    Rule 1. Do it in SQL.
    Rule 2. Only when SQL cannot do it, use PL/SQL. (e.g. SQL is not suited for managing and controlling process flow - PL/SQL is)
    Rule 3. Only when PL/SQL cannot do it, use <insert-language-here> (e.g. PL/SQL cannot render a Windows grid on the client - but Delphi/C#//Java can).
    Also keep in mind that in the modern client-server paradigm we deal with a web architecture. Which means the client is a web browser. And this means that PL/SQL can pass the data (HTML) required by the client (web browser) to render the User Interface.
    Have a look at APEX (Oracle's Application Express) for how this works. http://apex.oracle.com
    All you need to develop web applications is APEX (a PL/SQL product suite in the database) and a web browser. Kickass stuff... :-)

  • Advise on using DBMS_XA with multiple branches under one global transaction

    Dear all
    I need some advise on using DBMS_XA from PL/SQL with tightly coupled multiple branches under one global transaction. Basically, I've successfully written some PL/SQL code that in 3 different sessions attaches to 3 different branches of one global transaction and before ending each branch they can see each others uncommitted data. So far so good.
    However, I'm not sure I completely understand how each branch must call xa_end, xa_prepare and xa_commit correctly using two phase commit and my calls result in errors like:
    ORA-24767: transaction branch prepare returns read-only (XA error code 3 = Transaction was read-only and has been committed)
    ORA-24756: transaction does not exist (XA error code -4 = XID is not valid)
    ORA-02051: another session or branch in same transaction failed or finalized
    This is the structure of my programs (3 SQL*Plus sessions):
    main: Uses xid 123|0 (branch 0 of global transaction 123). This should be the coordinator that commits using two phase commit across the 3 branches
    m1.xa_start tmnoflags
    m2.DML
    m3.Wait for thread A + B to manually be started and run xa_end
    m4.xa_end tmsuccess
    m5.xa_prepare
    m6.xa_commit false
    thread A: Uses xid 123|A (branch A of global transaction 123)
    a1.xa_start tmnoflags
    a2.DML -- thread A can see main and thread B's data
    a3.xa_end tmsuccess
    a4.xa_prepare -- required?
    a5.Should we also call xa_commit false?
    thread B: Uses xid 123|B (branch B of global transaction 123)
    b1.xa_start tmnoflags
    b2.DML -- thread B can see main and thread A's data
    b3.xa_end tmsuccess
    b4.xa_prepare -- required?
    b5.Should we also call xa_commit false?
    The failing steps are:
    m5
    m6
    a4
    a5
    b4
    b5
    Before starting calling xa_end I see 3 rows in V$GLOBAL_TRANSACTION, eg (hex 7B = decimal 123):
    FORMATID GLOBALID BRANCHID BRANCHES REFCOUNT PREPARECOUNT STATE FLAGS COUPLING
    203348753 0000007B 00000000000000000000000000000000 3 3 0 ACTIVE 0 TIGHTLY COUPLED
    203348753 0000007B 0000000000000000000000000000000A 3 3 0 ACTIVE 0 TIGHTLY COUPLED
    203348753 0000007B 0000000000000000000000000000000B 3 3 0 ACTIVE 0 TIGHTLY COUPLED
    Thanks a lot in advance.
    Cheers
    Finn

    OK, I've figured it out. This is poorly documented as it's not well explained how to handle the various return codes. Turns out that all but the last xa_prepare calls return dbms_xa.xa_rdonly (tightly coupled branches are combined -- "read only" optimization), the last one returns dbms_xa.xa_ok and this is when you should call xa_commit.
    Now my next problem is that DBMS_XA doesn't work from within jobs (DBMS_JOB and DBMS_SCHEDULER), which makes it very difficult to use DBMS_XA. My purpose of using DBMS_XA is to coordinate work across multiple sessions in one transaction but if I can't easily create the multiple sessions, I'm stuck.
    When called from a job, xa_start throws:
    ORA-24789: start not allowed in recursive call
    on Oracle 11.2. In Oracle 11.1 it works, but xa_end fails with
    ORA-25352: no current transaction
    so I guess in fact the xa_start call didn't really work either, even though it returned tm_ok.
    I'm now trying to find a workaround on how to use DBMS_XA from within jobs, please comment if you have any suggestions. Or if you have any suggestions on other means of establishing the concurrent sessions (I wouldn't like to resort to external programs that need username/password to connect as password management would be a security issue).
    Thanks in advance.
    Cheers
    Finn

  • Question on schedule jobs

    Hi,
    i created two varients of the job as shown belo.
    1)
    DECLARE
      X NUMBER;
    BEGIN
      SYS.DBMS_JOB.SUBMIT
        ( job       => X - job name as 'X'
         ,what      => 'DEL_EMPLOYEE_TABLE;' - ITS A STORED PROCEDURE
         ,next_date => to_date('19/05/2009 01:00:00','dd/mm/yyyy hh24:mi:ss')
         ,interval  => 'trunc(sysdate) + 1/24 + 1'
         ,no_parse  => TRUE
      SYS.DBMS_OUTPUT.PUT_LINE('Job Number is: ' || to_char(x));
    END;
    2)
    begin
    dbms_scheduler.create_job (
    job_name => 'DEL_EMPLOYEE_TABLE',
    job_type => 'STORED_PROCEDURE',
    job_action => 'DEL_EMPLOYEE_TABLE',
    number_of_arguments => 0,
    start_date => SYSTIMESTAMP,
    repeat_interval => 'FREQ=DAILY;BYHOUR=0;BYMINUTE=0;BYSECOND=0',
    end_date => NULL,
    enabled => TRUE,
    comments => 'Delete EMPOYEE old records');
    end;
    i have the following questions
    1) what is the difference between #1 and #2
    2) When i queried the DB with following query i could see only
    select owner, job_name, state from dba_scheduler_jobs
    i could see only
    'DEL_EMPLOYEE_TABLE' - job but do not see the #1 job as - X

    [email protected] wrote:
    1) what is the difference between #1 and #2They use two different schedulers, the old one (DBMS_JOB) and the new one (DBMS_SCHEDULER)
    2) When i queried the DB with following query i could see only
    select owner, job_name, state from dba_scheduler_jobs
    i could see only
    'DEL_EMPLOYEE_TABLE' - job but do not see the #1 job as - XYou can find it using:
    select * from user_jobsMax
    http://oracleitalia.wordpress.com
    Edited by: Massimo Ruocchio on Mar 9, 2010 9:37 PM
    typos

Maybe you are looking for

  • Why I have a error while deploying a BPM Proyect in a BPM Enterprise?

    Hi everybody: I am deploying a BPM Proyect in a BPM Enterprise and when I upload the proyect, this error is showed: Can not publish the project. Compile Error Process: Error: Devolver a caja - The activity "Devolver a caja" does not have a screen flo

  • Hi stacked canvas blinking...

    Hi I am using oracle form 6i Actually i have two canvases 1.content 2.stack canvas In contend canvas i have a button when button pressed trigger show_view('canvas_transaction'); when i pressed the button its blinging and not visible for long time...

  • Which paragraph style options break TOC generation?

    Hi, I've had a problem with generating tables of contents in InDesign CS3 and which persists in InDesign CS4. After much experimenting I've learned that there's something in the paragraph style settings for the headings I want to include in a TOC tha

  • My environment is 99% of the way there, but my ARR reverse proxy doesnt seem to be forwarding lyncdiscover properly. Can someone help?

    I recently cut over from lync 2010 with an apache reverse proxy to a lync2013 deployment using microsoft ARR as the reverse proxy. Last night i cut over to the new ARR reverse proxy but our lync 2013 mobility tests didnt go well. I also cant get the

  • Podcast Issues in iTunes 7.0.1

    Occasionally my computer generates a good deal of heat (stupid Pentium 4). When it does, the fail safe kicks in and the computer is shut down. This happens sometimes when I am downloading podcasts... After I reboot my laptop and re-open iTunes i get