# Source function library.
. /etc/rc.d/init.d/functions# pull in sysconfig settings
if [ -f /etc/sysconfig/oracle ]; then
. /etc/sysconfig/oracle
else
ORA_OWNER="oracle"
START_ORACLE="yes"
START_LISTENER="yes"
START_AGENT="no"
START_ORA_APACHE="no"
START_CMANAGER="no"
fi
test $START_ORACLE = "yes" || exit 0
RETVAL=0
setORAkern() {
# Do these here instead of /etc/sysctl.conf since they are Oracle
# specific, and we don't want to muck unless we are in fact going
# to start Oracle
echo -n $"Tuning kernel parameters for Oracle: "
# Set shared memory parameters
echo ${SHMMAX:-2147483648} > /proc/sys/kernel/shmmax
echo ${SHMMNI:-4096} > /proc/sys/kernel/shmmni
# Set the semaphore parameters:
# see Oracle release notes for Linux for how to set these values
# SEMMSL, SEMMNS, SEMOPM, SEMMNI
echo ${SEMMSL:-250} ${SEMMNS:-32000} ${SEMOPM:-100} ${SEMMNI:-128} > /proc/sys/kernel/sem
echo_success
echo
}
# get and check environment (e.g. ORACLE_HOME)
test -f /etc/profile.d/oracle.sh && . /etc/profile.d/oracle.sh
if [ -z "$ORACLE_HOME" -o ! -d $ORACLE_HOME -o -z "$ORACLE_SID" ]; then
echo "Cannot find ORACLE_HOME directory, or ORACLE_SID not set."
echo -n "Environment settings are wrong? Check /etc/profile.d/oracle.sh"
failure $"Checking Oracle environment"
exit 1
fi
start() {
# the database will not start if no entries in /etc/oratab are "Y"
grep -s -q ":Y" /etc/oratab >&/dev/null || {
echo -n "No entries in /etc/oratab are Y"
failure $"Checking /etc/oratab"
exit 1
}
if [ ! -f $ORACLE_HOME/bin/dbstart -o -z "$ORA_OWNER" ]; then
echo "No such file: \$ORACLE_HOME/bin/dbstart"
echo -n "Oracle could not be found (ORACLE_HOME wrong?)"
failure $"Checking for $ORACLE_HOME/bin/dbstart"
exit 1
fi
setORAkern
echo -n $"Starting Oracle: "
daemon --user $ORA_OWNER $ORACLE_HOME/bin/dbstart
RET1=$?
if [ "${START_LISTENER:-no}" = "yes" ] && [ -x $ORACLE_HOME/bin/lsnrctl ]; then
daemon --user $ORA_OWNER $ORACLE_HOME/bin/lsnrctl start
RET2=$?
fi
if [ "${START_AGENT:-no}" = "yes" ] && [ -x $ORACLE_HOME/bin/agentctl ]; then
daemon --user $ORA_OWNER $ORACLE_HOME/bin/agentctl start
RET3=$?
fi
if [ "${START_ORA_APACHE:-no}" = "yes" ] && [ -x $ORACLE_HOME/Apache/Apache/bin/apachectl ]; then
# Note: This is because JServ thinks it needs X to resize and do other image file manipulation
# Crazy, I know. - Dax
test -z "$DISPLAY" && export DISPLAY=":42000.0"
daemon --user $ORA_OWNER $ORACLE_HOME/Apache/Apache/bin/apachectl start
RET4=$?
fi
if [ "${START_CMANAGER:-no}" = "yes" ] && [ -x $ORACLE_HOME/bin/cmctl ]; then
daemon --user $ORA_OWNER $ORACLE_HOME/bin/cmctl start
RET5=$?
fi
if [ $RET1 -eq 0 ] && [ ${RET2:-0} -eq 0 ] && [ ${RET3:-0} -eq 0 ] && [ ${RET4:-0} -eq 0 ] && [ ${RET5:-0} -eq 0 ]; then
touch /var/lock/subsys/oracle
echo_success
echo
return 0
else
failure
echo
return 1
fi
# start iAS
# (to be done)
}
stop() {
echo -n "Stopping Oracle: "
# the database will not stop if no entries in /etc/oratab are "Y"
grep -s -q ":Y" /etc/oratab >&/dev/null || {
echo -n "No entries in /etc/oratab are Y"
failure $"Checking /etc/oratab"
exit 1
}
if [ ! -f $ORACLE_HOME/bin/dbshut -o -z "$ORA_OWNER" ]; then
echo "No such file: \$ORACLE_HOME/bin/dbstart"
echo -n "Oracle could not be found (ORACLE_HOME wrong?)"
failure $"Checking for $ORACLE_HOME/bin/dbshut"
exit 1
fi
if [ "${START_CMANAGER:-no}" = "yes" ] && [ -x $ORACLE_HOME/bin/cmctl ]; then
su - $ORA_OWNER -c "$ORACLE_HOME/bin/cmctl stop" > /dev/null 2>&1
RET5=$?
fi
if [ "${START_ORA_APACHE:-no}" = "yes" ] && [ -x $ORACLE_HOME/Apache/Apache/bin/apachectl ]; then
# Note: This is because JServ thinks it needs X to resize and do other image file manipulation
# Crazy, I know. Needed for stopping too??? - Dax
test -z "$DISPLAY" && export DISPLAY=":42000.0"
su - $ORA_OWNER -c "$ORACLE_HOME/Apache/Apache/bin/apachectl stop" > /dev/null 2>&1
RET4=$?
fi
if [ "${START_AGENT:-no}" = "yes" ] && [ -x $ORACLE_HOME/bin/agentctl ]; then
su - $ORA_OWNER -c "$ORACLE_HOME/bin/agentctl stop" > /dev/null 2>&1
RET3=$?
fi
if [ "${START_LISTENER:-no}" = "yes" ] && [ -x $ORACLE_HOME/bin/lsnrctl ]; then
su - $ORA_OWNER -c "$ORACLE_HOME/bin/lsnrctl stop" > /dev/null 2>&1
RET2=$?
fi
su - $ORA_OWNER -c "$ORACLE_HOME/bin/dbshut" > /dev/null 2>&1
RET1=$?
if [ $RET1 -eq 0 ] && [ ${RET2:-0} -eq 0 ] && [ ${RET3:-0} -eq 0 ] && [ ${RET4:-0} -eq 0 ] && [ ${RET5:-0} -eq 0 ]; then
rm -f /var/lock/subsys/oracle
success
echo
return 0
else
failure
echo
return 1
fi
# stop iAS
# (to be done)
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
tunekernel)
setORAkern
;;
condrestart)
[ -f /var/lock/subsys/oracle ] && restart || :
;;
*)
echo "Usage: $0 {start|stop|restart|tunekernel|condrestart}"
exit 1
esac
exit $?
Вот еще perl'ом конекчусь с удаленного хоста:
failed: ORA-12541: TNS:no listener (DBD ERROR: OCIServerAttach)
Локально: sqlplus userneme/password - соединяется нормально...
Удаленно и локально sqlplus username/password@11.11.11.11 - ORA-12541: TNS:нет прослушивателя