日期:2014-05-16  浏览次数:20694 次

Oracle在Linux下面的自启动和自关闭脚本
##以下部分为自动启动ORACLE
echo "begin to start oracle"
export ORACLE_HOME=/home/oracle/OraHome/9.2.0
export ORACLE_SID=orcl
su - oracle -c "$ORACLE_HOME/bin/lsnrctl start"
cat <<EOF|su - oracle -c "$ORACLE_HOME/bin/sqlplus /nolog"
conn / as sysdba
startup
exit
EOF


##以下部分为自动停止
echo "begin to start oracle"
export ORACLE_HOME=/home/oracle/OraHome/9.2.0
export ORACLE_SID=orcl
su - oracle -c "$ORACLE_HOME/bin/lsnrctl start"
cat <<EOF|su - oracle -c "$ORACLE_HOME/bin/sqlplus /nolog"
conn / as sysdba
shutdown immediate
exit
EOF