开机自动启动oracle数据库
一、自动启动设置
1、创建启动脚本
dbstart.sh
#!/bin/sh
lsnrctl start
splplus /nolog << EOF
conn sys/admin@test as sysdba
startup
EOF
chmod +x dbstart
2、/etc/oratab
3、/etc/rc.local
二、启动脚本
#!/bin/bash
#
# name:/etc/rc.d/init.d/ora10
# description: start and shutdown oracle 10g database and listener
#
# oracle environment
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=/opt/oracle/product/10G
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/Apache/Apache/bin:$PATH
export ORACLE_OWNER=oracle
export ORACLE_SID=TEST
export ORACLE_TERM=vt100
export LD_ASSUME_KERNEL=2.4.1
export THREADS_FLAG=native
export LD_LIBRARY_PATH=/opt/oracle/product/10G/lib:$LD_LIBRARY_PATH
export PATH=/opt/oracle/product/10G/bin:$PATH
export DISPLAY=:0
oracle_user=oracle
case $1 in
start)
# start listener and database
su - "$oracle_user"<< EOO
lsnrctl start
sqlplus /nolog<connect / as sysdba
startup
EOS
EOO
;;
stop)
# stop listener and database
su - "$oracle_user"<lsnrctl stop
sqlplus /nolog<connect / as sysdba
shutdown immediate
EOS
EOO
;;
*)
;;
esac
阅读(735) | 评论(0) | 转发(0) |