How to Schedule Job using Database Control for SQLPLUS script?

Hi All,
I am using Database version 10.2. I would like to schedule a SQLPLUS script job using Database control (Not using Grid Control!). The following is the script.
========================================================
define OEM_FRIENDLY=1
define OWB_BACKGROUND=0
set serveroutput on
set verify off
whenever sqlerror exit failure;
define REPOS_OWNER='&1.'
define LOCATION_NAME='&2.'
define TASK_TYPE='&3.'
define TASK_NAME='&4.'
define SYSTEM_PARAMS='&5.'
define CUSTOM_PARAMS='&6.'
alter session set current_schema = &REPOS_OWNER.;
set role owb_d_&REPOS_OWNER., owb_o_&REPOS_OWNER.;
variable exec_return_code number;
begin
-- Initialize Return Code
:exec_return_code := wb_rt_api_exec.RESULT_FAILURE;
-- Run Task
:exec_return_code := wb_rt_api_exec.run_task('&LOCATION_NAME.',
'&TASK_TYPE.',
'&TASK_NAME.',
'&CUSTOM_PARAMS.',
'&SYSTEM_PARAMS.',
&OEM_FRIENDLY.,
&OWB_BACKGROUND.);
end;
exit :exec_return_code;
===========================================================
Is it possible to schedule SQLPLUS script with 6 different parameters? If yes then how can I schedule for monday to friday or only for Saturday and sundays.
Please provide brief steps.
Thanks for your help in advance.
- Mehul

