How to call SQL job step by step from windows batch file

Hi ,
I have a SQL agent job [POC_IOD_RunPkgJob]  which is being called from bat file with below command.
Could you please tell me how to call only one step of this job, what command I need to mention in the batch file.
SQLCMD -Sabcwi\SQLI01,51565 -E -Q"exec msdb.dbo.sp_start_job [POC_IOD_RunPkgJob]"

Hi RameshDravid,
Regarding your description,though not aware of what is the purposed to call only one step of that job, the below sample can somewhat help to achieve your requirement.
--find the job steps
SELECT
steps.step_id,steps.step_name,steps.subsystem,steps.command
FROM msdb.dbo.sysjobsteps steps
JOIN msdb.dbo.sysjobs jobs
ON steps.job_id = jobs.job_id
WHERE jobs.name = 'youJobName'
--find the command runs in that step, usually that is some command exec stored procedure
SQLCMD -Sabcwi\SQLI01,51565 -E -Q"exec stored procedure found in the above query"
If you have any question, feel free to let me know
Eric Zhang
TechNet Community Support

Similar Messages

  • Call Oracle Stored Procedure with Parameters from Windows Batch File

    Hi,
    I have an oracle procedure that requires two parameters to execute, start date and end date as such:
    CREATE OR REPLACE PROCEDURE insert_orders(
    pSTART_DT IN varchar2
    , pEND_DT IN varchar2
    I want to create a windows batch file to execute the procedure but want to be able to specify the parameters (ie start and end dates) in the batch file as opposed to changing the sql file that the batch file uses to execute the procedure but I don't know what the syntax is. I tried the following but it still doesn't work.
    Sql File: call_insert_orders.sql
    execute insert_orders('&1','&2');
    exit
    Batch File:
    sqlplus username/password @call_insert_orders.sql %01-jan-2010% %01-jan-2011%
    When I execute the batch file, my DOS window still prompts me to enter value 1 so I think it recognizes that there is a variable being used but is not able to fill in the actual value I specify. I'm not an experienced DOS/Windows Batch File person so I'm guessing it's my syntax that's screwed up. There is not a lot of documentation on this subject matter hence my post on this forum. Any helps would be appreciated.
    Thanks

    Hello,
    Just try the same DOS command without all the % sign.
    In MS-DOS, the % at the beginning and at the end of a string are for variables. Which means your batch is looking for a variable called 01-jan-2010 and a variable called 01-jan-2011, but those are the values you want to pass, not the name of variables.
    As they are not defined, nothing is passed to the sqlplus script, and that is why you are prompted for values.
    Hope it will help.
    Regards,
    Sylvie

  • How to check Oracle DB Status from Windows batch file

    Hi,
    I need a script which can be used to check the Oracle Database Status from windows command batch file.
    Thanks,
    Kishore

    Hi Virendra,
    I have followed the steps mentioned in ur reply, But couldn't get the output.
    I am getting the below error
    C:\>db_utility.bat PLPDEV
    ERROR:
    ORA-12560: TNS:protocol adapter error
    SP2-0306: Invalid option.
    Usage: CONN[ECT] [logon] [AS {SYSDBA|SYSOPER}]
    where <logon> ::= <username>[<password>][@<connect_string>] | /
    SP2-0306: Invalid option.
    Usage: CONN[ECT] [logon] [AS {SYSDBA|SYSOPER}]
    where <logon> ::= <username>[<password>][@<connect_string>] | /
    SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus
    C:\>
    Below is my bat file
    @echo off
    set ORACLE_SID=%1
    echo sys/ltd1_plp as sysdba
    echo set cmdsep on
    echo set cmdsep '"'; --"
    echo set term on
    echo "select status from v$instance;"
    ) | sqlplus -s
    Thanks

  • How to run a project which gets parameters from a batch file

    Hello all,
    I use to run a program, which gets parameters only by interactive mode, using a batch file as you can see below:
    # myprogram < batchfile.txt
    Now, I'm updating its code by SunStudioExpress IDE and I'd like to run it from the batchfile. I have noticed that the project properties window has the option run -> arguments, however this program doesn't accept arguments this way and for changing it, I'd have a hard job.
    Does someone know how to run this project and to get its parameters from batchfile?
    Regards,
    Glauber

    Ah, it appears that when you run the project, "<" is passed as one of the arguments and is not treated as input redirection.
    Sorry, it looks like it is not possible to do the redirection; and it looks like a bug to me. Could you please file it through bugs.sun.com? It shouldn't take long as the problem is evident now.

  • How to call Provisioning Job from On-Demand Job.

    Hi Experts,
    I need your help.
    I am using SAP IDM 7.2
    Please tell me how to call provisioning Job from ON-Demand Job.
    Regards,
    C Kumar

    As everyone else has already mentioned, the uProvision function is probably what you're looking for. It's well documented in the helpfile so I won't add the parameter description here. A provisioning task can only be run on a mskey/taskid combination so you need to provide both to start the task. That means that you should have a global or job constant pointing to the task, and a script or source select statement that looks up the mskey that you want to start.
    Simple example, using a To Generic pass to start the task "Dispatcher test #1.0.0" for 1000 entries whos names start with "USER.10K.TEEST"
    Source:
    To Generic pass destionation:
    TASKID could also be a global constant w. a task reference since tasknames have no uniqueness.
    Source SQL Statement:
    select top 1000 mcmskey mskey,(select taskid from MXP_Tasks where TaskName = 'Dispatcher test #1.0.0') as taskid
    from idmv_entry_simple where mcMskeyValue like 'USER.10KTEEST.%'
    Destionation script:
    // Main function: execT
    function execT(Par){
      mskey = Par.get("MSKEY");
      taskid = Par.get("TASKID");
      OutString = uProvision(mskey,taskid,0,0,"test dispatcer #1.0.0",0);
      // uInfo(mskey+":"+taskid+":"+OutString);
      return "";
    Br,
    Chris

  • How to call SQL Script in DBMS_SCHEDULER

    How to call SQL Scripts in DBMS_SCHEDULER?
    Things I got working
    1) Successfully created and tested a PL/SQL that was created under SQL Workshop->SQL Scripts (I named it 'TEST'). I was able to run this no problem.
    2) Successfully created a DBMS_SCHEDULER that runs every minutes. (See below)
    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;The problem i am having is to make the PL/SQL script (named 'TEST') runs every minute. Its probably very easy to do that but i dont seems like finding any examples online.
    I tried replacing the job_action attribute to " job_action => 'begin TEST; END;', " However, that did not work.
    I am stuck here for couple hours already, any clues would be great :)
    Thanks in advance
    John
    Application Express 4.1.0.00.32
    Edited by: John Lau on Aug 14, 2012 12:47 PM
    Edited by: John Lau on Aug 14, 2012 12:48 PM

    The PL/SQL is pretty long, I would like to call it from a different location rather then putting the whole coding as part of the argument. Sounds like I should be looking into procedure package in database?
    I will do some more research on procedure package, how to create one and how to call from it.
    Thanks
    John

  • Calling separate LSMW steps from ABAP program

    Hai all,
    anybody know if I can call sepearte LSWM step from a ABAP programm,
    I only need to:
    Specify Files
    Import Data
    Convert Data
    Create Batch Input Session
    Run Batch Input Session
    Need this steps so i can provide backoffice user a tool which imports data using  predefined  LWSM.
    Grtz
    Richard
    Edited by: Richard van Veen on Jun 7, 2010 1:15 PM

    I made a lsmw and after completing all steps i tested step 080/100/300 and 310 from se37, it seems to work fine, i will update when completed
    010      Maintain Object Attributes       OBJ     /SAPDMC/LSM_OBJ_ATTRIBUTES
    020      Maintain Source Structures      OBJ     /SAPDMC/LSM_OBJ_SOURCE_STRUCS
    030      Maintain Source Fields OBJ     /SAPDMC/LSM_OBJ_SOURCE_FIELDS
    040      Maintain Structure Relations     OBJ     /SAPDMC/LSM_OBJ_STRUCT_RELATNS
    050      Maintain Field Mapping and Conversion Rules OBJ     /SAPDMC/LSM_OBJ_FIELDMAPPING
    070      Maintain Fixed Values, Translations, User-Defined Routines    RUL            /SAPDMC/LSM_RUL_ADMINISTRATION
    080      Specify Files    OBJ     /SAPDMC/LSM_OBJ_FILES_SPECIFY
    090      Assign Files      OBJ     /SAPDMC/LSM_OBJ_FILES_ASSIGN
    110      Import Data     EXE     /SAPDMC/LSM_EXE_READPROG_RUN
    120      Display Imported Data DSP     /SAPDMC/LSM_DSP_READ_DATA_SHOW
    130      Convert Data   EXE     /SAPDMC/LSM_EXE_CONVPROG_RUN
    140      Display Converted Data           DSP     /SAPDMC/LSM_DSP_CONV_DATA_SHOW
    300      Create Batch Input Session      EXE     /SAPDMC/LSM_EXE_BI_PROGRAM_RUN
    310      Run Batch Input Session          EXE     /SAPDMC/LSM_EXE_BI_SESSION_RUN
    600      Frame Program for Periodic Data Transfer      EXE     /SAPDMC/LSM_EXE_INTERFACE

  • How to call main method in one class from another class

    Suppose i have a code like this
    class Demo
    public static void main(String args[])
    System.out.println("We are in First class");
    class Demo1
    public static void main(String args[])
    System.out.println("We are in second class");
    In the above program how to call main method in demo calss from Demo1 class......???????

    No, i dont know how to call other than main methods from other classes
    And one more doubt i have i.e. Like in C can we see the execution of the program like how the code is being compiled step by step and how the value of the variable changes from step to step like(Add Watch).........

  • How to execute a  .sql file from a batch file

    Hi all
    I've to take backup of a database weekly twice on every wednesday & Friday @ 5pm IST. I've written a hot backup script, which works every well.
    now i want to automate the script. ie i want this script to run on wednesday & friday @ 5pm without any human interfearance ie with out actually any1 executing this script.
    i created a batch file prod.bak with the following lines
    @echo off
    set oracle_sid=testdb
    set oracle_home=d:\oracle\ora92
    sqlplus /nolog
    connect sys as sysdba/oracletest@testdb
    this batch file when eexecuted connects me to sql prompt.
    Now i want to execute my backup script bkp.sql automatically when it is connected to sql prompt.
    (i tried with these lines in the above batch file...
    call bkp.sql---it just opens the bkp.sql file in notepad & displays the script
    start bkp.sql---same as call
    connect / as sysdba/pwd@[email protected] --- does not work simply remains a the sql prompt.
    At 17:00 /Every:w,f "d:\bkp.sql"---does not work simply remains at the sql promt.)
    Can any1 let me know what should i write in the batch file that will execute the bkp.sql file automatically after it gets connected to sql prompt. M using oracle 9i.
    I'll manage he time through windows utility of scheduling task.. Let me know how to execute the .sql file from a batch file.
    Thanks
    Tripti

    Try
    sqlplus "sys/oracletest as sysdba" @bpk.sql
    Working locally, and having set the ORACLE_SID, you don't need to specify the SqlNet alias (@testdb).
    Remember to put an exit at the end of the bpk.sql script.

  • How to call Operating System commands / external programs from within APEX

    Hi,
    Can someone please suggest how to call Operating Systems commands / external programs from within APEX?
    E.g. say I need to run a SQL script on a particular database. SQL script, database name, userid & password everything is available in a table in Oracle. I want to build a utility in APEX where by when I click a button APEX should run the following
    c:\oracle\bin\sqlplusw.exe userud/password@database @script_name.sql
    Any pointers will be greatly appreciated.
    Thanks & Regards,

    Hi Guys,
    I have reviewed the option of using scheduler and javascript and they do satisfy my requirements PARTIALLY. Any calls to operating system commands through these features will be made on the server where APEX is installed.
    However, here what I am looking at is to call operating systems programs on client machine. For example in my APEX application I have constructed the following strings of commands that needs to be run to execute a change request.
    sqlplusw.exe user/password@database @script1.sql
    sqlplusw.exe user/password@database @script2.sql
    sqlplusw.exe user/password@database @script3.sql
    sqlplusw.exe user/password@database @script4.sql
    What I want is to have a button/link on the APEX screen along with these lines so that when I click that link/button this entire line of command gets executed in the same way it would get executed if I copy and paste this command in the command window of windows.
    Believe me, if I am able to achieve what I intend to do, it is going to save a lot of our DBAs time and effort.
    Any help will be greatly appreciated.
    Thanks & Regards,

  • Is it possible to call a windows batch file from PL/SQL block ??

    Hi gurus,
    Would require your help.Is it possible to call a windows batch file from PL/SQL block ??If yes can you give an example for the same or any workaround for the same.
    Regards
    Vijay

    You didn't specify a database version, but if you are 10g or higher, it's quite straightforward using an external job type in DBMS_SCHEDULER. Funnily enough i'm looking at something similar myself at the moment.
    Useful guide to some of the issues here Guide to External Jobs on 10g with dbms_scheduler e.g. scripts,batch files

  • How to call & pass values to custom page from seeded page table region

    Hi All,
    can anyone tell me how to call & pass values to custom page from seeded page table region(Attribute is not available in seeded page VO)
    it is urgent. plssss
    Regards,
    purna

    Hi,
    Yes, we do this by extending controller, but you can also try this without extending controller.
    1. Create Submit Button on TableRN using personalization.
    2. Set "Destination URI" property to like below
    OA.jsp?page=/<yourname>/oracle/apps/ak/employee/webui/EmpDetailsPG&employeeNumber={@EmployeeId}&employeeName={@EmployeeName}&retainAM=Y&addBreadCrumb=Y
    Give your custom page path instead of EmpDetailsPG.
    EmployeeId and EmployeeName are VO attributes(Table Region)
    If you dont have desired attribute in VO, then write logic in your custom page controller to get required value using parameters passed from URL path.
    In this case, only personalization will do our job. Hope it helps.
    Thanks,
    Venkat Y.

  • How to call a AM method with parameters from Managed Bean?

    Hi Everyone,
    I have a situation where I need to call AM method (setDefaultSubInv) from Managed bean, under Value change Listner method. Here is what I am doing, I have added AM method on to the page bindings, then in bean calling this
    Class[] paramTypes = { };
    Object[] params = { } ;
    invokeEL("#{bindings.setDefaultSubInv.execute}", paramTypes, params);
    This works and able to call this method if there are no parameters. Say I have to pass a parameter to AM method setDefaultSubInv(String a), i tried calling this from the bean but throws an error
    String aVal = "test";
    Class[] paramTypes = {String.class };
    Object[] params = {aVal } ;
    invokeEL("#{bindings.setDefaultSubInv.execute}", paramTypes, params);
    I am not sure this is the right way to call the method with parameters. Can anyone tell how to call a AM method with parameters from Manage bean
    Thanks,
    San.

    Simply do the following
    1- Make your Method in Client Interface.
    2- Add it to Page Def.
    3- Customize your Script Like the below one to Achieve your goal.
    BindingContainer bindings = getBindings();
    OperationBinding operationBinding = bindings.getOperationBinding("GetUserRoles");
    operationBinding.getParamsMap().put("username", "oracle");
    operationBinding.getParamsMap().put("role", "F1211");
    operationBinding.getParamsMap().put("Connection", "JDBC");
    Object result = operationBinding.execute();
    if (!operationBinding.getErrors().isEmpty()) {
    return null;
    return null;
    i hope it help you
    thanks

  • Is it possible to call a windows batch file from PL/SQL

    Hi gurus,
    Would require your help.Is it possible to call a windows batch file from PL/SQL??If yes can you give an example for the same or any workaround for the same.
    Regards
    Vijay

    Hi!
    Youn need some extproc related entries in you listener.ora and tnsnames.ora file.
    *1. In the listener.ora:*
    Defining the listener process is done in two parts.
    The information contained in each listener differs!!!
    The first part is as follows:
    LISTENER =
      (DESCRIPTION_LIST =
        (DESCRIPTION =
          (ADDRESS = (PROTOCOL = IPC)(KEY = extproc))  <---  *ADD THIS LINE
          (ADDRESS = (PROTOCOL = TCP)(HOST = yourhostname)(PORT = 1521))
      )The seoncd part is as follows:
    SID_LIST_LISTENER =
      (SID_LIST = 
        (SID_DESC =
          (GLOBAL_DBNAME = YOUR_GLOBAL_DBNAME)
          (ORACLE_HOME = c:\oracle\product\10.2.0)  <-- THIS IS YOUR ORACLE_HOME
          (SID_NAME = YOUR_SID)                            <-- SID
        (SID_DESC =                                              <--- ADD THIS LINE
          (SID_NAME = PLSExtProc)                          <--- ADD THIS LINE
          (ORACLE_HOME = c:\oracle\product\10.2.0) <--- ADD THIS LINE AND EDIT TO YOUR ORACLE_HOME
          (PROGRAM = extproc)                                <--- ADD THIS LINE
          (ENV = "EXTPROC_DLLS=ANY")                  <--- ADD THIS LINE
        )                                                                <--- ADD THIS LINE
      )*2. In the tnsnames.ora you need to add the following entry:*
    *(The KEY value entered must be match to the KEY value entered int the listener.ora file!)*
    EXTPROC_CONNECTION_DATA =
      (DESCRIPTION =
        (ADDRESS_LIST =
          (ADDRESS = (PROTOCOL = IPC)(KEY = extproc))
        (CONNECT_DATA =
          (SID = PLSExtProc)
          (PRESENTATION = RO)
      )Finally you need to restart your listiner. After restarting there will be a service called "PLSExtProc" in your listener.
    This are only examples for extproc configuration, your tnsnames.ora and listener.ora can be differs.
    FIRST MAKE MAKE A BACKUP OF YOUR ORIGINAL tnsnames.ora AND listener.ora FILES
    For more information please check metalink note 68061.1 "EXTPROC: Creating External Procedures on Windows NT"
    Bestr Regards
    Norbert

  • How will write SQL query to fetch data from  each Sub-partition..

    Hi All,
    Anyone does have any idea about How to write SQL query to fetch data from Sub-partition.
    Actually i have one table having composite paritition(Range+list)
    Now if i want to fetch data from main partition(Range) the query will be
    SELECT * FROM emp PARTITION(q1_2005);
    Now i want to fetch data at sub-partition level(List) .But i am not able to get any SQL query for that.
    Pls help me to sort out.
    Thanks in Advance.
    Anwar

    SELECT * FROM emp SUBPARTITION(sp1);

Maybe you are looking for

  • How can I sync my iPhone and iPad to my computer but not have notifications on my computer?

    I want to be able to back up my ihpone and ipad to the cloud but not have any notifications on my computer. The reason being is that it is my husbands computer that I synced it to and now he is getting all of my pop up notification/reminders on his i

  • Shade background before printing a form

    Hi, I have a single page form which need to be printed twice, the first copy with a white background ( standard ) the second copy needs to have the page shaded with a yellow Background. Reason to save having to put a white paper and yellow paper into

  • How to enable my disabled iphone.it says connect to itunes

    How do i enable my disabled iphone.It says connnect to itunes.Tell me what can i do about it

  • ID setting for WebServices

    I want to know how to define web services in ID. - Is that a business system or business service? - What (settings for TS, BS) needs to be done in SLD. Thanks

  • Best practice to run BOBJ server

    Is that a best practice to install the BOBJ (BOE) server in Netweaver stack.. may or may not use BI may or may not use Netwever Portal Have said above, I would appreciate best solution for running BOBJ server.. Thanks-gopal