Linux.com

bdby

bdby

  • Linux.com Member
  • Posts: 2
  • Member Since: 21 Jun 13
  • Last Logged In: 04 Jun

Latest Posts

Posted by
Topic
Post Preview
Posted
  • bdby
    oratab file
    Hi, I could use some assistance. I am new at this and have been requested to find out the last time someone accessed the oracle database from the SYS.AUD$ table. I have 5 servers with each oratab listing hundreds of databases. There in lies my problem. To go through each one manually would take weeks. What I am trying to do is run a script that will read the oratab file and isolate the name of the oracle_sid which I have accomplished. Some of those sids are obsolete so I need to account for that. Right now I am just trying to capture the ORA-01078 error and if I do to continue looping to the next ora_sid Here is my work: partial list: snslcsunu03{oranet}-bash> cat /var/opt/oracle/oratab | cut -d':' -f1,3 | sed s/#//g | grep : | cut -d':' -f1 lsnr <<<=== bad name for a sid but it is a real one. ora10205 ora10205b ora11203 musidt musiot cli112_64 cli112_32 dev101 ============================== script #!/usr/bin/bash ## PLEASE NOTE THE LOOPING ON THIS WORKS PROPERLY. exec 1> /home/oracle/bash/outfile #records output to file. Later to be searched. cat /var/opt/oracle/oratab | cut -d':' -f1,3 | sed s/#//g | grep : | cut -d':' f1>list #this strips the sid from the oratab LIMIT=5 #this counter limits the number of interations through the list. It will be removed later. a=0 for i in `cat list`; do a=$(($a+1)) if [[ "$a" -eq 5 ]]; then break fi ORACLE_SID="$i" if [ "$?" -eq 0 ] ; then #if a sid is returned zero means success and to continue processing. export ORACLE_SID sqlplus / as sysdba @startup.sql >outfile #grep the outfile for the ora error below. fi if [ -e `grep "ORA-01078" outfile` ] #if this is found in the list there is no spfile available then "exit" #<<<==== IT SEEMS TO HANG HERE. I NEED TO CONTINUE LOOPING / continue #loop to the next oratab fi done ========== output ORA-01078 failure in processing system parametersThanks for your help in advance. Any suggestions or help would be appreciated. thanks, bdby
    Link to this post 22 May

    Hi,

    I could use some assistance. I am new at this and have been requested to find out
    the last time someone accessed the oracle database from the SYS.AUD$ table.
    I have 5 servers with each oratab listing hundreds of databases. There in lies
    my problem. To go through each one manually would take weeks.

    What I am trying to do is run a script that will read the oratab file and isolate the name of the oracle_sid which I have accomplished. Some of those sids are obsolete so I need to account for that. Right now I am just trying to capture the ORA-01078 error and if I do to continue looping to the next ora_sid

    Here is my work:

    partial list:

    snslcsunu03{oranet}-bash> cat /var/opt/oracle/oratab | cut -d':' -f1,3 | sed s/#//g | grep : | cut -d':' -f1
    lsnr <<<=== bad name for a sid but it is a real one.
    ora10205
    ora10205b
    ora11203
    musidt
    musiot
    cli112_64
    cli112_32
    dev101

    ============================== script
    #!/usr/bin/bash
    ## PLEASE NOTE THE LOOPING ON THIS WORKS PROPERLY.

    exec 1> /home/oracle/bash/outfile #records output to file. Later to be searched.

    cat /var/opt/oracle/oratab | cut -d':' -f1,3 | sed s/#//g | grep : | cut -d':' f1>list #this strips the sid from the oratab

    LIMIT=5 #this counter limits the number of interations through the list. It will be removed later.
    a=0

    for i in `cat list`; do

    a=$(($a+1))

    if [[ "$a" -eq 5 ]]; then
    break
    fi

    ORACLE_SID="$i"

    if [ "$?" -eq 0 ] ; then #if a sid is returned zero means success and to continue processing.
    export ORACLE_SID
    sqlplus / as sysdba @startup.sql >outfile #grep the outfile for the ora error below.

    fi

    if [ -e `grep "ORA-01078" outfile` ] #if this is found in the list there is no spfile available
    then
    "exit" #<<<==== IT SEEMS TO HANG HERE. I NEED TO CONTINUE LOOPING
    /
    continue #loop to the next oratab
    fi

    done


    ==========
    output


    ORA-01078 failure in processing system parametersThanks for your help in advance.

    Any suggestions or help would be appreciated.

    thanks,

    bdby

  • bdby
    RE: Need help with this shell script
    Hi Everyone, I am currently studying for the linux exam. One of the questions is a bit vague. I would like someone to please explain why the answer is as such. It would be much appreciated. I am having a hard time triing to read the statement. Can someone please explain it too me? I don't see where this "Hello" comes from either. What is the output when the following shell script executes? cat<<foobar Hello foobar Foobar A. The contents of the file foobar. B. Hello C. No output but a file named foobar is created. D. Hello foobar E. Hello foobar foobar Answer: D Thanks in advance. bdby
    Link to this post 21 Jun 13

    Hi Everyone,

    I am currently studying for the linux exam. One of the questions is a bit vague. I would like someone to please explain why the answer is as such. It would be much appreciated.

    I am having a hard time triing to read the statement. Can someone please explain it too me? I don't see where this "Hello" comes from either.

    What is the output when the following shell script executes?

    cat&lt;&lt;foobar
    Hello foobar
    Foobar


    A. The contents of the file foobar.
    B. Hello
    C. No output but a file named foobar is created.
    D. Hello foobar
    E. Hello foobar foobar
    Answer: D

    Thanks in advance.

    bdby

Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board