Let me explain to you about scheduler.
You can schedule a pl/sql stored procedure TEST_S as follows...
Begin
dbms_scheduler.create_job(
job_name=>'MY_JOB',
Job_Type=>'STORED_PROCEDURE',
job_action=>'TEST_S',
start_date=>sysdate,
repeat_interval=>'freq=monthly;BYDAY=MON,TUE,WED,THU,FRI',
end_date=>null');
END;
You can also also execute o/s script like .bat or .sh. For this job type should be EXECUTABLE.
Example of converting a .sql script in .bat script...
insert.sql
insert into dept values(50,'IT','LONDON');
exit
insert.bat
sqlplus scott/tiger @insert.sql
Executing now...
C:\Documents and Settings>insert.bat
C:\Documents and Settings>sqlplus scott/tiger @insert.sql
SQL*Plus: Release 10.2.0.1.0 - Production on Thu Mar 1 08:01:00 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
1 row created.
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - P
oduction
With the Partitioning, OLAP and Data Mining options
C:\Documents and Settings>
So first read about DBMS_SCHEDULER and do the work in prompt. Then you can go and schedule it even by database control.
Scheduling by database control...
http://www.oracle.com/technology/oramag/oracle/04-jul/o44tech_dba.html
Scheduler
http://download-uk.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_sched.htm#CIHEHDHA
PS: By default each job you created is disable state. Please enable it by enable procedure of DBMS_SCHEDULER package.

Similar Messages

  • How to schedule jobs using

    Hello Gurus,
    I have a job in SM37 scheduled using the prog. RSBATCH1 with var.&0000000000049. When I go to SE38, give the program name and the var and execute it, there is nothing entered in the 'Jobname' in the user selection screen.
    But when it is executed it runs two(2) Infopackages for that variant.
    I want to remove one of the infopackages. How do I achieve this?
    Where can I get more info on how to schedule jobs using
    RSBATCH1.
    Thanks in advance
    Simmi

    Hi Simmi,
    If the variant is like "var.&0000000000049" in  the job then the program does not ahve any variant.
    To remove the infoapckage for that job goto the infoapckage -> scheduling tab -> Scheduling option -> remove the job from "after job" tab.
    Bye
    Dinesh

  • How to schedule job V3 unserialised Update job for Inventory

    Hi gurus,
    How to schedule job V3 unserialised Update job for Inventory management
    What are the things need to be configured
    Thank you

    Hi,
    In R/3 go to SBIW > Settings for Application-Specific DataSources (PI) > Logistics > Managing Extract Structures > Logistics Extraction Structures Customizing Cockpit
    UIn this Screen you can define delta type, and the jog usign the control job option.
    Regards,
    Dani

  • How to schedule jobs for brtools/oracle on EP

    How to schedule jobs for brtools/oracle (Update statistics
    Chech db
    Db verify
    ) on an EP system where as  no tool for java to do that (like db13). How to invoke it with cron?

    In Brtools you can always see the "Command line" before executing an action, You can simply copy that and use it to run BRTOOLS command from prompt, You can make a script with it and schedule via Cron.
    Regards
    Juan

  • How to schedule Job for data uploading from source to BI

    Hi to all,
    How to schedule Job for data uploading from source to BI,
    Why we required and how we do it.
    As I am fresher in BI, I need to know from bottom.
    Regards
    Pavneet Rana

    Hi.
    You can create [process chain |http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/502b2998-1017-2d10-1c8a-a57a35d52bc8?quicklink=index&overridelayout=true]for data loading pocess and schedule start process to any time/date etc ...
    Regadrs.

  • How to use database control to execute sql queries which change at run time

    Hi all,
    I need to execute sql queries using database controls , where the sql changes
    at run time
    based on some condition. For eg. based on the condition , I can add some where
    condition.
    Eg. sql = select id,name from emp where id = ?.
    based on some condition , I can add the following condition .
    and location = ?.
    Have anybody had this kind of situation.
    thanks,
    sathish

    From the perspective of the database control, you've got two options:
    1) use the sql: keyword to do parameter substitution. Your observation
    about {foo} style sbustitution is correct -- this is like using a
    PreparedStatement. To do substitution into the rest of the SQL
    statement, you can use the {sql: foo} substitution syntax which was
    undocumented in GA but is documented in SP2. Then, you can build up
    the filter clause String yourself in a JPF / JWS / etc and pass it into
    the DB control.
    For example:
    * @jc:sql statement="select * from product {sql: filter}"
    public Product[] getProducts(String filter) throws SQLException;
    This will substitute the String filter directly into the statement that
    is executed. The filter string could be null, "", "WHERE ID=12345", etc.
    2) you can use the DatabaseFilter object to build up a set of custom
    sorts and filters and pass that object into the DB control method.
    There have been other posts here about doing this, look for the subject
    "DatabaseFilter example".
    Hope that helps...
    Eddie
    Dan Hayes wrote:
    "Sathish Venkatesan" <[email protected]> wrote:
    Hi Maruthi,
    The parameter substituion , I guess is used like setting the values for
    prepared
    statements.
    What I'm trying to do , is change the sql at run time based on some condition.
    For example ,
    consider the following query :
    select col1,col2 from table t where t.col3 > 1
    At run time , based on some condition , I need to add one more and condition.
    i.e. select col1,col2 from table t where t.col3 > 1 and t.col4 < 10.
    This MAY not address your issue but if you are trying to add "optional" parameters
    you may try including ALL the possible parameters in the SQL but send in null
    for those params that you don't want to filter on in any particular case. Then,
    if you word your query
    as follows:
    select col1, col2 from table t where t.col3 > 1 and (t.col4 = {col4param} or
    {col4param} is null) and (t.col5 = {col5param} or {col5param} is null) ...
    you will get "dynamic" filters. In other words, col4 and col5 will only be
    filtered if you send in non-null parameters for those arguments.
    I have not tried this in a WL Workshop database control but I've used
    this strategy dozens of times in stored procedures or jdbc prepared statements.
    Good luck,
    Dan

  • How to schedule jobs in cron using shell script

    Pls help me regarding that.
    Thanks

    Not sure about what do you want exactly.
    How to schedule jobs in cronhttp://www.adminschoice.com/docs/crontab.htm
    http://www.rahul.net/raithel/MyBackPages/crontab.html
    Nicolas.

  • Scheduled Job to gather stats for multiple tables - Oracle 11.2.0.1.0

    Hi,
    My Oracle DB Version is:
    BANNER Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE 11.2.0.1.0 Production
    TNS for Linux: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    In our application, we have users uploading files resulting in insert of records into a table. file could contain records ranging from 10000 to 1 million records.
    I have written a procedure to bulk insert these records into this table using limit clause. After the insert, i noticed my queries run slow against these tables if huge files are uploaded simultaneously. After gathering stats, the cost reduces and the queries executed faster.
    We have 2 such tables which grow based on user file uploads. I would like to schedule a job to gather stats during a non peak hour apart from the nightly automated oracle job for these two tables.
    Is there a better way to do this?
    I plan to execute the below procedure as a scheduled job using DBMS_SCHEDULER.
    --Procedure
    create or replace
    PROCEDURE p_manual_gather_table_stats AS
    TYPE ttab
    IS
        TABLE OF VARCHAR2(30) INDEX BY PLS_INTEGER;
        ltab ttab;
    BEGIN
        ltab(1) := 'TAB1';
        ltab(2) := 'TAB2';
        FOR i IN ltab.first .. ltab.last
        LOOP
            dbms_stats.gather_table_stats(ownname => USER, tabname => ltab(i) , estimate_percent => dbms_stats.auto_sample_size,
            method_opt => 'for all indexed columns size auto', degree =>
            dbms_stats.auto_degree ,CASCADE => TRUE );
        END LOOP;
    END p_manual_gather_table_stats;
    --Scheduled Job
    BEGIN
        -- Job defined entirely by the CREATE JOB procedure.
        DBMS_SCHEDULER.create_job ( job_name => 'MANUAL_GATHER_TABLE_STATS',
        job_type => 'PLSQL_BLOCK',
        job_action => 'BEGIN p_manual_gather_table_stats; END;',
        start_date => SYSTIMESTAMP,
        repeat_interval => 'FREQ=DAILY; BYHOUR=12;BYMINUTE=45;BYSECOND=0',
        end_date => NULL,
        enabled => TRUE,
        comments => 'Job to manually gather stats for tables: TAB1,TAB2. Runs at 12:45 Daily.');
    END;Thanks,
    Somiya

    The question was, is there a better way, and you partly answered it.
    Somiya, you have to be sure the queries have appropriate statistics when the queries are being run. In addition, if the queries are being run while data is being loaded, that is going to slow things down regardless, for several possible reasons, such as resource contention, inappropriate statistics, and having to maintain a read consistent view for each query.
    The default collection job decides for each table based on changes it perceives in the data. You probably don't want the default collection job to deal with those tables. You probably do want to do what Dan suggested with the statistics. But it's hard to tell from your description. Is the data volume and distribution volatile? You surely want representative statistics available when each query is started. You may want to use all the plan stability features available to tell the optimizer to do the right thing (see for example http://jonathanlewis.wordpress.com/2011/01/12/fake-baselines/ ). You may want to just give up and use dynamic sampling, I don't know, entire books, blogs and papers have been written on the subject. It's sufficiently advanced technology to appear as magic.

  • I can disable one of my MacBook's two CPUs using the CPUPalette application.  How can I do it under control of a script?

    I can disable one of my MacBook's two processors using the CPUPalette application.  How can I do it under control of a script?
    I want to do this because the MacBook is overheating.  I will soon get it repaired, but in the meantime, disabling CPU 2 is effective at preventing overheating.  Sadly CPUPalette is not scriptable, and it won't remember its setting after the computer is restarted.
    Would it be worth learning about the relevant Darwin API (supposing there is one) and writing a small command-line program for the job?  I am an experienced developer of software using Standard C.
    Comments appreciated.
    Dave

    i wonder if there is a key that is stuck cause whenever i try to turn it on again after the 60 minute lockout, it says that the password was incorrect and i am locked out for another 60 minutes

  • How to configure Enterprise Manager Database Control (EMDC) to make it work on 2 servers working (primary and standby) under DG rules

    Hello everybody i use Oracle Database EE 11.2.0.4 with DG.
    In those cases i need to get Enterprise Manager Database Control running against DB with no RAC and no DG i perform the following steps:
    I Logon SQLPLUS as user SYS or SYSTEM, and drop the sysman account and management objects:
    DECLARE
    CURSOR c1 IS
    SELECT owner, synonym_name name
    FROM dba_synonyms
    WHERE table_owner = 'SYSMAN';
    BEGIN
    FOR r1 IN c1 LOOP
    IF r1.owner = 'PUBLIC' THEN
    EXECUTE IMMEDIATE 'DROP PUBLIC SYNONYM '||r1.name;
    ELSE
    EXECUTE IMMEDIATE 'DROP SYNONYM '||r1.owner||'.'||r1.name;
    END IF;
    END LOOP;
    END;
    DROP USER mgmt_view CASCADE;
    DROP ROLE mgmt_user;
    DROP USER sysman CASCADE;
    After that i run
    emca -config dbcontrol db -repos recreate
    But what should i do in cases i have 2 servers working (primary and standby) under DG rules?

    Hi ,
    It is not possible to monitor/administer a Logical or Physical Standby database, i.e Data Guard, using Enterprise Manager Database Control.  This is primarily due to the fact that Database Control is designed to monitor 1 database and a Data Guard environment, by definition, includes more than 1 database.
    If you attempt to run emca against a standby Database, you will get an error like (i.e. ORA-01219: database not open).
    Database Control, can, of course, be used to monitor the current Primary database (with no ability to administer or monitor Data Guard related functionality).  In such a case, when failover occurs Database Control must be reconfigured to run on the new Primary database using the commands detailed in Note 278100.1 How To Drop, Create And Recreate DB Control In A 10g Database, section C. Recreate/ReConfig DB Control, Option 2. Recreate the DB Control Configuration Files and Repository.
    Enterprise Manager Grid Control or Cloud Control provides the functionality for viewing, monitoring, and administering primary and standby databases in a Data Guard configuration.
    Reference: Is it Possible to Configure Database Control for a Logical or Physical Standby Database? (Doc ID 315116.1)
    You can use EM 12c cloud control to monitor and manager Standby DB effectively
    Ref to below link for details
    Set Up and Manage Oracle Data Guard using Oracle Enterprise Manager Cloud Control 12c
    Regards,
    Rahul

  • Problem receiving email using database control

    Hi all,
    I'm new to using EM and trying to configure it so I can receive email notifications when tablespace is getting full. I'm only using "Database Control" not Grid control.
    Oracle Enterprise Manager Database Control     10.2.0.0     
    I was able to successfully receive email using "Test Mail Servers" in Notification Methods.
    I already defined my rule and was able to specify "Tablespace Used %" metrics.
    I already defined a schedule so that mails are sent to my email.
    To test, i created records on one table until it's 100%.
    I do get alerts with EM Database Control but no mail.
    I logged in as sysman into the database being monitored (there is no repository because this is database control), I don't see any rows in mgmg_notification_log.
    Does anybody know if email notification only works in "Grid Control" not "Database Control"?
    I'd appreciate any assistance.

    Grid Control has hundreds of email alerts already setup that you can use , but I pretty sure you need to buy
    that pack for email alerts to keep them in service after you evaluate.

  • How to use print control in Sap script

    I would like to use print control in Sap script.Actualy my problem I have security font Troy ECF. Using this font I would like to print amount field in Check printing.
    we count download this font with sap .we talked to customer care they told we should hard code in sapscript. pls can any1 help on this how to do and how to use print control for this fonts.

    call this funcation. crate_text.
    CALL FUNCTION 'CREATE_TEXT'
             EXPORTING
               FID               =
               FLANGUAGE         =
               FNAME             =
               FOBJECT           =
             SAVE_DIRECT       = 'X'
             FFORMAT           = '*'
             TABLES
               FLINES            =
           EXCEPTIONS
             NO_INIT           = 1
             NO_SAVE           = 2
             OTHERS            = 3
           IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
           ENDIF.

  • In ABAP HR how to get job using position

    In ABAP HR how to get job using position (Using Infotype 1001)

    Hi anilkumar,
    1. u have the position
       u want the Job
    2. In hrp1001 table
       OTYPE = 'S' (for position)
       OBJID  = POSITION (AS ABOVE)
       SCLAS = 'C' (for finding job)
    <b>   SOBID = XXXXXX (here u will get the JOB)</b>
    regards,
    amit m.

  • How to run VI using bolean control?

    How to run VI using bolean control? Do I need to use invoke node or something else?
    Thank you in advance.

    You cannot start running a vi using a boolean on the front panel of that same VI. Detecting the state of the control requires the VI to be running.
    Maybe you can clarify WHY you need to do this. The run button is for VI development. Once you have a final application, it should be set to "run when opened". The actual code could start out in a wait loop (or wait event) such that pressing a certain button will trigger execution of the main code as needed.
    LabVIEW Champion . Do more with less code and in less time .

  • I have an iPod, iPhone and iPad all set up to a Dell laptop. I recently got a Macbook Pro, how do I transfer all my control for my devices from the Dell to the MacBook?

    I have an iPod, iPhone and iPad all set up to a Dell laptop. I recently got a Macbook Pro, how do I transfer all my control for my devices from the Dell to the MacBook?  Can anyone help?

    http://www.apple.com/support/switch101/
    http://www.macworld.com/article/1153952/superguide_switchingtoamac.html

Maybe you are looking for