oraenv doesn't seem to work

Version: 11.2.0.3

Platform: Oracle Linux 6.3

oraenv doesn't seem to work as shown below. I did not ORACLE_SID in the .bash_profile as this server will have multiple DBs in the future. So, I need to use oraenv script to set the variables to approx.

Trying to source oraenv file.

$ . oraenv

ORACLE_SID = [oracle]?

Ideally, it should encourage the SID listed in/etc/oratab file. So, in this case it should be something like

$ . oraenv

ORACLE_SID = [oracle]? GRCFMS

Here is my/etc/oratab file content and the .bash_profile

#

#

# su - oracle

$

$

$

$

$

$

whoami $

Oracle

$ pwd

/ home/oracle

$ cat .bash_profile

# .bash_profile

# Get the aliases and functions

If [~/.bashrc - f]; then

. ~/.bashrc

FI

# Specific programs startup and user environment

#PATH = $PATH: $HOME/bin

#export PATH

export ORACLE_BASE = / u01/app/oracle

export ORACLE_HOME=/u01/app/oracle/product/11.2.0.3/dbhome_1

#export LD_LIBRARY_PATH = $ORACLE_HOME/lib

export PATH = $PATH: $ORACLE_HOME/bin: / usr/bin: / bin

$


My oratab file

-----------------


$ cat/etc/oratab

#

# This file is used by ORACLE utilities.  It is created by root.sh

# update the Configuration Wizard or the other database when creating

# a database or ASM Configuration Wizard while creating the ASM instance.

# A colon, ':', is used as the field terminator.  A new line ends

# entry.  Lines starting with a pound sign, "#", are comments.

#

# Entries are of the form:

# $ORACLE_SID: $ORACLE_HOME: N | Y >:

#

# Fields in the first and the second are the identifier system and home

Directory of # database respectively.  The third filed indicates

# for the utility dbstart the database must, 'Y', or not,

# ', Being high at system boot time.

#

# Multiple entries with the same $ORACLE_SID are not allowed.

#

#

GRCFMS:/U01/app/Oracle/product/11.2.0.3/dbhome_1:N

$

$

$

Quoting your post

Ideally, it should encourage the SID listed in/etc/oratab file.

Your understanding of the oraenv is incorrect. There is no that. Simply, he looks up to SID and affects ORACLE_BASE ORACLE_HOME and path.

If you set ORACLE_SID asked, with the user name by default. What you see here is the expected behavior.

In addition, if you do not ORAENV_ASK set to "N", you will be asked.

What I often do is the following

Export DEFSID = "GRCFMS".

Export ORAENV_ASK = "N" # or NOT, I do not remember

. oraenv

Export ORAENV_ASK =""

Works like a charm

In other scripts that I use

ORACLE_SID = ${1:-$DEFSID}

and call oraenv in the above fashion.

HTH

-------------

Sybrand Bakker

Senior Oracle DBA

Tags: Database

Similar Questions

Maybe you are looking for