设置Oracle跟随系统一起启动

1.修改$ORACLE_HOME/bin下的配置文件dbstart,将ORACLE_HOME_LISTNER=$1修改为ORACLE_HOME_LISTNER=$ORACLE_HOME,略88行处,如下红色字体部分:

# Save LD_LIBRARY_PATH
SAVE_LLP=$LD_LIBRARY_PATH

# First argument is used to bring up Oracle Net Listener
ORACLE_HOME_LISTNER=$ORACLE_HOME
if [ ! $ORACLE_HOME_LISTNER ] ; then
  echo "ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener"
  echo "Usage: $0 ORACLE_HOME"
else

2.添加服务到/etc/oratab中,其中zxin为实例名,/home/oracle/product/10.2.0/db_1为你自己安装的oracle的路径

zxin:/home/oracle/product/10.2.0/db_1:Y

3.编辑/etc/init.d/rc文件,在最后一行的exit 0之前添加如下代码:

rc_local=/etc/rc.local
current_runlevel=$(runlevel | awk '{ print $NF }')
if [ -x $rc_local ];then
   ((current_runlevel>1)) && ((current_runlevel<6)) && {
     echo -e "\n\n\n"
     echo "-----------------------Startup $rc_local---------------------------"
     $rc_local
   }
fi

4.添加启动项至开机脚本/etc/rc.local中,如果rc.local文件不存在,请手动创建,路径根据自己实际情况填写:

su oracle -lc '/home/oracle/product/10.2.0/db_1/bin/dbstart'
su oracle -lc '/home/oracle/product/10.2.0/db_1/bin/lsnrctl start'

5.重启服务器验证:

linux:~ # reboot

Broadcast message from root (pts/0) (Tue Sep  6 11:09:53 2016):

The system is going down for reboot NOW!
linux:~ #
Last login: Tue Sep  6 11:05:31 2016 from 192.168.200.1
linux:~ # su - oracle
oracle@linux:~> ps -ef|grep oracle
oracle     3723      1  0 11:10 ?        00:00:00 /home/oracle/product/10.2.0/db_1/bin/tnslsnr LISTENER -inherit
oracle     3883      1  0 11:10 ?        00:00:00 ora_pmon_zxin
oracle     3887      1  0 11:10 ?        00:00:00 ora_psp0_zxin
oracle     3891      1  0 11:10 ?        00:00:00 ora_mman_zxin
oracle     3894      1  0 11:10 ?        00:00:00 ora_dbw0_zxin
oracle     3898      1  0 11:10 ?        00:00:00 ora_lgwr_zxin
oracle     3902      1  0 11:10 ?        00:00:00 ora_ckpt_zxin
oracle     3906      1  0 11:10 ?        00:00:00 ora_smon_zxin
oracle     3911      1  0 11:10 ?        00:00:00 ora_reco_zxin
oracle     3914      1  1 11:10 ?        00:00:00 ora_cjq0_zxin
oracle     3917      1  2 11:10 ?        00:00:00 ora_mmon_zxin
oracle     3920      1  0 11:10 ?        00:00:00 ora_mmnl_zxin
oracle     3959      1  1 11:10 ?        00:00:00 ora_arc0_zxin
oracle     3961      1  0 11:10 ?        00:00:00 ora_arc1_zxin
oracle     3963      1  0 11:10 ?        00:00:00 ora_qmnc_zxin
root       4172   3927  0 11:10 pts/0    00:00:00 su - oracle
oracle     4173   4172  0 11:10 pts/0    00:00:00 -bash
oracle     4199   4173 99 11:10 pts/0    00:00:00 ps -ef
oracle     4200   4173  0 11:10 pts/0    00:00:00 grep oracle
oracle@linux:~> lsnrctl status

LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 06-SEP-2016 11:10:52

Copyright (c) 1991, 2007, Oracle.  All rights reserved.

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 10.2.0.4.0 - Production
Start Date                06-SEP-2016 11:10:29
Uptime                    0 days 0 hr. 0 min. 23 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /home/oracle/product/10.2.0/db_1/network/log/listener.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=linux)(PORT=1521)))
Services Summary...
Service "zxin" has 1 instance(s).
  Instance "zxin", status READY, has 1 handler(s) for this service...
Service "zxin_XPT" has 1 instance(s).
  Instance "zxin", status READY, has 1 handler(s) for this service...
The command completed successfully
oracle@linux:~>
                                                                       



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值