Capture to users running sql in shell script after every 10 minutes

Hi all

We have a strange problem. crash of database, so decided to check that users make when OS/DB crashes.

I need your RACE/SCHEDULING of entry into such a script, which includes all active users with SQL running and add to a log file so that we are aware of what has past when DB/OS crashed.

I can run this race a query V$ SESSION, V$ SQL and V$ PROCESS but I need your ideas in writing a SHELL Script and scheduling can work via CRON.

Kind regards.

Or better yet

sqlplus /some_report_file. 'date + %m-%d - hour %M %Y'

Tags: Database

Similar Questions

  • VPN users drops after every 5 minutes

    Hello world

    We have users whose remote VPN drops after every 5 minutes.

    I need to know what things can check to solve the problem?

    The user connects by RSA Token.

    ISP connection is ok is not question.

    Something I can verify in SAA?

    Thank you

    Mahesh

    Client side, have you tested wired vs wireless to see if the problem exists in both?  If it's the only one, but not the other, try to update the drivers.  Also, if it's windows 7, take a look at the power settings in the control panel.  I saw where the aggressive powers will be stop standby network port.  Not that big of a deal in a LAN environment but it wreaks havoc on the VPN.

  • Component sql through shell script

    How to call a sql through UNIX shell script file?

    Rahul India wrote:

    export ORACLE_HOME=$ORACLE_BASE/product/10g
    
    cd $ORACLE_HOME
    set `sqlplus -s / <
    

    THIS SCRIPT IS OK?

    You will also need to set ORACLE_SID

    And I don't know why everyone puts the reference to sqlplus context of a 'set' assessment, nor why they put the reference to Scripture in a redirected input stream. What you need is

    sqlplus -s user/password  @r_100.sql
    

    And to make sure the environment is set correctly:

    export ORACLE_SID=whatever
    export ORAENV_ASK=NO
    . oraenv
    unset ORAENV_ASK=NO
    sqlplus -s user/password  @r_100.sql
    
  • DBMS_SCHEDULER - trying to create and run a UNIX shell script from Oracle

    How can I run Script Shell Unix from Oracle using DBMS_SCHEDULER?

    After reading many examples online, I finished the 3 steps below.
    Create program, create jobs, run task. On my 3rd stage, I get the following error.
    How can I make sure that the work was created?

    ORA-27475: "APPS. POSPAY_FILE_CHECK_JOB' must be work

    (1) create the program
    BEGIN
      dbms_scheduler.create_program(
         program_name => 'POSPAY_FILE_CHECK_PROG',
         program_type => 'EXECUTABLE',
         program_action => '/home/ldcgroup/ldccbc/POSPAY_USC2_CHECK.sh',
         number_of_arguments => 0,
         enabled => TRUE,
         comments => 'Test Program'
         );
    END;
    (2) create jobs
    BEGIN
    DBMS_SCHEDULER.CREATE_JOB (
       job_name          =>  'POSPAY_CHECK_FILE_JOB',
       program_name      =>  'POSPAY_CHECK_FILE_PROG',
       enabled           =>   TRUE);
    END;
    /
    (3) the job (not calendar, I'll run this a concurrent request of EBS)
    BEGIN
       DBMS_SCHEDULER.run_job (
         job_name => 'POSPAY_FILE_CHECK_JOB');
    END;
    /

    Of [documentation | http://download.oracle.com/docs/cd/E11882_01/server.112/e10595/scheduse002.htm#i1009668]

    The job is created disabled. You must enable it with DBMS_SCHEDULER.ENABLE before the Scheduler will automatically run it.
    
    Jobs are set to be automatically dropped by default after they complete. Setting the auto_drop attribute to FALSE causes the job to persist.
    
  • Is it normal for my AirPort Extreme to run his fan on and off every 2 ' minutes throughout the day?

    I have a 2nd ae put in place to extend our network.  The second flashing yellow from time to time, always in the works, but the fan runs constantly II never heard our other use on the fan.  Never.

    If you ask about the current 'tour' in the form of version of AirPort Extreme, the fan runs constantly... (and normally very quietly)... as long as the AirPort Extreme has the power.

    This is the model you have?  If so, then the airport is defective. If the product is less than one year, or you have AppleCare implemented on one of your Macs... and... He airport most convenient is less than 3 years, Apple will replace the device for you.

    If your AirPort Extreme is not covered... and you are an it yourself type of person... you can open the AirPort Extreme and are looking for a replacement of the fan.  This article will give some tips on the opening of the product. Note that section provides the number of manufacturer and model of the fan, so you can use it to search for a replacement.

    AirPort Extreme A1521 teardown - iFixit

  • Why should I allow Adobe Flash Player run all of a sudden almost every other minute?

    I'm not updating I do not add plug-ins I have nothing, but browse the sites SAFE and all of a sudden, Adobe Flash Player does from time to time, and Mozilla asks me if I want to allow it to work?

    All versions of the Flash plugin have been disabled by Mozilla because of a disclosed security hole that Adobe has to fix.

    Please, do not comment in bug reports
    https://Bugzilla.Mozilla.org/page.cgi?id=etiquette.html

  • Need to call the Shell script that uses SQL loader in APex4.1 / 11g

    Hello!

    I have a requirement in which I need to call a shell script that connects to an external server, FTP to a file and then use sqlloader to load data into our table. We have now the ftp script that accomplishes this task to another program, but is a scheduled task. I wanted to call the script ftp in the APEX. Any suggestions on how this can be done, what is the logic of PL/SQL can we use? I saw online some people using DBMS Scheduler for this?

    Thank you
    Sun

    Hello

    Create some sh script on your computer host oracle where you can join in the external server and run the process.
    something like:

    run_external_sh.sh

    #!/bin/sh
    ssh ext_user@ext_host ./sqlloader/import/import.sh
    

    Then create an external TASK to call it via ORACLE (PL/SQL)

    -Shell Script call.

    BEGIN
      DBMS_SCHEDULER.create_program (
        program_name        => 'external_call_sh',
        program_type        => 'EXECUTABLE',
        program_action      => '/local_host/call_external/sh/run_external_sh.sh',
        number_of_arguments => 0,
        enabled             => TRUE,
        comments            => 'Call external SH script');
    END;
    /
    

    You can now create a regular / or unplanned WORK
    -Job defined by the calendar and an existing program.

    BEGIN
      DBMS_SCHEDULER.create_job (
        job_name      => 'jb_external_call_sh',
        program_name  => 'external_call_sh',
        schedule_name => 'external_call_scheduler', -- created scheduler
        enabled       => TRUE,
        comments      => 'Job defined by an existing external_call_sh program and schedule.');
    END;
    /
    

    You can now call the WORK in the APEX in the process of PL/SQL.

    BEGIN
      -- Run job synchronously.
      DBMS_SCHEDULER.run_job (job_name            => 'jb_external_call_sh');
    END;
    

    Concerning
    J :D

  • will not appear sql statemnt in shell script

    Hello

    I have a shell script with an unfavourable sql she calls another script where I connect to dabase.

    In the journal of the script, I see the sql statement and I wish that that do not show me anything. How I make these?

    Thank you

    Hello

    2650697 wrote:

    Hello

    I have a shell script with an unfavourable sql she calls another script where I connect to dabase.

    In the journal of the script, I see the sql statement and I wish that that do not show me anything. How I make these?

    Thank you

    Your postal code.  It is very difficult to tell what you're doing wrong without knowing what you are doing.

    You can have SQL statements directly in your shell script.  They must be in a script by themselves, said fubar.sql, and shell script must contain

    @fubar

    instead of real SQL statements.

  • How to execute the pl/sql shell script

    Hi Experts


    I need to be able to call a pl/sql procedure shell script

    Linux and 11g

    I am new to java and followed the solution below
    The appeal of OS in Plsql commands

    After following the solution on top of link

    Declare
    x Varchar2 (2000);
    Begin
    x: = OSCommand_Run ('ls - the);
    -print x;
    DBMS_OUTPUT. Put_line (x);
    End;
    /

    give me output of 0 but the command is not executed.

    What must be changed or is there another solution?

    Thank you
    Archana

    See if that helps...

    [http://www.oracle-base.com/articles/8i/ShellCommandsFromPLSQL.php]

  • Calling shell script program SQL and passing parameters

    Hi guys,.
    Greetings from Toronto. Is it possible to move one or more strings as parameters to a sql from shell script program?

    Shell script
    # Accept system input parameters
    p_user_id=$1
    p_job_id=$2
     
    sqlplus.exe -s $p_user_id @$RD_PATH/rd_test.sql $p_user_id $p_job_id
    SQL program (rd_test.sql)
    -- Accept system input parameters
    define p_user_id = &1
    define p_job_id = &2
    
    -- Wondering if its possible to pass these 3 parameters from a shell script program.
    -- (1) rd_test-$p_job_id-3-1.lis
    -- (2) RD_PRINTER(rd_test,3)
    -- (3) t_data
    
    select
    t_data=''rd_test-'||'''$p_job_id'''||'-1-1.txt''
    t_data_dir=''.''
    ksh $RD_PATH/another_shell_prog.sh $p_user_id $p_job_id '||a.rd_value||' '
    ||b.rd_value||' rd_test-$p_job_id-3-1.lis $RD_PRINTER(rd_test,3) '||
    '$t_data $t_data_dir'||'
    exit_status=$?
    check_command'
    from rd_job_parameter b, rd_job_parameter a
    where a.job_id = &2
    and a.jp_module_id = 'RDTEST'
    and b.job_id = a.job_id
    and b.module_id = a.module_id
    /
    As always, this is not something I have to solve that minute. Any help would be appreciated
    and I will think of the problem.

    Thank you
    REDA

    Published by: Raj404261 on June 25, 2009 11:40

    Published by: Raj404261 on June 25, 2009 17:29

    OK, just a few pointers possible if you need to go the way of shell script.

    I suggest that you have a separate SQL script for each of your options, which retains the fairly well-defined lines and keeps the maintenance as simple as possible. Therefore, in your shell script, you can have something like:

    #!/bin/ksh
    # Accept system input parameters
    p_user_id=$1
    p_job_id=$2
    
    # Deduce which script you'll call here
    # using if statements, or even a case:
    
    if [[ p_job_id -eq 1 ]]
    then
      SQL_SCRIPT=sql_script1.sql
    else
      SQL_SCRIPT=sql_script2.sql
    fi
    
    # Or using case
    
    case $2
      in
        1)     SQL_SCRIPT=sql_script1.sql;
    
        2)     SQL_SCRIPT=sql_script2.sql;
    
        3)     SQL_SCRIPT=sql_script3.sql;
    
        *)     SQL_SCRIPT=sql_script4.sql;
    esac
    
    export ${SQL_SCRIPT}
    
    #If you need to query the database at all to deduce which script to cal
    #Then something like this:
    
    SCRIPT_VAR=`sqlplus -s username/password << EOF
    set heading off
    set feedback off
    set verify off
    SELECT * FROM DUAL;
    EOF`
    
    export {SCRIPT_VAR}
    
    SQL_SCRIPT=sql_script${SCRIPT_VAR}.sql
    
    # Then just call your script:
    sqlplus. -s $p_user_id/password @${SQL_SCRIPT}
    
  • OEDQ 9.0.8 - external task - execution of Shell Script

    Hello Disqualification Experts.

    I am looking for your expert advise on this... With the help of the external task I am able to call the .bat (batchfiles) but I'm not able to run .ksh (UNIX shell script file), attached is the example script I am trying to run via the external task.

    File name: testfile.ksh

    #! / usr/bin/ksh

    Set - x

    $ORACLE_HOME/bin/sqlplus - s edq_test/edqtest@edqd < < EOF

    WHENEVER SQLERROR EXIT SQL. SQLCODE

    EXECUTE SP_TRUNCATE_TABLE ('ABC_OWN', 'ABC_TABLE');

    COMMIT;

    quit smoking;

    EXPRESSIONS OF FOLKLORE

    output

    Disqualification-> Manager-> External tasks-> Creates a new task called TestTask who has the below...

    Command: testfile.ksh

    Working directory: \opt\local\software\edq\config\commandarea

    Get this error Message:

    The external task (Execute testfile.ksh) failed because of the following exception: cannot run program "/ opt/local/software/edq/config/commandarea/testfile.ksh": error = 2. No such file or directory

    Thanks in advance!

    BG

    Dear Richard, thank you for your prompt response.

    # / bin/bash helped and I also have to export the ORACLE_HOME in the script, somehow the $ORACLE_HOME is not recognized by the external task.

    Example of Script working:

    #! / bin/bash

    export ORACLE_HOME=/ora02/oracle/product/11.2.0.4/client

    $ORACLE_HOME/bin/sqlplus - s edq_test/edqtest@edqdev<>

    WHENEVER SQLERROR EXIT SQL. SQLCODE

    EXECUTE SP_TRUNCATE_TABLE ('ABC_SCHEMA', 'ABC_TABLE');

    COMMIT;

    QUIT SMOKING;

    EXPRESSIONS OF FOLKLORE

    output

    Thanks for your help!

    BG

  • problem with pl/sql in shell

    Hi, I am looking to spend the dbms_output to shell variable and display it. Everything works fine if I run the pl/sql block in Sqlplus, but some errors occurs when it is run from a shell script.


    1. If I'm running Sqlplus pl/sql block, everything works fine. It returns the correct value.

    Set serveroutput on;
    declare
    MSG NUMBER: = 0;
    cursor asm_c is
    Select total_mb, free_mb from v$ asm_diskgroup;

    Start
    for asm_r in asm_c
    loop
    If asm_r.free_mb/asm_r.total_mb < 0.2 then
    MSG: = 1;
    "exit";
    end if;
    end loop;
    DBMS_OUTPUT. Put_line (MSG);

    end;
    /

    2 but if I run the same pl/sql block inside the shell script I errors
    #! / bin/sh

    a ='sqlplus-s system/***@SPBUFOR < < ENDOFSQL

    Set serveroutput on
    Set feedback off

    declare
    MSG NUMBER: = 0;
    cursor asm_c is
    Select total_mb, free_mb from v$ asm_diskgroup;

    Start
    for asm_r in asm_c
    loop
    If asm_r.free_mb/asm_r.total_mb < 0.2 then
    MSG: = 1;
    "exit";
    end if;
    end loop;
    DBMS_OUTPUT. Put_line (MSG);

    end;
    /

    ENDOFSQL'


    ECHO $a;

    [./diskgroup_mon.sh* $ *[Oracle@dbsp0002 scripts: 0]
    Select total_mb, free_mb v; diskgroup_mon.sh ERROR in line 4: ORA-06550: line 4, column 33: PL/SQL: ORA-00942: table or view does not ORA-06550: line 4, column 3: PL/SQL: SQL statement ignored ORA-06550: line 9, column 10: PLS 00364: 'ASM_R' use the loop index variable is invalid ORA-06550: line 9, column 7: PL/SQL: statement ignored

    Could you help me?

    Try with;

    Select total_mb, free_mb v\\\$ asm_diskgroup;

    Not sure, just an idea of the link below:
    http://www.DBA-Oracle.com/t_shell_script_check_alert_log.htm
    where the gift is showing the code in action.

    Concerning
    Girish Sharma

  • PowerShell to execute the shell script in Linux guest

    Is there a way of powershell to access a Linux VM in a domain environment and then run a Linux shell script to a guest Linux OS - for example to set the network settings of the virtual machine?

    Thank you!

    You can use the Invoke-VMScript cmdlet. It allows you to run a script bash inside the Linux guests supported.

    There is also the Set-VMGuestNetworkInterface cmdlet to configure NETWORK card. It is based in fact on the same technique as the Invoke-VMScript cmdlet, but PowerCLI Dev team provided the bash script to you.

    ____________

    Blog: LucD notes

    Twitter: lucd22

  • Database remote stop using shell script

    Hi all

    I need to close a remote database through shell script. I won't know SYS password and so cannot connect directly.
    I need to SSH to the remote database will define ORACLE_SID and then stop the database.

    Note Please I want to achieve this without calling any other SQL or shell script I have ssh.

    Pointers or help is much appreciated.

    Kind regards
    Nagendra Chillale

    Hi Nagendra,

    following works for me...

    SSH otherhost ".» \$home/.bash_profile
    export ORACLE_SID = MYSID
    echo \"shutdown abort\ | sqlplus------' / as sysdba\.
    "

    SSH otherhost ".» \$home/.bash_profile
    export ORACLE_SID = MYSID
    sqlplus------' / as sysdba\.<>
    startup
    EXPRESSIONS OF FOLKLORE
    "

    HTH Mathias

    Published by: mzarick on August 13, 2009 11:27

  • Unable to see the serveroutput sql shell script

    Hello experts,

    I have a shell script that I use to call a pl/sql procedure.
    This proc write dbms_output.
    I would like the dbms_output in a capture file when calling sqlplus to my shell script.


    Here is the code:
    ===============================
    ECHO '.
    sqlplus apps / $APPS_PWD < < ENDOFSQL
    Set serveroutput ON
    Set feedback off
    set verify off
    set linesize 250
    set pagesize 250
    Start
    jdr_utils.listcustomizations('$I');
    end;
    /
    output
    ENDOFSQL
    "> > new.log"
    ===============================


    What I get in the "new.log" is given below:
    ===============================
    sqlplus apps/prj08app < < ENDOFSQL
    Set serveroutput ON
    Set feedback off
    set verify off
    set linesize 250
    set pagesize 250
    Start
    jdr_utils.listcustomizations('/Oracle/Apps/IRC/candidateSelfService/WebUI/VisVacDispPG');
    end;
    /
    output
    ===============================
    ENDOFSQL


    I want to get is the given procedure dbms_output.
    Please suggest.

    Thank you
    Vinod

    Shell?

    Your call to sqlplus is between double quotes. (In ksh, at least) who gets taken literally (after substitution of the variables). To run the chain and echo its output use a backtick (') instead of a double quotation mark ("")

    Published by: Brian Bontrager Sep 29, 2011 15:51

Maybe you are looking for

  • Close and reduce the buttons at the top right

    In the version 33.02 Close and Minimize buttons in the upper right platform with holding the mouse pointer over a link or off please fix this bug several times

  • Satellite A200 PSAEOE does not start after upgrading memory

    Hi, I am first time here. I bought a Toshiba A200 PSAE0E-03J02JDR with 2 GB of RAM. I bought a pair of ram Corsair (2 * 2 GB VS2GSDS667D2). The computer does not start after that I installed the memory. I have intel 945 chipset, which is capable of 4

  • Error hard drive 39 please help

    My DVD dive does not except in Device Manager and has a yellow question mark on it. It has the following message: Windows cannot start this hardware device because its information of configuration (in the registry) is incomplete or damaged. (Code 19)

  • Where is "create a system image" in Windows 8?

    where is "create a system image" in windows 8? Original title: copy of the Image system Windows 8

  • Very slow performance on iMac, please help

    I installed VMware Fusion on my iMac and my normal iMac works perfectly. However, the VMware runs MUCH MORE slow. Here are the specs on my computer:2.7 GHz i58 GB 1600 Mhz DDR3I thought it might be a ram problem, even if on the side of the virtual ma