Shell Script to startup a database
DBAsupport.com Forums - Powered by vBulletin
Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: Shell Script to startup a database

  1. #1
    Join Date
    Aug 2001
    Posts
    30

    Shell Script to startup a database

    Hi ,
    I am new to Linux Platform and I am looking for a .sh script to startup a database and start the lsnrctl.

    Something like this

    su - oracle
    oracle>svrmgrl
    connect internal
    startup
    exit (exit from svrmgrl)
    root>lsnrctl start

    Thanx
    Kulkarni
    Sitaram KUlkarni

  2. #2
    Join Date
    Nov 2000
    Location
    Pittsburgh, PA
    Posts
    4,027
    If you look at the before you install manual for Linux there should be a section on getting databases to automatically startup. There should be a file in $ORACLE_HOME/bin called dbstart. It will look at the /var/optt/oracle/oratab file and determine which databases need to be started based on the third field.

    sidname:/usr/oracle/9.2.0.2:Y

    Then there is a diectory in /etc, I don't remember which one off hand but you basically create a symbolic link there. It is all spelled out in the manual which you should read before installing Oracle on a new platform anyway in case there is something that you should know or change.

  3. #3
    Join Date
    Jan 2002
    Location
    Up s**t creek
    Posts
    1,525
    Not used Linux but I will assume you have the same scripts as those on Solaris, if so you can use the $ORACLE_HOME/bin/dbstart and $ORACLE_HOME/bin/dbstop scripts to start and stop all the instances on the host.

    Regards
    Jim
    Oracle Certified Professional
    "Build your reputation by helping other people build theirs."

    "Sarcasm may be the lowest form of wit but its still funny"

    Click HERE to vist my website!

  4. #4
    Join Date
    Aug 2001
    Posts
    30
    hi thanx for the response I dont need auto start of the Database .. I want to manually start the database.

    I want to use these commands

    su - oracle
    oracle>svrmgrl
    connect internal
    startup
    exit (exit from svrmgrl)
    root>lsnrctl start

    but when I execute the script its stopping at
    SVRMGR>

    Can u tell me how to writethe .sh script?

    Thanx
    Sitaram KUlkarni

  5. #5
    Join Date
    Jan 2002
    Location
    Up s**t creek
    Posts
    1,525
    You'll need something similar to the following:

    Code:
    svrmgrl EOF
    connect internal
    startup
    EOF
    
    lsnrctl start
    BTW there are 2 less-than symbols before the first EOF (post displays incorrectly if I add them here)

    HTH
    Last edited by jovery; 04-11-2003 at 10:20 AM.
    Jim
    Oracle Certified Professional
    "Build your reputation by helping other people build theirs."

    "Sarcasm may be the lowest form of wit but its still funny"

    Click HERE to vist my website!

  6. #6
    Join Date
    Nov 2002
    Location
    New Delhi, INDIA
    Posts
    1,796
    for 9i you can use something like the following in your startup.sh script
    Code:
    sqlplus -s /NOLOG << ! >/dev/null
    spool start.log
    connect sys as sysdba
    ^M
    startup
    spool off
    exit
    !
    Last edited by adewri; 04-11-2003 at 10:44 AM.
    Amar
    "There is a difference between knowing the path and walking the path."

    Amar's Blog  Get Firefox!

  7. #7
    Join Date
    Aug 2001
    Posts
    30
    Hi jovery,
    Thanx for that .. i am able to use the script when i paste the same on the terminal window .. but when i save it as a shell script and execute it, its getting stopped after logging in as oracle.
    and once i exit from the oracle user.. remaining commands are being executed.


    su - oracle
    svrmgrl << EOF
    connect internal
    startup
    EOF
    lsnrctl start
    exit
    exit
    Sitaram KUlkarni

  8. #8
    Join Date
    Sep 2002
    Location
    England
    Posts
    7,333
    It's probaby waiting for a password, which user are you su'ing from?

  9. #9
    Join Date
    Aug 2001
    Posts
    30
    Hi ,
    I am su'ing from the root ..so it shudnt ask for the password.. when i am just pasting this script on the terminal it works..

    Thanx
    Sitaram KUlkarni

  10. #10
    Join Date
    Nov 2002
    Location
    Geneva Switzerland
    Posts
    3,142
    Is it waiting for a return? Amar's script has a ^M explicitly in it.
    "The power of instruction is seldom of much efficacy except in those happy dispositions where it is almost superfluous" - Gibbon, quoted by R.P.Feynman

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