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

在 Red Hat Enterprise Linux AS V3.0 上安装 Oracle 10g 数据库

2006-06-06 12:39 549 查看
 
一、安装过程参考Oracle网站上的文章 《在 Linux x86 上安装 Oracle 数据库 10g》:
 
    http://www.oracle.com/technology/global/cn/pub/articles/smiley_10gdb_install.html
 
二、安装结束后,设置自动启动Oracle服务:
 
创建或修改 /etc/oratab 文件:  

orcl:/u01/app/oracle/product/10.2.0/db_1:Y
 
  其中,orcl 是Oracle数据库的sid,/u01/app/oracle/oracle/product/10.2.0/db_1是Oracle数据库的
Oracle_home,Y表示要求在系统启动的时候启动Oracle数据库。
 
在 /etc/rc.d/init.d 下建立自动启动脚本 oracle:

#!/bin/bash
#
# chkconfig: 35 50 50
# description: Oracle database server
#
 
# source function library
. /etc/init.d/functions
 
#
# Change the value of ORACLE to the login name of the
# oracle owner at your site.
#
ORACLE=oracle
 
#
# Change the value of ORACLE_HOME to specify the correct Oracle home
# directory for your installation.
#
ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
 
export ORACLE
export ORACLE_HOME
 
RETVAL=0
prog="Oracle"
 
start() {
        echo -n $"Starting $prog: "
        if [ $UID -ne 0 ]; then
                RETVAL=1
                failure
        else
                su - $ORACLE -c "lsnrctl start"       
                RETVAL=$?
                if [ $RETVAL -eq 0 ]; then
                    su - $ORACLE -c "dbstart"
                    RETVAL=$?
                fi;
                [ $RETVAL -eq 0 ] && touch /var/lock/subsys/oracle
        fi;
        echo
        return $RETVAL
}
 
stop() {
        echo -n $"Stopping $prog: "
        if [ $UID -ne 0 ]; then
                RETVAL=1
                failure
        else
                su - $ORACLE -c "dbshut"
                RETVAL=$?
                if [ $RETVAL -eq 0 ]; then
                    su - $ORACLE -c "lsnrctl stop"
                    RETVAL=$?
                fi;               
                [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/oracle
        fi;
        echo
        return $RETVAL
}
 
restart(){
    stop
    start
}
 
case "$1" in
 start)
    start
    ;;
 stop)
    stop
    ;;
 restart)
    restart
    ;;
 status)
    status oracle
    RETVAL=$?
    ;;
 *)
    echo $"Usage: $0 {start|stop|status|restart}"
    RETVAL=1
esac
 
exit $RETVAL
 
安装 service:

[align=left]chmod 755 /etc/rc.d/init.d/oracle[/align]
[align=left]chkconfig --add oracle[/align]
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息