[oracle@rac1 ~]$ cat login.sh #!/bin/sh export ORACLE_SID=$1 #if [[ $(ps -ef|grep smon|grep -v grep|grep ${ORACLE_SID}|wc -l) -gt "0" ]]; then if [[ $(ps -ef|grep smon|grep -v grep|grep ${ORACLE_SID}|wc -l) > "0" ]]; then #export ORACLE_HOME=`cat /etc/oratab|grep ${ORACLE_SID}|cut -d":" -f2` export ORACLE_HOME=/opt/oracle/product/11.1.0/db_1 sqlplus "/as sysdba" else echo "The db is down/Verify the db name" fi exit [oracle@rac1 ~]$ chmod 700 login.sh [oracle@rac1 ~]$ ./login.sh jiwa SQL*Plus: Release 11.1.0.6.0 - Production on Tue Mar 10 19:54:14 2009 Copyright (c) 1982, 2007, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> select name from v$database; NAME --------- JIWA SQL> select 'happy scripting' from dual; 'HAPPYSCRIPTING --------------- happy scripting