• 软件测试技术
  • 软件测试博客
  • 软件测试视频
  • 开源软件测试技术
  • 软件测试论坛
  • 软件测试沙龙
  • 软件测试资料下载
  • 软件测试杂志
  • 软件测试人才招聘
    暂时没有公告

字号: | 推荐给好友 上一篇 | 下一篇

oracle 在solaris 8上的自启动

发布: 2007-6-08 22:43 | 作者: seanhe | 来源: | 查看: 31次 | 进入软件测试论坛讨论

领测软件测试网
脚本我看懂了,把编辑的 oracle 运行能够正常启动oracle 和关闭oracle服务。
但是连接的两个语句什么意思?是根据什么写成这样的?
oracle是我的用户名,是不是如果我的用户名是别的比如oradba,那么我的文件名也要改成oradba?
是不是系统启动时会自动调用脚本,并加入参数'start'? 关机时也会自动加入'stop'? 再就是这个脚本是不是主机reboot后,没有用户登录的状态下就会调用啊(就像NT的服务一样?)?

以下脚本引自peng 的"solaris9上安装oracle9201数据库(sun sparc)"
编辑内容如下: 
#!/bin/sh 
# Set ORA_HOME to be equivalent to the $ORACLE_HOME 
# from which you wish to execute dbstart and dbshut; 

# Set ORA_OWNER to the user id of the owner of the 
Oracle database in ORA_HOME. 
ORA_HOME=/data/oracle/product/9.2.0 
ORA_OWNER=oracle 
if [! -f $ORA_HOME/bin/dbstart] 
then 
echo "Oracle startup: cannot start" 
exit 
fi 
case "$1" in 
’start’) 
# Start the Oracle databases: 
# The following command assumes that the oracle login 
# will not prompt the user for any values 
su - $ORA_OWNER -c $ORA_HOME/bin/dbstart & 
su – $ORA_OWNER –c “lsnrctl start &” 
;; 
’stop’) 
# Stop the Oracle databases: 
# The following command assumes that the oracle login 
# will not prompt the user for any values 
su - $ORA_OWNER -c $ORA_HOME/bin/dbshut & 
su – $ORA_OWNER –c “lsnrctl start &” 
;; 
esac 
-------------------------脚本到此结束。 
连接到启动目录: 

#ln –s /etc/init.d/oracle /etc/rc3.d/S99oracle 
#ln –s /etc/init.d/oracle /etc/rcS.d/K99oracle 

到此,数据库安装已经结束了。

【发表回复】【查看CU论坛原帖】【添加到收藏夹】【关闭】
 armording 回复于:2003-12-19 13:28:12
[quote:790eff0e9a]#ln –s /etc/init.d/oracle /etc/rc3.d/S99oracle 
#ln –s /etc/init.d/oracle /etc/rcS.d/K99oracle [/quote:790eff0e9a]

我手动执行/etc/init.d/oracle 和etc/rc3.d/S99oracle 和/etc/rcS.d/K99oracle  都能正常启动和关闭数据库。
但自动的时候不会自动执行,需要手动,为什么?

 peng 回复于:2003-12-19 14:01:22
你把S99oracle 和K99oracle 都放在/etc/rc2.d/下。

 armording 回复于:2003-12-19 16:24:02
[quote:7df39db0bd="peng"]你把S99oracle 和K99oracle 都放在/etc/rc2.d/下。[/quote:7df39db0bd]
还是不行,但是我在reboot后未出现图形界面的时候看到系统调用我写的脚本了。但没成功,应该是参数给的不对。
我在登陆后,运行“S99oracle start”,能够启动。
另外能不能给我介绍一下rc2.d、rc3.d、rcS.d这几个目都是干什么的?
或者指点一下,关于这段内容我该看那本书?

 peng 回复于:2003-12-19 16:36:58
rc2.d rc3.d 是系统启动的级别,看sa238的书就可以了。

要是你的oracle安装拥护是oracledb,当然要更改为ORA_HOME=/data/oracle/product/9.2.0 ---你的oracle的安装目录。
ORA_OWNER=oraledb了  ---这个是说你的oracle的运行用户。

还有我的一个小错误,
# Stop the Oracle databases: 
# The following command assumes that the oracle login 
# will not prompt the user for any values 
su - $ORA_OWNER -c $ORA_HOME/bin/dbshut & 
su – $ORA_OWNER –c “lsnrctl start &”------错!
应该是:su – $ORA_OWNER –c “lsnrctl stop &”

 metor78 回复于:2003-12-19 16:39:28
强就一个字

 peng 回复于:2003-12-19 16:43:49
这个脚本很简单,你要注意几个概念:
ORACLE_BASE  这是说你的orale的基本目录,oracle除了oracle数据库外,还有很多产品啊。你可能还要用其他的产品,这是总目录。。

ORA_HOME=/data/oracle/product/9.2.0  --安装数据库的目录,指数据仓储,数据库。

