Login to Oracle as sysdba in one command

Contributor Icon Contributed by jshcenck Date Icon November 13, 2003  
Tag Icon Tagged: Oracle

Log into the database via sqlplus with sysdba priv’s with a single command. This can be setup with an alias, if you’d like


1. Log into the server as the oracle user end ensure you have the effective group of the appropriate DBA group. typical unix installations have the OS user as ‘oracle’ and the dba group as ‘dba’ (not to be confused with the ‘oinstall’ group).

2. Check your account with the unix ‘id’ command. Make sure your environment variables are set to the appropriate database
$ id
uid=510(oracle) gid=500(dba)
$ env | grep ORA
ORACLE_SID=TESTDB
ORACLE_HOME=/opt/app/oracle/product/9.2.0

3. connect to the database
$ sqlplus “/ as sysdba”
SQL>

4. that’s it! be *very* careful!

you might want to make sure you are really in the instance you expect

SQL> select name from v$database;

Previous recipe | Next recipe |
 
  • nkmkelvin
    It is amzing.. very very useful for DBA in writing script

    thanks
  • Joseph Pascual
    how can I add the environment variable to my computer please show me..
  • qmchenry
    The methods to add environment variables depend on the operating system and shell you are using. If you are running a UNIX-ish operating system, you can view your current shell with the following command:

    echo $SHELL


    If you are using the Bourne shell (sh), refer to this recipe.

    If you are using the Korn or Bourne-again shells (ksh, bash) or several others, use this recipe.

    If you are using another shell or operating system, tell us which one and we'll get the specific instructions for you.
  • alex
    on 10g you can log in with:

    sqlplus / as sysdba
  • Eziafa
    I just started using oracle in Nigeria and we are not yet connected to the world grid. I do not know if I will make it here or go abroad to study it.
  • deepkitt18
    my scott/tiger is not working...how can i login in oracle 8i?
blog comments powered by Disqus