Starting and stopping an SQL query from within a Shell script

DB version:10gR2
OS Version:AIX
We have a C++ application called WpnCreate.cpp, which is causing some locking problems.
So, we have decided to capture(using SPOOL) the locking info(session info, blocking program,..etc) using an SQL query.
WpnCreate.cpp program is initiated by a shell script. So we need this SQL query(.sql) to start firing just before WpnCreate.cpp is called and when WpnCreate.cpp has finished executing, we need the SQL query execution to stop.
But how do i stop the sql query execution? Should i capture the session id and serial# of this session and use kill -9 at the end of the shell script?
Flow of the Shell script should be like this
Step1. Start firing the SQL query which captures the locking info and SPOOL them to a file
Step2. Execute WpnCreate.cpp program
Step3. Stop the firing of SQL query once WpnCreate.cpp has finished executing ( i don't know how)How will i go about achieving this?

How can you run your step 2 untill & unless your step 1 gets over. You can run in background but then it will not capture the correct information.
I think you need to run your step 1 after step 2 , then only you will be able to capture the information.
You can run your C++ program in background and can wait for some time using sleep command and then run the query to check the locking information.

Similar Messages

  • Start and stop the Communication channel from Java Mapping

    How to start and stop the Communication channel from Java Mapping in XI 3.0
    Scenario  PI - > MQ -> Third Party web application 
    Web application is down and then Communication channels are stop manually .  
    We need to automate this process,
    MQ Solution - Trigger will be set in MQ which will be called when web application is stopped
    Trigger will send u201CSTOP u201C message to PI
    How to configure PI scenario to stop different com channels when this message received ?

    check this link: http://help.sap.com/saphelp_nw04/helpdata/EN/45/0c86aab4d14dece10000000a11466f/frameset.htm
    make sure that MQ send http request to PI. i dont think a configuration scenario is required in PI. Only roles should be enabled with proper user provided to MQ team.
    However, for security reasons, you can configure a scenario if you dont want to expose PI infrastructure directly to 3rd parties.

  • Start and Stop a Windows Service From Java

    Is there any way to start and stop a Windows service from Java? The only post I found on it (http://forum.java.sun.com/thread.jspa?threadID=647509) had a link to one of the many aps that allow Java programs to be services, which is not what I am interested in doing.
    I am attempting to get data from performance counters from the Windows Performance Monitor into a Java ap without using JNI. I can get the data from C++ or a .net language pretty easily and was going to create a service that would listen for socket requests and feed back the data. However, I'd like to start and stop that service when my java code starts and stops. Is this possible? Would it make more sense to just use a .exe and Runtime.exec()?

    If it's only to start or stop a service then you could use the net command without any need for JNI.import java.io.*;
    public class MsWinSvc {
        static final String CMD_START = "cmd /c net start \"";
        static final String CMD_STOP = "cmd /c net stop \"";
        public static int startService(String serviceName) throws Exception {
            return execCmd(CMD_START + serviceName + "\"");
        public static int stopService(String serviceName) throws Exception {
            return execCmd(CMD_STOP + serviceName + "\"");
        static int execCmd(String cmdLine) throws Exception {
            Process process = Runtime.getRuntime().exec(cmdLine);
            StreamPumper outPumper = new StreamPumper(process.getInputStream(), System.out);
            StreamPumper errPumper = new StreamPumper(process.getErrorStream(), System.err);
            outPumper.start();
            errPumper.start();
            process.waitFor();
            outPumper.join();
            errPumper.join();
            return process.exitValue();
        static class StreamPumper extends Thread {       
            private InputStream is;
            private PrintStream os;
            public StreamPumper(InputStream is, PrintStream os) {
                this.is = is;
                this.os = os;
            public void run() {
                try {
                    BufferedReader br = new BufferedReader(new InputStreamReader(is));
                    String line;
                    while ((line = br.readLine()) != null)
                        os.println(line);
                catch (Exception e) {
                    e.printStackTrace();
    }Regards

  • Why do videos from the internet start and stop, Why do videos from the internet start and stop

    When I try to watch even a short video from the internet, it starts and stops....its annying....any ideas?

    Maybe the speed of your internet connection has some bearing on it?
    But you could give this a try - reset Safari and see if that helps at all.
    Go to Settings>Safari>Clear History, Cookies and Data. Restart the iPad. Restart the iPad by holding down on the sleep button until the red slider appears and then slide to shut off. To power up hold the sleep button until the Apple logo appears and let go of the button.

  • How to start and stop Oracle Application Server from ANT

    How to start and stop Oracle Application Server and Web application from ANT
    Thanks in Advance.
    Mani

    Hi,
    You can use: startManagedWebLogic.sh, it is in your domain directory and you have to execute it in this way
    ./startManagedWebLogic.sh managedServerName http://adminServerHost:adminServerPort
    For instance, in my case I use:
    unixserv01:/webportal/domains/appServerWeb/bin>startManagedWebLogic.sh managedServ01 http://pelma3w3per01.mesaperu.next:7001
    You have to run it on the machine where the managed server was installed.
    Best regards,
    Raúl

  • Start and Stop Weblogic From Admin Console

    Hi All,
    I am using weblogic7.0.I wanted to start and stop the weblogic server from the
    Admin Console(ie., from the GUI).I can stop the server but I cannot start.In order
    to start from admin console what should I do.
    Please post your suggestions.
    Thanks blazix

    You need to run the Node Manager on the manged servers you wish to remotely
    start.
    Chris
    "blazix" <[email protected]> wrote in message
    news:3fc37eea$[email protected]..
    >
    Hi All,
    I am using weblogic7.0.I wanted to start and stop the weblogic server fromthe
    Admin Console(ie., from the GUI).I can stop the server but I cannotstart.In order
    to start from admin console what should I do.
    Please post your suggestions.
    Thanks blazix

  • Starting and stopping oracle in Unix

    I have installed oracle in a Unix Box.
    Since i am very new to Unix, Pls tell me tehs steps to start and stop oracle in Unix from telnet

    In addition to Chris' answer, I encourage you to
    1) Enroll in a Unix course, especially 'Shell Concepts';
    2) Read Oracle's Oracle® Database Administrator's Reference
    10g Release 2 (10.2) for UNIX-Based Operating Systems
    TO help in 1), http://www.injunea.demon.co.uk/pages/page203.htm might be useful.

  • FLV starting and stopping at specific times?

    Im using the flvplayback to put up a video in my swf.
    in my swf i also have several buttons.
    the thing i want to do is when i for example click a button i want to
    start playing the movie from 5 seconds in it and then stop the movie at for
    example 10 seconds in it. even if the video is 20 seconds long i want to
    be able to stop it automatically at 10 seconds in the movie. the start and stop should be
    controlled from the button..
    i know how to start the movie at a specific time but i dont know
    how to stop it at a specific time. is this possible?
    thanks for helping med out!

    FLVPlayback class has a property playheadTime.You will need to read the value of it periodically - so when a desired time is reached, you implement required functionality.
    To do that you will need to add either Event.ENTER_FRAME listener or instantiate Timer class or setInterval method for reading playheadTime.

  • Controlling a procedure execution from a UNIX shell script

    I want to control the execution of a PL/SQL procedure from a UNIX shell script.
    Below, I include the script.
    The control variable which should recive the return of the procedure, dosen't work well.
    I want to control the return, because I wanr to make a UNIX script to control the execution of
    a load data process with some Oracle procedures.
    #!/bin/ksh
    echo "Executing procedure pl/sql"
    SQLPLUS="sqlplus -s /"
    ESQUEMA="esquema1"
    echo "\
    call ${ESQUEMA}.Z_PROC_PRUEBA();" | $SQLPLUS
    echo "Controlling pl/sql execution"
    var_err=$?
    if [ $var_err -gt 0 ]
    then
    echo "Error executing pl/sql"
    else
    echo "pl/sql finished sucessfully"
    fi

    This is not oracle problem. You can try something like this in your shell program ->
    DEV=Udev01/1ods@ODS1
    DEV_ID=`sqlplus -s ${DEV} <<!
             set heading off feedback off verify off
             set serveroutput on
             @/prod/ods/satyaki/prac/ctl_build.sql '$1' '$3';  -- If you sql needs to pass argument
             exit
             !`
    O_DIV_ID=`echo $DIV_ID | tr -s " " | sed 's/^[ ]//g'`
    if [[ $O_DIV_ID -ne 0 ]]; then
          echo "Successfully EXecuted.."
    else
      echo "Failed..."
    fiHope this will help.
    Regards.
    Satyaki De.

  • Sql server agent is not highlighting start and stop options

    I configured snapshot replication , after that sql server agent is not highlighting start and stop options in instance.
    But I can start & stop it in services.msc
    how I can solve this?

    Hi,
    Can you post exact error message.
    Also refer below article, may be similar issue like yours.
    How to start SQL Server Agent when Agent XPs show disabled
    Please mark solved if I've answered your question, vote for it as helpful to help other users find a solution quicker
    Praveen Dsa | MCITP - Database Administrator 2008 |
    My Blog | My Page

  • Starting and Stopping Instances from Netweaver Administrator does not work.

    When we go to our http://<host>:<port>/nwa and navigate to Systems. We see our instances, although we see status and UNKNOWN.
    Also, when we click down to see our server nodes, and try and restart them or stop them...we enter our user/pass for Unix and but it doesn't do anything.
    Does anyone know what is involved to get this functionality to work? We're not looking install CCMS or anything like that, we just want th ability to start and stop our cluster from the central instance web administration screens.
    Thanks,
    -Tim

    Just works for us, without needing any config.
    If your running unix the alternative method is to use a tool called JCMON, much better than NWA.
    log in as <sid>adm onto your host.
    jcmon pf=/usr/sap/PEP/SYS/profile/PEP_JC00_xxxxx
    for our production portal for example;
    Which allows you to do admin on your java instance only.
    use the menu options 10 - 21.
    Message was edited by:
            James Ibbotson
    Message was edited by:
            James Ibbotson

  • Starting and Stopping FMLE from command line yields corrupt .flv files

    I am using FMLE to record and live stream TV content. In order to this I am remotely calling FMLEcmd in order to start and stop encoding processes. The problem that I am running in to is that the .flv files generated are corrupt. The odd thing is that if I use the exact same profile XML from the GUI, then the encoding process works just fine and results appear as intended.
    Here is the way my workflow works:
    I start the process by calling
    FMLEcmd /p C:\lighttpd\htdocs\xml\default.xml /l C:\lighttpd\htdocs\logs\log.txt
    then at the conclusion of the recording I call
    FMLEcmd /s "C:\lighttpd\htdocs\files\default.flv"
    When I attempt to open the files using FFmpeg I get a codec error saying that no codecs were detected. When I attempt to open the files in VLC I get a error saying that the media types are "Undf". When I attempt to open or modify the files with flvtool2 I get an end-of-file error. My guess is that my stop command is incorrect and somehow abruptly stopping the stream, but I don't know another way to stop the stream. Do I need to specify a specific stream duration in the XML and make sure to call the stop command *after* the duration has been reached? What would cause this codec corruption when the same profile works properly from the GUI?
    Here is the profile I am attempting to use.
    <?xml version="1.0" encoding="UTF-16"?>
    <flashmedialiveencoder_profile>
        <preset>
            <name>Custom</name>
            <description></description>
        </preset>
        <capture>
            <video>
            <device>Osprey-440 Video Device 1A</device>
            <crossbar_input>0</crossbar_input>
            <frame_rate>20.00</frame_rate>
            <size>
                <width>640</width>
                <height>480</height>
            </size>
            </video>
            <audio>
            <device>SigmaTel Audio</device>
            <crossbar_input>0</crossbar_input>
            <sample_rate>22050</sample_rate>
            <channels>1</channels>
            <input_volume>75</input_volume>
            </audio>
        </capture>
        <process>
            <video>
            <preserve_aspect></preserve_aspect>
            <deinterlace></deinterlace>
            </video>
        </process>
        <encode>
            <video>
            <format>VP6</format>
            <datarate>650;</datarate>
            <outputsize>640x480;</outputsize>
            <advanced>
                <keyframe_frequency>5 Seconds</keyframe_frequency>
                <quality>Best Quality - Lower Framerate</quality>
                <noise_reduction>None</noise_reduction>
                <datarate_window>Medium</datarate_window>
                <cpu_usage>Dedicated</cpu_usage>
            </advanced>
            <autoadjust>
                <enable>false</enable>
                <maxbuffersize>1</maxbuffersize>
                <dropframes>
                <enable>false</enable>
                </dropframes>
                <degradequality>
                <enable>false</enable>
                <minvideobitrate></minvideobitrate>
                <preservepfq>false</preservepfq>
                </degradequality>
            </autoadjust>
            </video>
            <audio>
            <format>MP3</format>
            <datarate>48</datarate>
            </audio>
        </encode>
        <restartinterval>
            <days></days>
            <hours></hours>
            <minutes></minutes>
        </restartinterval>
        <reconnectinterval>
            <attempts></attempts>
            <interval></interval>
        </reconnectinterval>
        <output>
            <file>
            <limitbysize>
                <enable>false</enable>
                <size>10</size>
            </limitbysize>
            <limitbyduration>
                <enable>false</enable>
                <hours>0</hours>
                <minutes>60</minutes>
            </limitbyduration>
            <path>C:\lighttpd\htdocs\files\default.flv</path>
            </file>
        </output>
        <metadata>
            <entry>
            <key>author</key>
            <value></value>
            </entry>
            <entry>
            <key>copyright</key>
            <value></value>
            </entry>
            <entry>
            <key>description</key>
            <value></value>
            </entry>
            <entry>
            <key>keywords</key>
            <value></value>
            </entry>
            <entry>
            <key>rating</key>
            <value></value>
            </entry>
            <entry>
            <key>title</key>
            <value></value>
            </entry>
        </metadata>
        <preview>
            <video>
            <input>
                <zoom>100%</zoom>
            </input>
            </video>
            <audio></audio>
        </preview>
        <log>
            <level>100</level>
            <directory>C:\Documents and Settings\Administrator\My Documents\My Videos</directory>
        </log>
    </flashmedialiveencoder_profile>

    If issue of corrupt file after cmd line not in GUI mode. Are you using some automation to copy/paste output flv to someother location?
    AFAIK, after placing stop command, FMLE took some time to write proper EOF in FLV. wait ~10 sec for FMLE to complete file writing process and than play in FLV PLayer.
    I tried manually with steps you mentioned and it's working fine for me.I playerd file in Applian Flash PLayer. "http://www.applian.com/flvplayer/"

  • Starting and stopping a VI from another VI

    Hello
    I have to write a VI for starting and stopping a vi from another vi. I browsed the forums for an example but couldn't find one. If anyone has an example it would be of great help.
    Thanks
    Ankit

    I may be throwing myself into a pot of boiling water here, but...
    I don't think this method is called dynamically calling a VI. Going through the LabVIEW help says this about dynamically called VIs
    "You can dynamically load VIs instead of using statically linked subVI calls. A statically linked subVI is one you place directly on the block diagram of a caller VI. It loads at the same time the caller VI loads.
    Unlike statically linked subVIs, dynamically loaded VIs do not load until the caller VI loads them with the Open VI Reference. If you have a large caller VI, you can save load time and memory by dynamically loading the VI because the VI does not load until the caller VI needs it, and you can release it from memory after the operation completes. You also can use the VI Call Configuration dialog box to configure when to load the subVI."
    and:
    "Create a strictly typed VI reference to dynamically call a VI using the Call by Reference Node. The strictly typed VI refnum identifies the connector pane of the VI you are calling."
    It seems that the advantage of dynamically calling a VI you can call DIFFERENT VI's with the same function on the block diagram as long as both are strictly typed to have the same connector pane. So say you have a VI that has a voltage input and a time input and calculates the rate of voltage change, could be replaced by a VI that takes the same inputs, but does something else with the data. And both VI's could be called by the same function depending of the reference passed to "Call by Reference."
    I think the method of calling a VI and not caring about when it finishes is just an Invoke Node method.

  • Start and Stop Apex from linux

    I have tried to find out which script is used to start and stop apex, but i hadn't been able to find it. If i do a netstat i do not see the 8080 port open but i can use apex. If i do "service oracle-xe start" oracledb starts correctly but i cannot use apex. Thanx in Advance

    here are windows script...
    First stop db, then listener then opmn (Apache)
    net stop OracleServiceXE
    net stop OracleOraDb10g_home1TNSListener
    C:\oracle\product\10.2.0\db_2\opmn\bin\opmnctl stopproc ias-component=HTTP_ServerTo start:
    net start OracleOraDb10g_home1TNSListener
    net start OracleServiceXE
    C:\oracle\product\10.2.0\db_2\opmn\bin\opmnctl startproc ias-component=HTTP_ServerOn linux you start lister through lsnrctl start/stop "name of listener"... opmn is started the same way as shown here...
    db can be started/stopped as
    ORACLE_SID=XE
    sqlplus '/ as sysdba' @start/stop_script.sqlwhere start/stop_script.sql has:
    <b>startup</b>
    or
    <b>shutdown immediate</b>
    in it.
    Hope this helps a little

  • Starting and Stopping Server from Administration Console without using system ID

    Hi,
    I tried to create another user in the ACL and add it to the Administrators
    group. When I connect to the admin console using this user I receive error
    message NoAccessRuntimeException. Can anybody show me how ti configure user
    to access the console to start and stop managed server. I am using WebLogic
    6.1 SP1. TIA.
    regards,
    Rudy

    Any user added to the Admin group should be able to use the weblogic.Admin
    utility and stop the server and access the console. So if we add Rudy as a user
    to the Admin group then Rudy should be able to stop the server and also use the
    weblogic.Admin commands. however, you cannot start the server with rudy's
    password. You will require a system password for starting the server.
    Please check if the user has been added correctly to the Admin group. you can
    check this in the fileRealm.properties file:
    user.rudy=0x751cc5f18261ba5e570c19a0d2d3cc29a5c5de63
    group.Administrators=system,rudy
    hope this helps,
    Mihir
    Rudy Sutjiato wrote:
    Hi,
    I tried to create another user in the ACL and add it to the Administrators
    group. When I connect to the admin console using this user I receive error
    message NoAccessRuntimeException. Can anybody show me how ti configure user
    to access the console to start and stop managed server. I am using WebLogic
    6.1 SP1. TIA.
    regards,
    Rudy

Maybe you are looking for

  • Integration SCM (EWM) 7.01  to ERP ECC 6.0

    Hello, we are "trying" to integrate an SCM 7.0.1 to an ERP ECC 6.0. Material master data and goods received deliveries will be transfered from ERP to SCM sucessfull, but the quotation and the goods movement based on the purchase order  at ERP does no

  • To upgrade???  or Not to Upgrade......What do I do????

    So what is the verdict here??? Do I download 6.0 and take the risk of all of these potentional problems or not. My son downloaded 6.0 last night, and he can't get anything to work right... I want to be able to check out all of the new video features,

  • Failed to schedule crystal report

    Hi, We are using BO XI R3.1 and I am trying to schedule a crystal report in CMC in pdf format which contains parameters. After the schedule the error message am getting was Error in File ~tmp29bc61e513637d0.rpt: Failed to retrieve data from the datab

  • My iphone4 not working

    Hi there today i just received my iphone4 , i bought it from UK .. but i am now in kuwait .. and i can not use it when i insert the Micro SIM i get the screen which asking to connect the iphone to itunes and once i connect it to itunes i get a messag

  • Trying to setup an allowance acct

    getting an error on last page when i click 'buy' (for your security, please enter a longer answer). Not sure what they are referring to.