How To Access Oracle from CS machines

  1. What is an Oracle account?

    Oracle is a relational database. Your account will allow you to connect to the database. Once connected you can create objects, insert records, and query the database.

    This account is separate from your Windows or Unix account. You will need a login/password combination specific to this database. If you are taking a class or have been told you have an Oracle account you will retrieve your login and password at the my.cs.purdue.edu site, in the "Local Accounts" section.

    After you have logged onto an CS host (Solaris, Mac, and Linux), the program that will connect you to an Oracle server is sqlplus. The name of the Oracle server is csora (this is not related to a computer name).

  2. How to connect to csora from CS Unix systems using csh/tcsh

    The following instructions are for csh and tcsh
    (The instructions for sh/ksh/bash are in the next section).

    • You need to set several environment variables in your shell configuration files to allow easy access to Oracle each time you login. To do so, add the following lines at the end of your .login file as they appear here.

      set path = (/p/oracle12c $path)
      setenv ORACLE_HOME /p/oracle12c

      if ( ${?LD_LIBRARY_PATH} ) then

      setenv LD_LIBRARY_PATH /p/oracle12c:${LD_LIBRARY_PATH}
      else
      setenv LD_LIBRARY_PATH /p/oracle12c
      endif
    • Once you have done this, save and close your .login file and run the command (You will only need to do this this time, in the future it will happen automatically when you login)

      source ~/.login

      Once you have done this you check to make sure the variables are set correctly with the command

      env | egrep '^(ORACLE_HOME|LD_LIBRARY_PATH|PATH)'

      The results from this command should produce values consistent with the values listed above
    • You may now connect to the database with the Oracle client

      sqlplus

    • Provide your login and password that you acquired from the  my.cs.purdue.edu site

      Enter user-name: your_oracle_id@csora
      Enter password: your_oracle_password

    • When you have successfully connected to the Oracle server, you will see the following sqlplus prompt:

      SQL>

      You can now start typing in sqlplus commands or SQL statements.

  3. How to connect to csora from CS Unix using sh/ksh/bash

    The following instructions are for sh, ksh and bash
    (The instructions for csh/tcsh are in the previous section).

    • You need to set several environment variables in your shell configuration files to allow easy access to Oracle each time you login. To do so, add the following lines to your .profile file.

      PATH=/p/oracle12c:${PATH}
      ORACLE_HOME=/p/oracle12c
      LD_LIBRARY_PATH=/p/oracle12c:${LD_LIBRARY_PATH}
      export PATH ORACLE_HOME LD_LIBRARY_PATH

    • Once you have done this, save and close your .profile file and run the command (You will only need to do this this time, in the future it will happen automatically when you login)

      . ~/.profile

      Once you have done this you check to make sure the variables are set correctly with the command

      env | egrep '^(ORACLE_HOME|LD_LIBRARY_PATH|PATH)'

      The results from this command should produce values consistent with the values listed above
    • You may now connect to the database with the Oracle client

      sqlplus

    • Provide your login and password that you acquired from the my.cs.purdue.edu site

      Enter user-name: your_oracle_id@csora
      Enter password: your_oracle_password

    • When you have successfully connected to the Oracle server, you will see the following sqlplus prompt:

      SQL>

      You can now start typing in sqlplus commands or SQL statements.