个人工具
登录
查看“Ubuntu上Oracle10g安装指南”的源代码 - Ubuntu中文
页面
讨论
查看源代码
历史
搜索
导航
首页
最近更改
随机页面
页面分类
帮助
编辑
编辑指南
沙盒
新闻动态
字词处理
工具
链入页面
相关更改
特殊页面
页面信息
查看“Ubuntu上Oracle10g安装指南”的源代码
来自Ubuntu中文
←
Ubuntu上Oracle10g安装指南
跳转至:
导航
,
搜索
因为以下原因,你没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
== 第六步,设置自启动 == 创建自启动脚本 创建 oracledb 脚本到/etc/init.d/oracledb,内容如下 <pre>#!/bin/bash # # /etc/init.d/oracledb # # Run-level Startup script for the Oracle Instance, Listener, and # Web Interface export ORACLE_HOME=/opt/ora10 export ORACLE_SID=ora1 export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/Apache/Apache/bin:$PATH ORA_OWNR="oracle" # if the executables do not exist -- display error if [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ] then echo "[Oracle Error] dbstart command does not exist, quitting..." exit 1 else echo "[Oracle Info] dbstart existance check OK" fi # depending on parameter -- startup, shutdown, restart # of the instance and listener or usage display case "$1" in start) # Oracle listener and instance startup echo "[Oracle Info] Starting oracle" echo "[Oracle Info] su $ORA_OWNR -c ""$ORACLE_HOME/bin/lsnrctl start" su $ORA_OWNR -c "$ORACLE_HOME/bin/lsnrctl start" if [ $? -ne 0 ] then echo "[Oracle Error] listener failed to start" exit 1 else echo "[Oracle Info] listener start OK" fi su $ORA_OWNR -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME" echo "[Oracel Info] su $ORA_OWNR -c ""$ORACLE_HOME/bin/dbstart $ORACLE_HOME" if [ $? -ne 0 ] then echo "[Oracle Error] dbstart failed to start" exit 1 else echo "[Oracle Info] dbstart OK" fi touch /var/lock/oracle echo "[Oracle Info]su $ORA_OWNR -c ""$ORACLE_HOME/bin/emctl start dbconsole" su $ORA_OWNR -c "$ORACLE_HOME/bin/emctl start dbconsole" if [ $? -ne 0 ] then echo "[Oracle Error] dbconsole failed to start" exit 1 else echo "[Oracle Info] dbconsole start OK" fi echo "[Oracle Info] Starting oracle ended OK" ;; stop) # Oracle listener and instance shutdown echo "[Oracle Info] Shutdown Oracle: " echo "[Oracle Info] su $ORA_OWNR -c ""$ORACLE_HOME/bin/lsnrctl stop" su $ORA_OWNR -c "$ORACLE_HOME/bin/lsnrctl stop" echo "[Oracle Info] su $ORA_OWNR -c ""$ORACLE_HOME/bin/dbshut $ORACLE_HOME" su $ORA_OWNR -c "$ORACLE_HOME/bin/dbshut $ORACLE_HOME" rm -f /var/lock/oracle echo "[Oracle Info]su $ORA_OWNR -c ""$ORACLE_HOME/bin/emctl stop dbconsole" su $ORA_OWNR -c "$ORACLE_HOME/bin/emctl stop dbconsole" echo "[Oracle Info] Shutdown Oracle ended OK" ;; reload|restart) echo "[Oracle Info]: $1 oracle" $0 stop $0 start ;; *) echo "[Oracle Error] Unknown context: $1" echo "[Oracle Info] Usage: `basename $0` start|stop|restart|reload" exit 1 esac exit 0 </pre> 设置权限,放到启动脚本中去 <pre>chmod 755 /etc/init.d/oracledb update-rc.d oracledb defaults 99 </pre> 还需要编辑一下/etc/oratab,把其中的N改成Y,不然上述脚本中所调用的$ORACLE_HOME/bin/dbstart在执行时不会自动启动相应的数据库实例(这里的数据库实例是ora1)。文件内容如下: <pre> # # This file is used by ORACLE utilities. It is created by root.sh # and updated by the Database Configuration Assistant when creating # a database. # A colon, ':', is used as the field terminator. A new line terminates # the entry. Lines beginning with a pound sign, '#', are comments. # # Entries are of the form: # $ORACLE_SID:$ORACLE_HOME:<N|Y>: # # The first and second fields are the system identifier and home # directory of the database respectively. The third filed indicates # to the dbstart utility that the database should , "Y", or should not, # "N", be brought up at system boot time. # # Multiple entries with the same $ORACLE_SID are not allowed. # # ora1:/opt/ora10:Y </pre> 我的 oralce 的安装盘中可能有些问题,所以如果只用上述的脚本是不能启动 listener的,要修改一下: 修改 /opt/ora10/bin/dbstart文件 查找:(本步骤修改后需重新安装?——(不需要重新安装呀[[User:Sutra|Sutra]] 2010年6月10日 (四) 21:31 (CST))) <pre># Set this to bring up Oracle Net Listener ORACLE_HOME_LISTNER=/ade/vikrkuma_new/oracle </pre> 将其改为: <pre># Set this to bring up Oracle Net Listener ORACLE_HOME_LISTNER=$ORACLE_HOME </pre> 设置後,测试一下 <pre>/etc/init.d/./oracledb reload </pre> 如果一切正常的话,会关闭一次Oracle又再重新打开。
返回至
Ubuntu上Oracle10g安装指南
。