Oracle 服务自启动
1. 修改/etc/oratab文件
db1:/home/Oracle/product/11.2.0/db_1:Y
$ORACLE_SID:$ORACLE_HOME:Y
2. 修改启动文件$ORACLE_HOME/bin/dbstart
修改ORACLE_HOME_LISTNER=$1 为ORACLE_HOME_LISTNER=/home/oracle/product/11.2.0/db_1
3.修改关闭文件$ORACLE_HOME/bin/dbshut
修改ORACLE_HOME_LISTNER=$1 为ORACLE_HOME_LISTNER=/home/oracle/product/11.2.0/db_1
4. 在/etc/init.d下建立脚本
vi /etc/init.d/oracle11
#!/bin/bash
# chkconfig: 345 88 14
# description: Startup Script. for oracle Databases
# /etc/rc.d/init.d/oradbstart
export ORACLE_BASE=/home/oracle
export ORACLE_HOME=/home/oracle/product/11.2.0/db_1
export ORACLE_SID=dbl
export PATH=$PATH:$ORACLE_HOME/bin
case "$1" in
start)
echo "-----startup oracle-----" >> /var/log/oracle11log
su oracle -c $ORACLE_HOME/bin/dbstart
touch /var/lock/subsys/oracle11
echo "-----startup oracle successful-----" >> /var/log/oracle11log
echo "OK"
;;
stop)
echo "-----shutdwn oracle-----" >> /var/log/oracle11log
su oracle -c $ORACLE_HOME/bin/dbshut
rm -f /var/lock/subsys/oracle11
echo "-----shutdown oracle successful-----" >> /var/log/oracle11log
echo "OK"
;;
*)
echo "Usage: 'basename $0' start|stop"
exit 1
esac
exit 0
保存退出。
5. 授于权限
chown oracle:oinstall oracle11
chmod 774 oracle11
6. 添加服务
chkconfig --add oracle11
chkconfig oracle11 on
chkconfig --list | grep oracle11
7.尝试用服务方式关闭,启动
[root@rman ~]# service oracle11 stop
Processing Database instance "db1": log file /home/oracle/product/11.2.0/db_1/shutdown.log
OK
[root@rman ~]# ps -elf | grep ora_
0 S root 4814 4543 0 78 0 - 15307 pipe_w 17:33 pts/1 00:00:00 grep ora_
[root@rman ~]# service oracle11 start
Processing Database instance "db1": log file /home/oracle/product/11.2.0/db_1/startup.log
OK
[root@rman ~]# ps -elf | grep ora_
0 S oracle 4959 1 0 75 0 - 193270 665975 17:33 ? 00:00:00 ora_pmon_db1
0 S oracle 4963 1 0 58 - - 193106 - 17:33 ? 00:00:00 ora_vktm_db1
0 S oracle 4969 1 0 78 0 - 193106 - 17:33 ? 00:00:00 ora_gen0_db1
0 S oracle 4973 1 0 78 0 - 193106 - 17:33 ? 00:00:00 ora_diag_db1
0 S oracle 4977 1 0 75 0 - 193106 - 17:33 ? 00:00:00 ora_dbrm_db1
0 S oracle 4981 1 0 78 0 - 193106 - 17:33 ? 00:00:00 ora_psp0_db1
0 S oracle 4985 1 0 78 0 - 193234 - 17:33 ? 00:00:00 ora_dia0_db1
0 S oracle 4989 1 0 78 0 - 193106 - 17:33 ? 00:00:00 ora_mman_db1
0 S oracle 4993 1 0 75 0 - 194081 - 17:33 ? 00:00:00 ora_dbw0_db1
0 S oracle 4997 1 0 75 0 - 196994 - 17:33 ? 00:00:00 ora_lgwr_db1
0 S oracle 5001 1 0 76 0 - 193106 - 17:33 ? 00:00:00 ora_ckpt_db1
0 S oracle 5005 1 0 75 0 - 193106 - 17:33 ? 00:00:00 ora_smon_db1
0 S oracle 5009 1 0 78 0 - 193106 - 17:33 ? 00:00:00 ora_reco_db1
0 S oracle 5013 1 2 75 0 - 193796 - 17:33 ? 00:00:00 ora_mmon_db1
0 S oracle 5017 1 0 75 0 - 193106 - 17:33 ? 00:00:00 ora_mmnl_db1
0 S oracle 5021 1 0 78 0 - 193276 912653 17:33 ? 00:00:00 ora_d000_db1
0 S oracle 5025 1 0 78 0 - 193114 903991 17:33 ? 00:00:00 ora_s000_db1
0 S oracle 5043 1 0 78 0 - 193106 - 17:33 ? 00:00:00 ora_qmnc_db1
0 S root 5161 4543 0 78 0 - 15308 pipe_w 17:33 pts/1 00:00:00 grep ora_
8.重启动测试。
db1:/home/Oracle/product/11.2.0/db_1:Y
$ORACLE_SID:$ORACLE_HOME:Y
2. 修改启动文件$ORACLE_HOME/bin/dbstart
修改ORACLE_HOME_LISTNER=$1 为ORACLE_HOME_LISTNER=/home/oracle/product/11.2.0/db_1
3.修改关闭文件$ORACLE_HOME/bin/dbshut
修改ORACLE_HOME_LISTNER=$1 为ORACLE_HOME_LISTNER=/home/oracle/product/11.2.0/db_1
4. 在/etc/init.d下建立脚本
vi /etc/init.d/oracle11
#!/bin/bash
# chkconfig: 345 88 14
# description: Startup Script. for oracle Databases
# /etc/rc.d/init.d/oradbstart
export ORACLE_BASE=/home/oracle
export ORACLE_HOME=/home/oracle/product/11.2.0/db_1
export ORACLE_SID=dbl
export PATH=$PATH:$ORACLE_HOME/bin
case "$1" in
start)
echo "-----startup oracle-----" >> /var/log/oracle11log
su oracle -c $ORACLE_HOME/bin/dbstart
touch /var/lock/subsys/oracle11
echo "-----startup oracle successful-----" >> /var/log/oracle11log
echo "OK"
;;
stop)
echo "-----shutdwn oracle-----" >> /var/log/oracle11log
su oracle -c $ORACLE_HOME/bin/dbshut
rm -f /var/lock/subsys/oracle11
echo "-----shutdown oracle successful-----" >> /var/log/oracle11log
echo "OK"
;;
*)
echo "Usage: 'basename $0' start|stop"
exit 1
esac
exit 0
保存退出。
5. 授于权限
chown oracle:oinstall oracle11
chmod 774 oracle11
6. 添加服务
chkconfig --add oracle11
chkconfig oracle11 on
chkconfig --list | grep oracle11
7.尝试用服务方式关闭,启动
[root@rman ~]# service oracle11 stop
Processing Database instance "db1": log file /home/oracle/product/11.2.0/db_1/shutdown.log
OK
[root@rman ~]# ps -elf | grep ora_
0 S root 4814 4543 0 78 0 - 15307 pipe_w 17:33 pts/1 00:00:00 grep ora_
[root@rman ~]# service oracle11 start
Processing Database instance "db1": log file /home/oracle/product/11.2.0/db_1/startup.log
OK
[root@rman ~]# ps -elf | grep ora_
0 S oracle 4959 1 0 75 0 - 193270 665975 17:33 ? 00:00:00 ora_pmon_db1
0 S oracle 4963 1 0 58 - - 193106 - 17:33 ? 00:00:00 ora_vktm_db1
0 S oracle 4969 1 0 78 0 - 193106 - 17:33 ? 00:00:00 ora_gen0_db1
0 S oracle 4973 1 0 78 0 - 193106 - 17:33 ? 00:00:00 ora_diag_db1
0 S oracle 4977 1 0 75 0 - 193106 - 17:33 ? 00:00:00 ora_dbrm_db1
0 S oracle 4981 1 0 78 0 - 193106 - 17:33 ? 00:00:00 ora_psp0_db1
0 S oracle 4985 1 0 78 0 - 193234 - 17:33 ? 00:00:00 ora_dia0_db1
0 S oracle 4989 1 0 78 0 - 193106 - 17:33 ? 00:00:00 ora_mman_db1
0 S oracle 4993 1 0 75 0 - 194081 - 17:33 ? 00:00:00 ora_dbw0_db1
0 S oracle 4997 1 0 75 0 - 196994 - 17:33 ? 00:00:00 ora_lgwr_db1
0 S oracle 5001 1 0 76 0 - 193106 - 17:33 ? 00:00:00 ora_ckpt_db1
0 S oracle 5005 1 0 75 0 - 193106 - 17:33 ? 00:00:00 ora_smon_db1
0 S oracle 5009 1 0 78 0 - 193106 - 17:33 ? 00:00:00 ora_reco_db1
0 S oracle 5013 1 2 75 0 - 193796 - 17:33 ? 00:00:00 ora_mmon_db1
0 S oracle 5017 1 0 75 0 - 193106 - 17:33 ? 00:00:00 ora_mmnl_db1
0 S oracle 5021 1 0 78 0 - 193276 912653 17:33 ? 00:00:00 ora_d000_db1
0 S oracle 5025 1 0 78 0 - 193114 903991 17:33 ? 00:00:00 ora_s000_db1
0 S oracle 5043 1 0 78 0 - 193106 - 17:33 ? 00:00:00 ora_qmnc_db1
0 S root 5161 4543 0 78 0 - 15308 pipe_w 17:33 pts/1 00:00:00 grep ora_
8.重启动测试。
相关推荐
lklong 2020-11-22
oraclemch 2020-11-06
shilukun 2020-10-10
周嘉笙 2020-11-09
iilegend 2020-10-19
EricRay 2020-10-16
zhuzhufxz 2020-09-16
dataminer 2020-08-17
bfcady 2020-08-16
Hody 2020-08-16
FightFourEggs 2020-08-16
数据库设计 2020-08-16
Seandba 2020-08-16
Omega 2020-08-16
zjyzz 2020-08-16
yanghuatong 2020-08-16
ktyl000 2020-08-16
dbasunny 2020-08-16