Unable to connect to Oracle database on RHEL 4.2
I am trying to connect to the Oracle 10gr2 db instance from a script using the following cmd:-
/u01/app/oracle/oracle/product/10.2.0/db_1/bin/sqlplus sys/password AS SYSDBA<<EOF
!env | grep ORACLE
select 'RM_STATUS:' || status as a from v\$instance;
disconnect;
exit;
SQL*Plus: Release 10.2.0.1.0 - Production on Wed Mar 2 06:37:14 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SQL> ORACLE_SID=RMTEST
ORACLE_HOME=/u01/app/oracle/oracle/product/10.2.0/db_1
SQL> select 'RM_STATUS:' || status as a from v$instance
*
ERROR at line 1:
ORA-01034: ORACLE not available
SQL> Disconnected
The ORACLE_HOME and ORACLE_SID are set correctly. I always end up getting connected to an idle instance even when the database is up and running:-