现在的位置: 首页 > 综合 > 正文

Linux下自动启动和关闭Oracle数据库

2014年04月13日 ⁄ 综合 ⁄ 共 640字 ⁄ 字号 评论关闭
自动启动oracle9i
在/home/oracle下建立文件StartOra.sh:
vi StartOra.sh
--------------------------------
echo "Begin to start the oracle!"
lsnrctl start
sqlplus /nolog <<EOF
connect /as sysdba
startup
exit
EOF
echo "Oracle just have been started!"
exit
--------------------------------
给StartOra.sh执行权限
chmod a+x StartOra.sh
自动关闭oracle9i
在/oracle下建立文件StopOra.sh:
vi StopOra.sh
--------------------------------
echo "Begin to stop the oracle!"
sqlplus /nolog <<EOF
connect /as sysdba
shutdown immediate
exit
EOF
lsnrctl stop
echo "Oracle just have been stopped!"
exit
--------------------------------
给StopOra.sh执行权限
chmod a+x StopOra.sh
将启动和关闭oracle脚本加到系统的开机自启动
vi /etc/rc.local
su - oracle -c "/home/oracle/StartOra.sh" #启动oracle

抱歉!评论已关闭.