数据库起停脚本
起:
#!/bin/sh
if [[ `ps -ef|grep oracle|grep tnslsnr|grep -v grep|awk '{print $2}'` -gt 1 ]];
then
echo "lsnrctl is running"
else
su - ora10g -c "lsnrctl start"
fi
# start database
echo "Start Oracle database instance"
su - ora10g -c "echo \"
conn / as sysdba
startup
exit \"|sqlplus /nolog"
停:
#!/bin/sh
# shutdown database
echo "Shutdown Oracle database instance"
su - ora10g -c "echo \"
conn / as sysdba
shutdown immediate
exit \"|sqlplus /nolog"
# stop tsnlisnter
echo "Stop tsnlisnter"
su - ora10g -c "lsnrctl stop"
阅读(759) | 评论(0) | 转发(0) |