Script to schedule a procedure

hii,
i want the script to execute a procedure on daily basis at a particular time(at 10pm daily).my data base version is 9.2.0.6.0.
How i can check wheather my scheduled procedure is executed or not

Hi,
In addition, pay attention about possible job execution failures.
Scheduled jobs
SELECT job, next_date, next_sec, failures, broken FROM dba_jobs;
JOB   NEXT_DATE NEXT_SEC FAILURES B
14144 24-OCT-02 16:35:35 0        N
41762 01-JAN-00 00:00:00 16 Y
2 rows selected.
Jobs currently in execution
SELECT sid, r.job, log_user, r.this_date, r.this_sec
FROM dba_jobs_running r, dba_jobs j
WHERE r.job = j.job;
SID   JOB        LOG_USER      THIS_DATE THIS_SEC
25    341        SCOTT         24/04/03  16:45:12
1 rows selected.Cheers

Similar Messages

  • Executing Unix scripts from a stored procedure

    From the sql*plus windows, I am able to execute the host command and '!sh' commands; but I need to ececute Unix scripts from a stored procedure. Hoe can I do this? Where can I get good documentation on this? Any help would be greatly appreciated!
    Thanks..

    Hi,
    U can use external procedure ( newly added feature in 8.0.3 onwards) and call any shared library. From shared library u can execute it.
    One sql command is there HOST(' '). U can run a OS command. But u can not use it in PL/SQL.
    U can call pls sql from shell !!!!!..
    Thanks...
    Boby Jose

  • Calling unix shell script from oracle stored procedure.. urgent!!!!!!!!!!!!

    Hi,
    i havea requirement where in i should be able to call my shell script through oracle stored procedure.i tried the following way..but iam unable to get the result.please find the details below.
    new.sh - my shell script - lctfile (LCTFILE) is the input pa
    v_config_file=`find $FND_TOP -name LCTFILE
    FNDLOAD apps/s0ccer@$dxbs1 0 Y DOWNLOAD $v_config_file /home/bir4163/RPT33/bin/menu.ldt MENU MENU_NAME='AR_NAVIGATE_GUI'
    if [ $? != 0 ];then
    echo "$DATE $0 FNDLOAD DOWNLOAD Failed!" | tee -a $LOG_FILE
    else
    echo "SUCCESS" | tee -a $LOG_FILE
    fi
    CREATE OR REPLACE PROCEDURE test_dbms_scheduler
    AS
    v_text VARCHAR2 (255) := 'AR_NAVIGATE_GUI';
    BEGIN
    DBMS_OUTPUT.put_line ('I am in Procedure');
    DBMS_SCHEDULER.create_job (
    job_name => 'test_dbms_scheduler',
    job_action => '/home/bir4163/RPT33/bin/new.sh',
    number_of_arguments => 1,
    job_type => 'executable',
    start_date => SYSDATE,
    repeat_interval => 'FREQ=SECONDLY; INTERVAL=1',
    enabled => FALSE,
    auto_drop => FALSE,
    comments => 'run shell script'
    DBMS_SCHEDULER.set_job_argument_value (job_name => 'test_dbms_scheduler',
    argument_position => 1,
    argument_value => v_text);
    DBMS_SCHEDULER.enable ('test_dbms_scheduler');
    DBMS_OUTPUT.put_line ('I am back in Procedure');
    EXCEPTION
    WHEN OTHERS
    THEN
    DBMS_OUTPUT.put_line (SQLCODE || SQLERRM);
    END;
    But iam unable to test it as i do not have permissions to access dbms_scheduler.can anybody tell me how to solve this using DBMS_PIPE with a sample code.
    please do help its very urgent
    thanks
    ramya

    Hi,
    Register your Shell Script as a concurrent program, Executable execution method "Host", then use fnd_request.submit_request to submit the program.
    Regards,
    Andries

  • Using SQL Loader script in a Stored Procedure

    Can I use SQL Loader script in a stored procedure and then execute it from a front-end appl.? The reason for this seemingly convoluted solution is that the users don't want a batch load though the records volume is quite high (around 1 mil). Other loads using ODBC connection or OLE DB seem to be inferior to SQL Loader.

    I would suggest a couple of solutions:
    1. Have a cgi script that can upload the file to the server from a web ui, then have the cgi script call the sql*loader file, and it will insert into the database.
    2. You can try to use External tables. This is avaliable in 9i and onwards. You will be able to make any sql DML on the external table.
    I would normally use sql*loader, move the data to a staging table with nologging, and paralle loading. After it has been loaded into the staging table I would process it into my main tables. Have used this approach with up to 60 million records in one load.
    You can do calls to C procedures, Pro*C procedures through PLSQL, as well as java calls, or use Java stored procedures.
    My experience is that SQL*Loader is the fastest way to load data into the database.

  • To create a script and schedule which purge 30 days old files

    Hi Friends,
    Very new in Unix and i got a requirement like writing a script and schedule it, so that it removes 30 days old files from all the log locations of a unix box.
    Suppose i have a unix server ltbamdev1 and in this server i have a mount point opt/bam. In this mount point i have 3 different folders like
    /ltbamdev1/oracle/install/product/10.1.3.1/OracleAS_1/opmn/logs
    /ltbamdev1/oracle/install/product/10.1.3.1/OracleAS_1/bpel/domains/default/logs
    /ltbamdev1/oracle/install/product/10.1.3.1/OracleAS_1/bpel/domains/support/logs
    Please help me in writing a script which runs once a week and removes all 30 days old files from these three folder locations.
    Thanks in advance
    Duos

    Moderator Action:
    The discussion is in the duplicate cross-post:
    To create a script and schedule which purge 30 days old files
    @O.P.
    For the future, only make one post.
    If it is in the wrong forum, it will likely get relocated by moderators.
    This duplicate is now locked to prevent responses getting fragmented all over the place.

  • Schedule a procedure in a package?

    I have a developer who would like to schedule a procedure that is part of a package to run on a nightly basis. I wasn't able to select the packaged procedure in EM (10.2). Can you schedule a packaged procedure, but just not with EM?

    Yes you can do it with dbms_scheduler but I am not sure if the EM interface supports it.
    You can try something like
    begin
    dbms_scheduler.set_attribute('my_job','job_action',
    'scott.test_pkg.proc1');
    end;
    EM might let you fill in the procedure name manually, in which case you just have to fill in all three parts (schema.package.procedure).
    Hope this helps,
    Ravi.

  • Script to schedule coldbackup on windows

    i have oracle 10.2.0.1 on windows. i want to schedule coldbackup through a script.
    my datafiles path is
    e:\oracle\product\10.2.0\oradata\orcl\system01.dbf .....................
    control files
    e:\oracle\product\10.2.0\oradata\orcl\control01.ctl ........
    online redologs:
    e:\oracle\product\10.2.0\oradata\orcl\redo01.log ........
    please tell me how i write a script to schedule cold backup on this windows machine.
    please reply

    You will need two files:
    1. file1.bat
    2. file2.ctl
    In file1, create your batch script to set the environment
    Example -
    set ORACLE_HOME=f:\app\product\11.2.0\dbhome_1
    set ORACLE_SID=ocdb
    rman target / @E:\Backup_scripts\file2.ctl
    exit
    In file2 you run the rman backup script
    Example -
    spool LOG to 'E:\Backup_scripts\ocdb.log' APPEND;
    BACKUP INCREMENTAL LEVEL 0 TAG full_backup DATABASE plus archivelog;
    exit
    Use Window scheduler to run file1
    done

  • Scheduling a procedure

    Hi Guys,
    I want to execute a procedure I have created at a certain time. I mean I want to schedule a procedure to execute at a specified time.
    Please help me in doing this? If there any package available in oracle to set the execution time of a procedure.
    Regards,
    Imran Baig

    Thanks for the replies.
    I am using Oracle 9i Release 1.
    We have Oracle on both linux and windows operating system.
    Now what is the suitable way to schedule a execution of a procedure.
    Regards,
    Imran

  • How to write a shell script to execute a procedure with out parameter

    Hi,
    How to write a shell script to execute a procedure with out parameter.
    here is my procedure
    PROCEDURE sample(invar1 VARCHAR2,
    invar2 VARCHAR2,
    invar3 VARCHAR2,
    invar4 VARCHAR2,
    ecode out number);
    Any example really helpfull
    Thanks in advance

    Or if we're passing values in, maybe something like:
    Test procedure:
    CREATE OR REPLACE PROCEDURE p (myin IN VARCHAR2, myout OUT VARCHAR2)
    AS
    BEGIN
        myout :=
            CASE myin
                WHEN 'A' THEN 'APPLE'
                WHEN 'B' THEN 'BANANA'
                ELSE 'STARFRUIT'
            END;
    END;Shell script:
    #!/bin/bash
    my_shell_variable=$1
    unset ORACLE_PATH
    sqlplus -s un/pw@db <<-EOF
    set feedback off pause off
    set pagesize 0
    set autoprint off
    VAR out varchar2(30)
    VAR myin varchar2(30)
    exec :myin := '${my_shell_variable}'
    BEGIN
      p(:myin, :out);
    END;
    print out
    exit
    EOFTest:
    /Users/williamr: xx A
    APPLE
    /Users/williamr: xx B
    BANANA
    /Users/williamr: xx
    STARFRUITObviously in a real script you would not hardcode the password or let it show in a "ps" listing.
    Message was edited by:
    William Robertson

  • Run Powershell script from Scheduled Task as "NT Authority \ SYSTEM"

    Hello, dear Colleagues.
    Cannot make Powershell script from Scheduled Task as "NT Authority \ System"
    Action: Start a program - 
    C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -command "C:\script.ps1"
    The matter is that script is working, moreover if to run Task with Domain Account it works too.
    Checked Run with highest privileges, changed "Configure for" field, tried different arguments (-noprofile, -noexit, -executionpolicy bypass, -command, -file,") - no luck.
    Didn't you try to make it work with SYSTEM account?
    Thanks.

    Hi fapq,
    Try this link task schedulers
    Note
    To identify tasks that run with system permissions, use a verbose query (/query/v). In a verbose query display of a system-run task, the Run As User field has a value of NT AUTHORITY\SYSTEM and
    the Logon Mode field has a value of Background only.
    Naveen Basati

  • Invoking Shell Script from JAVA Stored procedure

    I am trying to invoke shell script using Java Stored procedure.
    When I run my java class outside of oracle using oracle user
    account it works but as soon as i load it into database and try
    to inovoke that class using PL/SQL wrapper it runs java class
    but is not able to invoke the shell script. Any ideas would be
    greatly appreciated.

    Pleass search the forums for "runtime" as there are many threads and examples already posted.

  • Shell script invoke from stored procedure

    Hi All,
    Can anyone tell me how to call UNIX SHELL SCRIPT from oracle stored procedure PL/SQL. Example with detailed explanation.
    Please Share the needful.
    Thanks in Advance
    Pricks

    Here, The example is given below, I want to invoke the Script which i mentioned like HERE INVOKE THE ABOVE SHELL SCRIPT in that place.
    CREATE OR REPLACE PROCEDURE spwritelog
         inFileName               VARCHAR2,
         inLogMsg               VARCHAR2,
         inLogLevel               CHAR(1),
         outRc OUT NUMBER
    AS
    tmpMsg                VARCHAR2(255);
    BEGIN
    outRc := 0;
         IF inLogLevel = 'X' THEN
              tmpMsg := "echo `date +'%Y-%m-%d %H:%M:%S'` ' " || inLogMsg || "' >> " || inFileName;
         HERE INVOKE THE ABOVE SHELL SCRIPT
         ELSIF inLogLevel = "9" THEN
              tmpMsg := "echo `date +'%Y-%m-%d %H:%M:%S'` ' " || inLogMsg || "' >> /tmp/spAllLog.err";
              HERE INVOKE THE ABOVE SHELL SCRIPT
         END IF;
    EXCEPTION
    WHEN OTHERS THEN
    outRc:=SQLCODE;
    END spwritelog;
    Please correct the code and tell.......
    please share the needful
    Edited by: 866916 on Aug 19, 2011 5:38 PM

  • Running an automated script at scheduled intervals

    Greetings all,
    Is there a way to setup a process or job to run an SQL Script automatically on the first of the month? I am running on a server much like apex.oracle.com so I don't have permissions to the back end of the database and can't run a cron job.
    What I am trying to do is run a script that updates a table on the 1st and 15th of the month.
    I Googled it and searched OTN and was not able to find what I was looking for so asking the experts.
    Thanks in advance for any assistance.
    Wally

    wfsteadman wrote:
    I definitely did not good for dbms_scheduler or dbms_job.. so that may be my first issue. will this run from application express? I don't have access to the backend of the database or to a command line so I would have to set it up in the application and not sure how to do that.APEX provides SQL Workshop with the SQL Commands and SQL Scripts processors.
    I've just successfully tested basic <tt>dbms_scheduler</tt> functions on apex.oracle.com, so try it on your environment.
    <li>Go to SQL Workshop > SQL Commands
    <li>Create a basic, run-once job (that actually does nothing):
    begin
      dbms_scheduler.create_job(
        job_name => 'myjob',
        job_type => 'plsql_block',
        job_action => 'null;',
        enabled => true);
    end;If this returns
    Statement processed.rather than an error message then you're probably good to go.
    <li>Check the execution log:
    select * from user_scheduler_job_run_details;Should return something like:
    5825946     19-JUL-11 02.53.12.839925 PM -05:00     NANDBTAG     MYJOB         -               SUCCEEDED     0           19-JUL-11 02.53.12.808693 PM AMERICA/CHICAGO     19-JUL-11 02.53.12.817457 PM AMERICA/CHICAGO     +000 00:00:00     1               1171,2895       25087         +000 00:00:00.02     -                     -                   -                     -               -<li>Try creating a job that runs every minute:
    begin
      dbms_scheduler.create_job(
        job_name => 'myjob',
        job_type => 'plsql_block',
        job_action => 'null;',
        start_date => '19-JUL-11 03.10.00 PM', /* Remember to use the DB time, not your local time if not specifying a timezone */
        repeat_interval => 'freq=minutely',
        enabled => true);
    end;<li>Check it's status in the <tt>user_scheduler_jobs</tt> view:
    select * from user_scheduler_jobs;
    MYJOB      -     REGULAR     APEX_PUBLIC_USER     MACMILP:1275550617277611      -      -      -     PLSQL_BLOCK     null;     0      -      -     CALENDAR     19-JUL-11 03.10.00.000000 PM -05:00     freq=minutely      -      -      -      -      -      -      -      -     DEFAULT_JOB_CLASS     TRUE     TRUE     FALSE     SCHEDULED     3     0      -     0      -     0      -      -     19-JUL-11 03.10.00.000000 PM -05:00      -      -     OFF     FALSE     TRUE      -     FALSE     1     NLS_LANGUAGE='AMERICAN' NLS_TERRITORY='AMERICA' NLS_CURRENCY='$' NLS_ISO_CURRENCY='AMERICA' NLS_NUMERIC_CHARACTERS='.,' NLS_CALENDAR='GREGORIAN' NLS_DATE_FORMAT='mm/dd/yyyy' NLS_DATE_LANGUAGE='AMERICAN' NLS_SORT='BINARY' NLS_TIME_FORMAT='HH.MI.SSXFF AM' NLS_TIMESTAMP_FORMAT='DD-MON-RR HH.MI.SSXFF AM' NLS_TIME_TZ_FORMAT='HH.MI.SSXFF AM TZR' NLS_TIMESTAMP_TZ_FORMAT='DD-MON-RR HH.MI.SSXFF AM TZR' NLS_DUAL_CURRENCY='$' NLS_COMP='BINARY' NLS_LENGTH_SEMANTICS='BYTE' NLS_NCHAR_CONV_EXCP='FALSE'      -     1      -      -      -      -      -     FALSE     FALSE      -     133168<li>And that it's executing every minute:
    select * from user_scheduler_job_log;
    5826446     19-JUL-11 03.13.00.264038 PM -05:00     NANDBTAG     MYJOB      -     DEFAULT_JOB_CLASS     RUN     SUCCEEDED      -      -      -      -      -      -      -      -
    5826426     19-JUL-11 03.12.00.191519 PM -05:00     NANDBTAG     MYJOB      -     DEFAULT_JOB_CLASS     RUN     SUCCEEDED      -      -      -      -      -      -      -      -
    5826386     19-JUL-11 03.11.00.075835 PM -05:00     NANDBTAG     MYJOB      -     DEFAULT_JOB_CLASS     RUN     SUCCEEDED      -      -      -      -      -      -      -      -
    5826366     19-JUL-11 03.10.00.048849 PM -05:00     NANDBTAG     MYJOB      -     DEFAULT_JOB_CLASS     RUN     SUCCEEDED      -      -      -      -      -      -      -      -After that you want to experiment with the calendar syntax to figure out how to run a job on the first of the month, and plug in your own PL/SQL block or stored procedure <tt>job_action</tt> that actually does something.
    And if that first call errors out and you don't get anywhere near this far, you'll have to contact the host DBAs an enquire about getting CREATE JOB privilege granted to the required parsing schema in your workspace.
    (If it does work, remember to drop any experimental jobs when you're done to free up resources for everyone else!)

  • Shell script execution from stored procedure

    I am working on a project thallt requires a shell script be executed upon the execution of a stored procedure with Oracle 10g. I have researched the matter, but there does not seem to be much out there on how to execute lines of UNIX commands by use of a stored procedure. If anybody has ever gotten this to work, any information would be appreciated. If the task is impossible, let me know, I just could not confirm that it was not something that could be done.

    A combination of things can help you out here - none of which are easy or particularily secure.
    1) From plain PL/SQL, you can call 'external procedures'. That is basically a DLL or .so that the listener can load on demand, and that external procedure (EXTPROC) can run whatever you need from the C program. C can, in turn, call a shell.
    This is fairly well documented, but be aware that 1/2 of the info is in the PL/SQL docco and the other half in the Networking docco.
    A fair bit of info is available in metalink as well - if you have access, simply search on extproc.
    2) You can call a Java stored procedure which in turn has hooks to the outside world. That will probably require a PL/SQL to Java wrapper to make it available in your environment. Oracle has been using this one successfully for a while.
    3) Write the script using UTL_FILE and have a daemon look for, and execute, the script.
    4) Since you are using 10g, use the new job scheduler. It has excellent capability to interact with the OS, and it is available as a PL/SQL package (DBMS_SCHEDULER). I find the interface a bit heavy, but that could be wrapped by a library tailored to your specific needs.
    Let us know what you decide to do in the end (and why) - it is an interesting topic.

  • Calling AIX (.sh) shell script from scheduler

    Hi, these are my env.
    Oracle DB = 10.2.0
    OS = AIX
    I hit the following error when executing an user's procedure of calling scheduler to run a .sh script.
    ORA-27369: job of type EXECUTABLE failed with exit code: 255
    STANDARD_ERROR="execve: Exec format error"
    Can scheduler works on AIX .sh script? If yes, what is the env i need to set such as path, security setting... in order to get this work. Thanks.

    Do you use ksh?
    if yes -> set the job_action to the shell executable
    metalink:555160.1
    1.
    begin
    dbms_scheduler.create_job
    job_name => 'My_job',
    job_type => 'EXECUTABLE',
    job_action => '/usr/bin/ksh',
    start_date =>sysdate+ 1/288 , /* this to postponed the start date 5
    minutes until enabling the job at last step .*/
    number_of_arguments => 1,
    repeat_interval => 'FREQ=MINUTELY; INTERVAL=2',
    enabled => false,
    comments => 'test as per ANUJ95 '
    end;
    2.
    SQL> exec dbms_scheduler.set_job_argument_value(job_name=>'My_job',
    argument_position=>1,
    argument_value=>'/tmp/test.sh') ;
    3.
    exec dbms_scheduler.enable(name=>'My_job')

Maybe you are looking for

  • Error message original file could not be located

    when i try to play songs from my library i get this message. "original file could not be found" all my hardware is the same, no recent changes. not sure how to get my songs back in my library. the album/artist icon is still there but will not play.

  • My phone is not working I have been told it will n...

    Hi Can anyone fron BT help me please I am totaly gutted !! my phone is not working and according to BT there is a problem on my line...I live in a remote hamlet where a phone is vitally important as my mobile does not work very well any way!!  I was

  • Documentation and info for MusicPlayer API?

    Is there documentation and info about the status of the MusicPlayer API from MusicPlayer.h in the AudioToolbox framework? Will this API be around for a long time or will it be deprecated?

  • RRI sender / receivers

    I have created a jump link between a BW query and R3 report (FBL3N).  The BW report is a simple trial balance of GL accounts.  I want the user to be able to 'jump' to FBL3N for line item detail. The link is established, but it only takes the user to

  • Install 8.0.2 or wait?

    Planning to install iOS 8.0.2 (7.1.2 right now) on iPhone 5 very very soon. What issues if any can be expected? Thanks.