博威---云架构决胜云计算

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2084|回复: 3

Solaris中设置oracle自启动

[复制链接]
发表于 2010-4-19 20:25:09 | 显示全部楼层 |阅读模式
oracle自带了开启和关闭数据库的脚本
$ORACLE_HOME/bin/dbstartup
$ORACLE_HOME/bin/dbshut

所以只需要利用这两个脚本 就可实现开机自启动

ORACLE_HOME路径为/export/home/oracle/product/10.0

首先需要修改这两个脚本,否则会出错

#vi $ORACLE_HOME/bin/dbstartup

将其中的ORACLE_HOME_LISTNER=$1更改为ORACLE_HOME_LISTNER=$ORACLE_HOME

同样修改dbshut文件

oracle数据库 默认是不会自动启动的,修改/var/opt/oracle/oratab文件

只一条语句,最后一句话
boway:/export/home/oracle/product/10.0:N

将最后的N改为Y

然后直接执行dbstart &

[oracle@boway:/export/home/oracle]#dbstart &
[1] 1978
[oracle@boway:/export/home/oracle]#Processing Database instance "boway": log file /export/home/oracle/product/10.0/startup.log
[oracle@boway:/export/home/oracle]#
[oracle@boway:/export/home/oracle]#ps -eaf | grep ora
oracle  2110     1   0 20:13:53 ?           0:00 ora_p002_boway
  oracle  1431   924   0 20:04:51 pts/2       0:01 /export/home/oracle/product/10.0/bin/emagent
  oracle  2082     1   0 20:13:48 ?           0:00 ora_mman_boway
  oracle   762   761   0 20:02:03 ?           0:00 /usr/lib/ssh/sshd
  oracle  2088     1   0 20:13:48 ?           0:00 ora_ckpt_boway
  oracle   929   924   0 20:03:20 pts/2       0:31 /export/home/oracle/product/10.0/jdk/bin/java -server -Xmx256M -XX:MaxPermSize=
  oracle  2188   769   0 20:14:01 pts/2       0:00 grep ora
  oracle  2187   769   0 20:14:01 pts/2       0:00 ps -eaf
  oracle  2102     1   0 20:13:48 ?           0:00 ora_s000_boway
  oracle  2084     1   0 20:13:48 ?           0:00 ora_dbw0_boway
oracle   580     1   0 20:01:52 ?           0:00 /export/home/oracle/product/10.0/bin/tnslsnr LISTENER -inherit
  oracle  2078     1   0 20:13:48 ?           0:00 ora_pmon_boway
  oracle  2080     1   0 20:13:48 ?           0:00 ora_psp0_boway
  oracle  2092     1   0 20:13:48 ?           0:00 ora_reco_boway
  oracle  2090     1   0 20:13:48 ?           0:00 ora_smon_boway
  oracle   769   762   0 20:02:06 pts/2       0:00 -bash
  oracle  2100     1   0 20:13:48 ?           0:00 ora_d000_boway
  oracle  2086     1   0 20:13:48 ?           0:00 ora_lgwr_boway
  oracle  2094     1   0 20:13:48 ?           0:00 ora_cjq0_boway
  oracle  2098     1   0 20:13:48 ?           0:00 ora_mmnl_boway
  oracle  2096     1   1 20:13:48 ?           0:00 ora_mmon_boway
  oracle   924     1   0 20:03:19 pts/2       0:00 /export/home/oracle/product/10.0/perl/bin/perl /export/home/oracle/product/10.0
  oracle  2184     1   0 20:13:59 ?           0:00 oracleboway (LOCAL=NO)
  oracle  2106     1   0 20:13:53 ?           0:00 ora_p000_boway
  oracle  2108     1   0 20:13:53 ?           0:00 ora_p001_boway

  oracle  2186     1   1 20:14:00 ?           0:01 oracleboway (LOCAL=NO)
  oracle  2114     1   0 20:13:56 ?           0:00 ora_qmnc_boway
[1]+  Done                    dbstart
[oracle@boway:/export/home/oracle]#



可以看见监听进程和数据库都启动了

然后 再执行dbshut &
[oracle@boway:/export/home/oracle]#dbshut &
[1] 2225
[oracle@boway:/export/home/oracle]#Processing Database instance "boway": log file /export/home/oracle/product/10.0/shutdown.log
[oracle@boway:/export/home/oracle]#


