您的位置:首页 > 数据库 > Oracle

start oracle with the linux opening

2009-11-20 12:09 246 查看
 1.修改/etc/oratab ,添加$ORACLE_SID:$ORACLE_HOME:Y --
Y代表OS启动则DB启动必须设置为Y,否则dbstart和dbstop不可用,N为不启动,$ORACLE_SID是DB
SID,$ORACLE_HOME是DB 绝对路径

2.修改/etc/rc.d/rc.loacl,加入以下:

#listener command

COMM_LISTENER=/opt/oracle/product/10.2.0/db_1/bin/lsnrctl

LISTENER_NAME=orctest

su - oracle -c "$COMM_LISTENER start $LISTENER_NAME"

COMM_START=/opt/oracle/product/10.2.0/db_1/bin/dbstart

su - oracle -c "$COMM_START"

echo $COMM_START

重启即可看到数据库和监听已经启动。

##################################################

1. 创建文件/etc/oratab

#添加如下内容到/etc/oratab文件中,

#$ORACLE_SID是你的Oracle数据库的sid

#$ORACLE_HOME是你的Oracle数据库的Oracle_home

#Y表示要求在系统启动的时候启动Oracle数据库.N表示不要在系统启动的时候启动Oracle

改以下为

# *:/data/opt/app/oracle/app:N# db1:/data/opt/app/oracle/app:N

*:/data/opt/app/oracle/app:Ydb1:/data/opt/app/oracle/app:Y

2. 修改文件/etc/rc.local添加一下两行

su - oracle -c 'dbstart'

su - oracle -c 'lsnrctl start '

3.修改dbstart这个启动文件的oratab的目录为/etc/oratab,默认的文件目录是不对的。一定要改。

#ORATAB=/var/opt/oracle/oratab

ORATAB=/etc/oratab

只需修改以上就可以成功了。很EASY!

#######################################################

=== 5. 设置数据库自动启动 ===

-- 5.1 --

编辑文件 /etc/oratab,将“N”修改为“Y”

oradb1:/oracle/product/10.2.0:Y

-- 5.2 --

确认oracle用户能否用系统自带的Shell程序dbstart, dbshut正常启动和关闭数据库,以oracle

身份执行 dbstart dbshut

-- 5.3 建立启动Shell --

以root身份,在 /etc/rc.d/init.d 目录下建立文件 oracle,内容为:

#!/bin/sh

OPT_=$1

case "$OPT_" in

start)

/bin/echo "$0 : (start)"

#

# Your service startup command goes here.

#

su - oracle -c "/oracle/product/10.2.0/bin/lsnrctl start"

su - oracle -c "/oracle/product/10.2.0/bin/dbstart"

# NOTE: Must exit with zero unless error is severe.

chmod 1777 /tmp

chown root:root /tmp

exit 0

;;

stop)

/bin/echo "$0 : (stop)"

#

# Your service shutdown command goes here.

#

su - oracle -c "/oracle/product/10.2.0/bin/lsnrctl stop"

su - oracle -c "/oracle/product/10.2.0/bin/dbshut"

# NOTE: Must exit with zero unless error is severe.

exit 0

;;

*)

/bin/echo ''

/bin/echo "Usage: $0 [start|stop]"

/bin/echo " Invalid argument ==> "${OPT_}""

/bin/echo ''

exit 0

;;

esac

然后改变它的属性成755, 可以执行

-- 5.4 建立启动、关闭连接 --

在目录 /etc/rc.d/rc3.d 中建立文件链接 S99oracle -> /etc/rc.d/init.d/oracle

在目录 /etc/rc.d/rc0.d 中建立文件链接 K01oracle -> /etc/rc.d/init.d/oracle

重启动...
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息