第一步:
# vim /etc/oratab修改
orcl:/home/luchen/oracle/db:N改为:
orcl:/home/luchen/oracle/db:N
第二步:
#vim $ORACLE_HOME/bin/dbstart
找到ORACLE_HOME_LISTNER=/opt/oracle/product/10.2.0/db_1
修改为:
ORACLE_HOME_LISTNER=$ORACLE_HOME
第三步:
#vim /etc/rc.d/init.d/oracle10g
插入如下文本
1 #!/bin/bash
2 #chkconfig: 345 51 49
3 #description: starts the oracle dabase deamons
4
5 case "$1" in
6
7 'start')
8
9 echo -n "Starting oracle10g ... "
10
11 su - luchen -c "/home/luchen/oracle/db/bin/dbstart"
12
13 echo "Done."
14
15 echo "Starting Oracle Listeners ... "
16
17 su - luchen -c "/home/luchen/oracle/db/bin/lsnrctl start"
18
19 echo "Done."
20
21 #启动web管理界面:http://host_ip_address:1158/em
22
23 su - luchen -c "/home/luchen/oracle/db/bin/emctl start dbconsole"
24
25 touch /var/lock/subsys/oracle10g
26
27 echo ""
28
29 ;;
30
31 'stop')
echo -n "shutting down oracle10g ... "
34
35 su - luchen -c "/home/luchen/oracle/db/bin/dbshut"
36
37 echo -n "dbshut ok !"
38
39 su - luchen -c "/home/luchen/oracle/db/bin/lsnrctl stop"
40
41 echo -n "lsnrctl stop ok !"
42
43 su - luchen -c "/home/luchen/oracle/db/bin/emctl stop dbconsole"
44
45 rm -f /var/lock/subsys/oracle10g
46
47 echo
48
49 ;;
50
51 'restart')
52
53 echo -n "restarting oracle10g ... "
54
55 $0 stop
56
57 $0 start
58
59 echo
;;
62
63 *)
64
65 echo "Usage: oracle {start|stop|restart} "
66
67 exit 1
68
69
70 esac
71
72 exit 0
第四步:
添加oracle10g服务
chkconfig --add oracle10g
chkconfig --list oracle10g
最后:
设置开机启动oracle10g服务
chkconfig oracle10g on
操作完成、重启验证!