[oracle@boway:/export/home/oracle]#ps -eaf | grep ora
  oracle  1431   924   0 20:04:51 pts/2       0:01 /export/home/oracle/product/10.0/bin/emagent
  oracle  2082     1   0 20:13:48 ?           0:00 ora_mman_boway
  oracle   762   761   0 20:02:03 ?           0:00 /usr/lib/ssh/sshd
  oracle  2196     1   0 20:14:07 ?           0:00 oracleboway (LOCAL=NO)
  oracle  2088     1   0 20:13:48 ?           0:00 ora_ckpt_boway
  oracle   929   924   0 20:03:20 pts/2       0:31 /export/home/oracle/product/10.0/jdk/bin/java -server -Xmx256M -XX:MaxPermSize=
  oracle  2192     1   0 20:14:04 ?           0:00 oracleboway (LOCAL=NO)
  oracle  2102     1   0 20:13:48 ?           0:00 ora_s000_boway
  oracle  2084     1   0 20:13:48 ?           0:00 ora_dbw0_boway
  oracle  2274     1   0 20:15:27 ?           0:00 ora_emn0_boway
  oracle  2078     1   0 20:13:48 ?           0:00 ora_pmon_boway
  oracle  2080     1   0 20:13:48 ?           0:00 ora_psp0_boway
  oracle  2092     1   0 20:13:48 ?           0:00 ora_reco_boway
  oracle  2090     1   0 20:13:48 ?           0:00 ora_smon_boway
  oracle   769   762   0 20:02:06 pts/2       0:00 -bash
  oracle  2100     1   0 20:13:48 ?           0:00 ora_d000_boway
  oracle  2086     1   0 20:13:48 ?           0:00 ora_lgwr_boway
  oracle  2271  2228   0 20:15:27 pts/2       0:00 sqlplus /nolog
  oracle   924     1   0 20:03:19 pts/2       0:00 /export/home/oracle/product/10.0/perl/bin/perl /export/home/oracle/product/10.0
  oracle  2184     1   0 20:13:59 ?           0:00 oracleboway (LOCAL=NO)
  oracle  2228  2225   0 20:15:26 pts/2       0:00 -bash
  oracle  2276   769   0 20:15:37 pts/2       0:00 grep ora
  oracle  2225   769   0 20:15:26 pts/2       0:00 -bash
  oracle  2275   769   0 20:15:37 pts/2       0:00 ps -eaf
  oracle  2272  2271   0 20:15:27 ?           0:00 oracleboway (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
  oracle  2186     1   0 20:14:00 ?           0:01 oracleboway (LOCAL=NO)
[oracle@boway:/export/home/oracle]#

可以看见监听进程和数据库都关闭了

然后
#vi /etc/rc2.d/S99oracle
内容:
  #!/bin/bash
  su - oracle -c /export/home/oracle/product/10.0/bin/dbstart &

#vi /etc/rc0.d/K10oracle
  #!/bin/bash
  su - oracle -c /export/home/oracle/product/10.0/bin/dbshut &


#reboot

之后再看ps -eaf | grep ora[oracle@boway:/export/home/oracle]#ps -eaf | grep ora
  oracle   768   676   0 20:21:35 pts/2       0:00 -bash
  oracle   477     1   0 20:21:19 ?           0:00 -bash -c /export/home/oracle/product/10.0/bin/dbstart
  oracle   784   768   0 20:21:40 pts/2       0:00 ps -eaf
  oracle   785   768   0 20:21:40 pts/2       0:00 grep ora
  oracle   783   666   0 20:21:37 ?           0:00 oracleboway (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
  oracle   617   477   0 20:21:23 ?           0:00 -bash -c /export/home/oracle/product/10.0/bin/dbstart
  oracle   676   675   0 20:21:28 ?           0:00 /usr/lib/ssh/sshd
  oracle   727     1   0 20:21:31 ?           0:00 ora_pmon_boway
  oracle   729     1   0 20:21:31 ?           0:00 ora_psp0_boway
  oracle   666   617   0 20:21:25 ?           0:00 sqlplus /nolog
  oracle   580     1   0 20:21:23 ?           0:00 /export/home/oracle/product/10.0/bin/tnslsnr LISTENER -inherit
  oracle   731     1   0 20:21:31 ?           0:00 ora_mman_boway
  oracle   733     1   0 20:21:31 ?           0:00 ora_dbw0_boway
  oracle   735     1   0 20:21:31 ?           0:00 ora_lgwr_boway
  oracle   737     1   0 20:21:31 ?           0:00 ora_ckpt_boway
  oracle   739     1   0 20:21:31 ?           0:00 ora_smon_boway
  oracle   741     1   0 20:21:31 ?           0:00 ora_reco_boway
  oracle   743     1   0 20:21:31 ?           0:00 ora_cjq0_boway
  oracle   745     1   0 20:21:31 ?           0:00 ora_mmon_boway
  oracle   747     1   0 20:21:32 ?           0:00 ora_mmnl_boway
  oracle   749     1   0 20:21:32 ?           0:00 ora_d000_boway
  oracle   751     1   0 20:21:32 ?           0:00 ora_s000_boway

[oracle@boway:/export/home/oracle]#
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|boway Inc. ( 冀ICP备10011147号 )

GMT+8, 2024-5-3 22:02 , Processed in 0.096705 second(s), 16 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表