Tuesday, December 14, 2010

Oracle 11gR2 RAC - howto fix the "ORACLE_BASE not set in environment" error.

One of our Oracle 11gR2 RAC instances running version was reporting the following error in it's alert log:

« ORACLE_BASE not set in environment. It is recommended that ORACLE_BASE be set in the environment »

To fix the problem, one simply has to issue a simple command.

Note that this database's unique name is ntsdev.

srvctl setenv database -d ntsdev -t "ORACLE_BASE=/u01/app/oracle"

Once that was executed, I bounced this particular instance using:

srvctl stop instance -d ntsdev -i ntsdev2
srvctl start instance -d ntsdev -i ntsdev2

While restarting the instance, I kept an eye on the alert log using another shell:

rlwrap adrci
adrci> set home diag/rdbms/ntsdev/ntsdev2
adrci> show alert -tail -f

Or if you're not into the new ADR thing, then just use the good old tail command.

tail -F $ORACLE_BASE/diag/rdbms/ntsdev/ntsdev2/trace/alert_ntsdev2.log

Sure enough, once this instance restarted, it told me that the ORACLE_BASE variable was found in the environment:

ORACLE_BASE from environment = /u01/app/oracle

Note that the following is deprecated and is therfore ignored. Oracle is nice enough to tell it to you.

srvctl setenv instance -d ntsdev -i ntsdev2 -t "ORACLE_BASE=/u01/app/oracle"
srvctl setenv instance command has been deprecated and will be ignored.

Should you want to read more about srvctl, then open the « Oracle Real Application Clusters Administration and Deployment Guide 11g Release 2 (11.2) » at Chapter A « Server Control Utility Reference » [1] and the description of the setenv subcommand in Chapter 3 « Administering Database Instances and Cluster Databases » [2].



[1] http://download.oracle.com/docs/cd/E11882_01/rac.112/e16795/srvctladmin.htm#i1010287
[2] http://download.oracle.com/docs/cd/E11882_01/rac.112/e16795/admin.htm#CBBFCBEF