ORA_OWNER  这个是说你的oracle的运行用户,当初你规定用那个系统用户来安装和运行oracle database,就是谁。。

其他的shell脚本,看看资料,就应该ok了。。

 armording 回复于:2003-12-19 16:53:53
thanks!
[quote:4f4b21fe4b]su - $ORA_OWNER -c $ORA_HOME/bin/dbstart & 
su – $ORA_OWNER –c “lsnrctl start &” [/quote:4f4b21fe4b]
我手动运行脚本,只执行了第一句,第二句没执行。我在中加加了个echo,发现也没输出,我吧su - $ORA_OWNER -c $ORA_HOME/bin/dbstart & 改成了 su - $ORA_OWNER -c $ORA_HOME/bin/dbstart ,再手动运行,两句都执行了。但是reboot的时候不自动运行啊?

 peng 回复于:2003-12-19 17:05:04
带 &只是后台启动啊。。
看看你有没有书写错误啊。

我的就是我写的文章中作的,肯定没有问题。
我又看了一遍。。

 armording 回复于:2003-12-19 18:10:48
我检查了好几遍,觉得脚本应该没有问题。
我手动运行脚本(后面加start参数),数据库服务和监听都能够正常启动,但是reboot,只有数据库服务能正常启动,而监听没有起来,怎么解决啊?
下面是我的脚本oracle

# !/bin/sh
# Set ORA_HOME to be equivalent to the $ORACLE_HOME
# from which you wish to execute dbstart and dbshut
#
# set ORA_OWNER to the user id of the owner of the
# Oracle database in ORA_HOME
ORA_HOME=/space/oracle/product/9.0.2
ORA_OWNER=oracle
if [ ! -f $ORA_HOME/bin/dbstart ]
then
echo "Not find dbstart,can not start Oracle "
exit
fi
#echo "Oracle Starting..."
case "$1" in
'start')
# Start the Oracle databses:
# The following command assumes that the oracle login
# will not prompt the user for any values
echo "Oracle Starting..."
su - $ORA_OWNER -c $ORA_HOME/bin/dbstart &
#echo "Oracle started Succeed"
su - $ORA_OWNER -c "lsnrctl start"
;;
'stop')
#Stop the Oracle database;
# the following command assumes that the oracle login
# will not prompt the user for any values
echo "Oracle Shutdowning ..."
su - $ORA_OWNER -c $ORA_HOME/bin/dbshut &
su - $ORA_OWNER -c "lsnrctl stop &"
;;
* ) echo $1;;
esac

 iricyan 回复于:2003-12-19 22:38:30
用这么多吗?
印象中四五行搞定。

 peng 回复于:2003-12-19 22:49:03
因为注解很多。。。。

 iricyan 回复于:2003-12-19 22:55:58
去掉注解能到5行吗?

 peng 回复于:2003-12-19 22:58:36
[quote:23e2cf7030="iricyan"]去掉注解能到5行吗?[/quote:23e2cf7030]
不能,linux下可以。

有标准输出项啊,这样比较正规。。

燕子怎样写的?可以给楼主一个参考。。

 iricyan 回复于:2003-12-19 23:01:28
:em06:  :em06:  :em06: 
忘记了,需要找找,这个到oracle应该能找到。

 armording 回复于:2003-12-20 11:39:13
现在不是行数多少的问题,是我的监听就不能自启动成功啊!给个解决办法?

 RomanticProgrammer 回复于:2003-12-20 13:51:29
学习。

 oramind 回复于:2003-12-27 08:50:59
according to what you said:
db starts, but listener doesn't.
so, think about what's different between the two.
take a look at the code and see what's different about those two lines.  the second line doesn't have full path to lsnrctl.  make it the same like the first line (add $ORA_HOME), or even easier, as root, just make a sym link and put in /usr/bin
ln -s $ORA_HOME/bin/lsnrctl /usr/bin

su - $ORA_OWNER -c $ORA_HOME/bin/dbstart & 
su - $ORA_OWNER -c "lsnrctl start"

 victorxu79 回复于:2003-12-27 09:44:33
最好不要这样做,要不然异常当机后发生的数据库错误会使系统挂起(要到单用户下改),另外也会关机时数据库关不下来,从而影响系统.

延伸阅读

文章来源于领测软件测试网 https://www.ltesting.net/


关于领测软件测试网 | 领测软件测试网合作伙伴 | 广告服务 | 投稿指南 | 联系我们 | 网站地图 | 友情链接
版权所有(C) 2003-2010 TestAge(领测软件测试网)|领测国际科技(北京)有限公司|软件测试工程师培训网 All Rights Reserved
北京市海淀区中关村南大街9号北京理工科技大厦1402室 京ICP备10010545号-5
技术支持和业务联系:info@testage.com.cn 电话:010-51297073

软件测试 | 领测国际ISTQBISTQB官网TMMiTMMi认证国际软件测试工程师认证领测软件测试网