How to run shell script? - Page 2
DBAsupport.com Forums - Powered by vBulletin
Page 2 of 2 FirstFirst 12
Results 11 to 12 of 12

Thread: How to run shell script?

  1. #11
    Join Date
    Oct 2000
    Location
    Saskatoon, SK, Canada
    Posts
    3,925
    Here is a sample script for your test to undestand things

    ********************************
    #!/bin/sh

    user=${1}
    pass=${2}
    sid=${3}

    $ORACLE_HOME/bin/sqlplus $user/$pass@$sid << EOF
    select sysdate from dual;
    EOF

    exit
    ***********************************


    Copy it into a file, example test.sh and change permissions of test.sh

    chmod 755 test.sh

    execute it as

    ./test.sh scott tiger SID_name_here



    According to your code, it should look as follows

    #!/bin/sh

    user =${1}
    pass =${2}
    sid =${3}


    ${ORACLE_HOME}/bin/sqlplus ${user}@${sid}/${pass} << __eof__
    set head off;
    commit;
    set serveroutput on;
    select to_char(sysdate,'DD-MON-YY HH:MI:SS') from dual;
    __eof__


    exit <--- if you want to exit after the execution of this script.

    Good luck,
    Sam
    Thanx
    Sam



    Life is a journey, not a destination!


  2. #12
    Join Date
    Jan 2001
    Posts
    642

    Thumbs up

    Finally It worked.

    Thank you for your patience, in guiding me.

    Thanks again
    Badrinath

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width