connecting as sysdba directly from shell file
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 10 of 10

Thread: connecting as sysdba directly from shell file

  1. #1
    Join Date
    Dec 2000
    Posts
    255
    Hi All

    I am writing a shell script to connect directly to sys user as a dba. However I cannot write something 'sqlplus sys as sysdba' as it gives me the error (I am on 9i with RH 7.2) it says the syntax is not correct. I tried even sqlplus / nolog but it also gives error for that. What can I do as I want to connect as sysdba even when database is down using shell script.

    Amol

  2. #2
    Join Date
    Feb 2000
    Location
    Singapore
    Posts
    1,758
    Hi Amol,
    I tried this code and it works.

    sqlplus -s '<'<'EOF'
    sys/password as sysdba
    spool sss.txt;
    select sysdate from dual;
    spool off;
    exit
    EOF


    cat sss.txt

    SYSDATE
    ---------
    12-JUL-02


    PS: Don't put any quotes in the first line. I put it because the due to vbcode some characters were not displaying in the message.

    Sanjay

    [Edited by SANJAY_G on 07-12-2002 at 05:09 AM]

  3. #3
    Join Date
    Apr 2001
    Location
    Czechia
    Posts
    712
    Hi!

    sqlplus "/ as sysdba"
    Ales
    The whole difference between a little boy and an adult man is the price of toys

  4. #4
    Join Date
    Dec 2000
    Posts
    255
    Thanks a lot Sanjay and Ales,

    Your tips not only helped me in this prblems but also helped to explore and try out new things. Thank you very much....

    Amol

  5. #5
    Join Date
    May 2002
    Posts
    2,645
    You can also start with sqlplus /nolog and then do a conn / as sysdba - which is what you need to do when creating a database in 9i.

  6. #6
    Join Date
    Dec 2000
    Posts
    255
    I wrote a the following script which works with problems
    --------------------------------------------------------------------------------------
    sqlplus -s < sqlplus /nolog
    conn /as sysdba
    startup
    exit
    EOF
    --------------------------------------------------------------------------------------

    It gives the following problem

    ERROR:
    ORA-01034: ORACLE not available
    ORA-27101: shared memory realm does not exist
    Linux Error: 2: No such file or directory

    ORACLE instance started.

    Total System Global Area 336356520 bytes
    Fixed Size 279720 bytes
    Variable Size 268435456 bytes
    Database Buffers 67108864 bytes
    Redo Buffers 532480 bytes
    Database mounted.
    Database opened.


    Now what can be the problem as I am not machine with 512 m RAM. I searched on error code but there is no good answer about startups.. Why is it creating problems.

    Amol

  7. #7
    Hi,

    Can you check you oracle executable file permission. It should set to setuid and setgid.

    chmod u,g+s filename should do the trick.

    regards,
    feroz

  8. #8
    Hi,

    This site might help you:

    http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x50ba854994d9d4118fef0090279cd0f9,00.html

    regards,
    feroz

  9. #9
    Join Date
    Dec 2000
    Posts
    255
    HI

    Do I need to modify privs of file 'oracle' in $ORACLE_HOME/bin
    currently they are as follows :

    -rwsr-s--x 1 oracle dba 37551088 Jul 1 05:10 oracle

    Amol

  10. #10
    Hi,

    No. it looks fine.

    regards,
    feroz

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