OEM job : How to force job status after a PLSQL job run?

Hello,
We are under 10gR2, using OEM with a lot of jobs that call PLSQL procedures.
For some obscur reason, when a PLSQL procedure fails, the job status is always "Succeeded". This is not useful at all !!!
So, as we don't kow why, I was thinking about setting the return job status in the PLSQL procedure itself ...
Is it possible ?
How can I do that ?
I hope that my explanation is clear.
Thanks for your help,
Olivier

Hi Olivier
I dont understant the first time.
Yes its very stange that the job appear like suceed and the PL procedure had failed.
If you want more control to this situation, in my situation i had too much problems with jobs that executing SQL scripts.
Then i change the SQL SCRIPT JOB for OS SCRIPTS JOB and in this scripts i can controlling the execution
This an example
Job Statistics.sh
Gric Control --> Job --> Operating System Script
/home/oracle/script.sh --> In the parameter line of the job
# the script.sh
ORACLE_HOME=/oracle/10.2
ORACLE_SID=PROD
$ORACLE_HOME/bin/sqlplus "/ as sysdba" << EOF
execute dbms_mview.refresh('MVIEW_SALES','f');
EOF
res=$?
if [ ${res -ne 0 }
then
mailx -s THE_JOB_HAD_ERRORS [email protected]
else
mailx -s ok_execution [email protected]
fi
In my enviroment was a solution to control the exact execution of the jobs
Regards

Similar Messages

  • How to get the Status code of rwclient when run as a background job

    Hi all,
    i have to get the return code(status code) of the rwclient.exe while running as a batch script. is it possible to get the return code to check whether the report generated succefully or not?
    please help me if anyone has the solution.
    Thanks in advance
    Deena

    Hi Andi,
    Please see my Blog : /people/dhanabal.thangavel2/blog/2009/12/16/getting-daily-failed-message-list-in-xi-and-sending-an-alert-mail-with-attachementcsv-file-of-that-list
    I think it 'll help you on this.
    Cheer,
    Dhanabal

  • How to force database replication after CUCM upgrade

    Hello All, I will be doing an upgrade to version 10.5 from 8.5 of CUCM. I've done this before and as documented started with the publisher and then subscriber. When I have done this I always wait and check Database replication via RTMT and the CLI.
    I'm always nervous as this process seems to take a long time. Is this just a waiting game or is there a command that I can force replication to my subscribers? How long should this process really take? I never know....
    Thanks,
    Dan

    Dan,
    Use "utils dbreplication runtimestate" to check the replication status of your servers in the cluster. The servers should show connected to the publisher and a status of 2
    Or you can use unified reporting to generate report on db replication as follows.
    Check Database Replication:
    Access Publisher CUCM GUI
    Navigate to Cisco Unified Reporting
    Select System Reports
    Select Unified CM Database Status
    Generate New Report
    In the Unified CM Database Status section of the report, expand the View Details under the All servers have a good replication status and confirm a Replicate State for all servers of “2” as follows:

  • [Question!!] How to satisfied security status after External Auth. ??

    Situation :
    I want to do Post Issuance functions on card , the card has personalized , and card
    status is been set to 'Secured'.
    Card Status :
    The Card is in secured status when has perso. from card manufacturer.
    First : External auth.
    External auth. is OK and response no error.
    (APDU 's P1 set to '0x03')
    Second: Try to delete existd applet(ex:VSDC applet) from card.
    According to the Card Spec. , APDUs after secured channel has opened must
    add MAC and encipher , so use first step 's C-MAC value as initial value to caculate
    new MAC and do encipher , then send command to IC Card , it return SW in '0x6982'
    Questions :
    Why it return 'Security level not satisfied' after pass the card ext. auth. ?
    Do I get error in caculate MAC or do Encipher the command ?
    If really got the error in my MAC or cipher step , IC Card check it and return '6982' ,
    is it correct ?
    APDU results are as follows:
    KMC Key = "FDA1DAF3CC95D48C7B891DCA1F7C5769"(Hex dump)
    16 bytes 2Des Key
    Detect Reader :
    0 - [ CASTLES EZ100PU 1 ]
    Send APDU >> 00A4040007A0000000030000
    Response APDU << 6F198408A000000003000000A50D9F6E0640512179100E9F6501FF9000
    Send APDU >> 80CA00CF00
    Response APDU << 00CF0A000049381701100101629000
    Send APDU >> 80500000080000000000000000
    Response APDU << 00004938170110010162010152BD13F4BB10ECF64875DAFF86BF89299000
    -- External Authenticate
    Plantext APDU : 848203000807556D1359960AD3
    IV : 0000000000000000
    C-MAC : 766F793916F59ABD
    APDU After C-MAC : 848203001007556D1359960AD3766F793916F59ABD
    Send APDU >> 848203001007556D1359960AD3766F793916F59ABD
    Response APDU << 9000
    -- Delete Instance AID
    Plantext APDU : 84E40000094F07A0000000031010
    IV : 766F793916F59ABD
    C-MAC : 21E59ADBCE506D20
    APDU After C-MAC : 84E40000114F07A000000003101021E59ADBCE506D20
    APDU After Cipher : 84E40000180CC8DE40AB34AC8C66285D6A2B0B4C5421E59ADBCE506D20
    Send APDU >> 84E40000180CC8DE40AB34AC8C66285D6A2B0B4C5421E59ADBCE506D20
    Response APDU << 6982
    Delete Instance AID fail ! (SW:6982)

    hi! Bennel,
    what kind of your card?

  • How to force JEditorPane to be refreshed?

    Dear all,
    I've problem of refreshing JEditorPane using setPage( ) method.
    I've written a simple JAVA browser with an analysing system. When a user clicks a hyperlink, the setPage( ) method will be called. Followed by the setPage( ) method, is another method, called method2, used to analyse the content of the page which will take several seconds to minutes to be finished.
    The problem I have now is that, the new HTML page will be displayed only after method2 is finished. How to force the page to be displayed before running method2?
    Thanks a lot.
    Frances

    Just to add - invokeLater will free up the swing thread so setPage completes in a timely manner but
    StanislavL's example will run method2 on the swing thread also, just as a separate action
    performed at a later time. This is good if method2 makes further calls to swing methods but it
    does mean that the analysis will block the swing thread for however long it takes. If that's OK then fine, otherwise modify as:
    pane.setPage(url);
    Thread t = new Thread() {
      public void run() { method2(); };
    t.start();Check out this [url http://java.sun.com/products/jfc/tsc/articles/threads/threads1.html]article for further info.
    Regards

  • 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

  • OEM Job hanged

    I have executed a simple query (select name from v$datafile) for testing purpose from OEM 10g Grid Control on a database(8.1..7.0) by preparing a job and now it got hanged.
    I tried to stop the job, kill it, but its not working. Even I killed the session from the database but its still showing the Job status as "Stop pending". Appreciate your help.
    Edited by: user10929871 on Apr 2, 2009 3:53 AM

    That could be a tricky issue,there's no simple answer. Refer to metalink:
    How to Force Stop a Stuck Job in Grid Console
    Doc ID: 430626.1
    Werner

  • OEM Job and Event  - No Results

    Hi,
    How are you doing today? Well, I need your help. I am new DBA for one month old. I want to run OEM Jobs and Events.
    I am able to log with sysman/oem_temp
    i have created credential for node and database.
    I am able to work on other parts except these two.
    I am able to create job and event
    after creating job . I am getting status as submitted.but it is not executing immediately.it is the same problem with event also.
    In event ,one event get registered but another event status is not registered then i have checked for detail
    error is like this
    vd:1523 - there is no agent on node(server)
    i didn't get what is inteligent agent and how to get it on node?
    Well I have created new user with Windows 2000 having privileges for batch processing. same user is created in oracle database as well as oem administrator.
    with same user database connection i am trying to create new job and event but it is not executing. i mean no results.
    I know I am making you more confused.Sorry.......
    I would like to ask your favour can I mail u if I have any query in future.
    Thanks a lot in advance.
    -Deepak

    The intelligent agent is a process which has to run on the same node like the database you want to supervise with the OEM. You have to install the intelligent agent during the installation process of the database. After having installed the agent you have to start it (via the services panel in Windows). After that you have to ensure that the agent has discovered a database instance on the node (there should be entries for node, listener and database in the services.ora file in the ORACLE_HOME\network\agent directory). If this is all ok and the events or the jobs still doesn't work it may be a communication problem (are you using a firewall between the database node and the management server, or do you use network adress translation?).

  • How to get spool from background job run?

    Hello,
    I have this situation and need help on how to resolve:
    I have RFC FM which called from another system, in that FM I am submitting BDC section as a batch job by report RSBDCSUB. The problem is that this job may run for 1 or 2 hours and my RFC call will be close by that time. How can I bring the result of my batch job run back to the calling system in this case? Will appreciate any hints.
    Thank you,
    Glenn

    Hi
    After you the Job completes. Use the spool ID and fetch the Spool list using the report RSPOLST2.
    You can download the spool job using the Function module RSPO_DOWNLOAD_SPOOLJOB.
    Thanks
    Dev

  • How to get the SQL Signon that Agent Jobs "Run As" or "Executed as User"

    How to get the SQL Signon that Agent Jobs "Run As" or "Executed as User"?
    I have an install SQL scripts that creates a Linked Server. I want to put some security on the Linked Server and only grant the Agent Job Signon (the "Run As" or "Executed as User") access to the linked server. I need to retrieve the
    Agent Job Signon (something like "NT SERVICE\SQLAgent$FIDEV360BI02").
    I could query certain jobs and SUBSTRING the Message column - using some form of the query below, which would return "Executed as user: NT SERVICE\SQLAgent$SSDEVBI02. The step succeeded." But that is pretty imprecise.
    use msdb
    SELECT [JobName] = JOB.name,
    [Step] = HIST.step_id,
    [StepName] = HIST.step_name,
    [Message] = HIST.message,
    [Status] = CASE WHEN HIST.run_status = 0 THEN 'Failed'
    WHEN HIST.run_status = 1 THEN 'Succeeded'
    WHEN HIST.run_status = 2 THEN 'Retry'
    WHEN HIST.run_status = 3 THEN 'Canceled'
    END,
    [RunDate] = HIST.run_date,
    [RunTime] = HIST.run_time,
    [Duration] = HIST.run_duration,
    [Retries] = HIST.retries_attempted
    FROM sysjobs JOB
    INNER JOIN sysjobhistory HIST ON HIST.job_id = JOB.job_id
    -- CHANGE THIS
    -- WHERE JOB.name like '%GroupMaster%' or Job.name like '%etlv%'
    ORDER BY HIST.run_date, HIST.run_time

    by default all sql jobs are executed as sql server agent account, unless otherwise a proxy is setup.
    you can get the proxy information as Olaf mentioned, if the proxy_id is null for the step, it implies that the job step was executed as sql server service account and in such case it will be null
    so, if it is null, it ran as sql server agent account.
    so, one work around is get the sql server agent service account and if the proxy is null, that means it ran as sql server agent account, so, use isnull function. the disadvantage would be if the sql server agent account was switched, you might not get the
    accurate information as the new account will show up though the job really ran as old account, to get this information, you need to  get this from the logmessage column as you mentioned above.
     try this code...
    /*from sql 2008r2 sp1, you get the service accounts using tsql,otherwise you have to query the registry keys*/
    declare @sqlserveragentaccount varchar(2000)
    select @sqlserveragentaccount= service_account
    from sys.dm_server_services
    where servicename like '%sql%server%agent%'
    select message,isnull(name,@sqlserveragentaccount) as AccountName
    from sysjobhistory a inner join sysjobsteps b
    on a.step_id=b.step_id and a.job_id=b.job_id
    left outer join sysproxies c on c.proxy_id=b.proxy_id
    Hope it Helps!!

  • Email Notification after Job run

    Hi everybody,
    I want to setup an email notification at the end of a job run.
    The job is an update run from our Activate Directory and checks if there are some changes to do.
    At the end or after this job I would like to send an email to the admin that the job successfully run and what the job did.
    How could I setup this?
    At the moment I tried to use a SQL statement to table MC_LOGS within a script called in the last pass of the job.
    But I only get the information what to job do from the last run of the job and not from the current run.
    Best regards & a happy new year, Anja

    Hi Anja
    Your last pass can only fetch information from the last run and not the current one because the Job is still running and the respective log is not yet written to the table.
    But maybe you could use the LogFile created then the Job finishes.
    I suppose you use the "LDAP (ADS) - Update All"- Job for LDAP-to-IC updates. This job writes a logfile to %$ddm.ddmpath% which you could send as mail attachment. Use the UpdateJob-"Event scheduling" button to run your SendMail-Job after every UpdateJob-completion.
    Another idea would be to use the SQL-View MCMV_JOBLOG which I think is the datasource of IC-JobLog. I suppose column "mcmv_data" stores the details.
    Hope I could help.
    BR
    Michael

  • OEM JOB List

    Hi
    I am working oracle 10g OEM. I would like to see OEM Job list using mgmt sql.
    I am looking for following columns
    Name
    Status (Executions)
    ScheduledSorted in descending order
    Targets
    Target Type
    Owner
    Job Type
    Thanks
    Ranga

    Modify this according to your own
    select distinct
    JOB_NAME,                                
    a.JOB_ID,
    JOB_OWNER,                                
    JOB_DESCRIPTION,
    b.SCALAR_VALUE,                                 
    JOB_TYPE      ,                          
    TARGET_TYPE    ,                                  
    IS_LIBRARY      ,                                 
    IS_RESTARTABLE   ,                                
    START_TIME        ,                               
    END_TIME      ,                                   
    TIMEZONE_TYPE  ,                                  
    TIMEZONE_REGION ,                                 
    SCHEDULE_TYPE    ,                                 
    INTERVAL          ,                               
    EXECUTION_HOURS    ,                               
    EXECUTION_MINUTES
    from mgmt$jobs@emrep a, mgmt_job_parameter@emrep b where
    a.job_id = b.job_id and a.is_library = 1 and b.parameter_name = 'args'
    order by a.job_name ;

  • OEM Job schedule definition to Flat file

    Can anyone advice me on the best method of extracting a OEM Job schedule definition - from an existing OEM server - to a flat file executable deployment script i.e. SQL*Plus script, schell script e.t.c.
    Your help will be most appriciated.

    Thanks for your response. Is this fuctionality usable after OEM Job creation?
    Message was edited by:
    kayvic01

  • How to make a job run on a appointed node

    I have a problem. The database is Oracle 10g, RAC, two nodes
    There are some job which run on everyday night. Now, something happened, the job run on Node A can't work as normal, but if run on node B, It will work well.
    so I just want to submit the jobs on Node B, I submited the jobs on Node B, but the jobs always run on Node A.
    I want to know how to make a job run on a appointed node.

    the Job just transfer some procedure to add partitions for some table, to merge the records from some tables to one table and so on.
    the problem is when the job run on Node A, it is very very slow, the procedure would run hours and not success end, but if on Node B it will successfully end in seconds.
    restart the Node A would be a way for the problem, but may it will leave a hidden trouble. I want save the scene to find out the problem
    so can you help me

  • T code to check the job run status

    Hi Gurus,
    I am filling the setup tables for inventory, but i didn't run in background. I clicked on execute button, but suddenly i got disconnected from net and my server also.
    Now i have to check the job run status whether it is running or not.
    Request you to provide the suggessions.
    Thanks & Regards,
    Saketh

    Hi,
    if you ran job in background you can see at SM37.use proper time ,date and use id to get your job.
    if you ran on frond end then you won't see job.if your job was completed then you can see data at SE11 by using setup table name or you can see at t code NPRT by using name of the run.
    if you won't find your job then just delete your setup tables again and fill it.
    No issues.
    Thanks

Maybe you are looking for

  • Video Card for UT 2004

    Okay, here' s a geeky question to distract eveyrone from all the really important issues at hand... I want to order my Mac Pro today but I am still hemming and hawing over what video card to get and was wondering about UT 2004. I know there is a new

  • Adding namespace to the source file

    Hi, We are sending xml file data from MDM to XI. How can we add the interface namspace to the root node of the message? Any inputs on the same would be helpful because without adding the namespace the data is not getting picked from MDM. Regards, Sam

  • How do i cancel my purchuse

    Hi all I wnated to by few apps for my ipad, and i put my card detail in and everything was fine then i down loaded the apps and everything was find, then the next day i when in to my account and i found out that i ow apple the money for the 2 down lo

  • RemoveDocument command doesn't work

    I'm using Oracle: Berkeley DB XML 2.4.16: (October 21, 2008) Berkeley DB 4.6.21: (September 27, 2007) Joined existing environment I have a container in which a document can not be found with the removeDocument command, but it's found with other comma

  • I am having Problems with HND (or something)

    On the weekend I installed a new router and HND. Behind the scenes or during the process it seems that it changed my settings on my wifes computer so that she is prevented in going to certain websites through parental controls that have now been set.