CentOS 5.10安装Oracle 11G R2(2)


cd /data/software
unzip linux_11gR2_database_1of2.zip
unzip linux_11gR2_database_2of2.zip
xhost +   (这里使用root用户执行,一定要执行以下2步,如果没有执行,将无法启动图形安装界面)
xhost + localhost
su - oralce
cd /opt/software/database
$./runInstaller  #(到oracle安装文件所在目录执行该命令)

安装过程省略

12.开机启动设置
#自动启动和关闭数据库实例和监听
vi /opt/oracle/product/11.2.0/db_1/bin/dbstart
ORACLE_HOME_LISTNER=$1
#修改为:
ORACLE_HOME_LISTNER=$ORACLE_HOME

vi /opt/oracle/product/11.2.0/db_1/bin/dbshut
ORACLE_HOME_LISTNER=$1
#修改为:
ORACLE_HOME_LISTNER=$ORACLE_HOME

vi /etc/init.d/oracle
#!/bin/sh
# chkconfig: 345 61 61
# description: Oracle 11g AutoRun Services
# /etc/init.d/oracle
#
# Run-level Startup script for the Oracle Instance, Listener, and
# Web Interface

export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export ORACLE_SID=luke
export PATH=$PATH:$ORACLE_HOME/bin
ORA_OWNR="oracle"

# if the executables do not exist -- display error


if [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ]
then
    echo "Oracle startup: cannot start"
    exit 1
fi

# depending on parameter -- startup, shutdown, restart
# of the instance and listener or usage display

case "$1" in
start)
    # Oracle listener and instance startup
    su $ORA_OWNR -lc $ORACLE_HOME/bin/dbstart
    echo "Oracle Start Succesful!OK."
    ;;
stop)
    # Oracle listener and instance shutdown
    su $ORA_OWNR -lc $ORACLE_HOME/bin/dbshut
    echo "Oracle Stop Succesful!OK."
    ;;
reload|restart)
    $0 stop
    $0 start
    ;;
*)
    echo $"Usage: `basename $0` {start|stop|reload|reload}"
    exit 1
esac
exit 0

chmod 750 /etc/init.d/oracle

chkconfig --level 345 oracle on
chkconfig --add oracle

#启动oracle
service oracle start

自动启动和关闭 EM
vi /etc/init.d/oraemctl
#!/bin/sh
# chkconfig: 345 61 61
# description: Oracle 11g AutoRun Services
# /etc/init.d/oraemctl
#
# Run-level Startup script for the Oracle Instance, Listener, and
# Web Interface

export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export ORACLE_SID=luke
export PATH=$PATH:$ORACLE_HOME/bin
ORA_OWNR="oracle"

case "$1" in
start)
echo -n $"Starting Oracle EM DB Console:"
su - $ORA_OWNR -c "$ORACLE_HOME/bin/emctl start dbconsole"
echo "OK"
;;
stop)
echo -n $"Stopping Oracle EM DB Console:"
su - $ORA_OWNR -c "$ORACLE_HOME/bin/emctl stop dbconsole"
echo "OK"
;;
*)
echo $"Usage: $0 {start|stop}"
esac

chmod 750 /etc/init.d/oraemctl
#启动EM
service oraemctl start

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/01d4cd880ae938dcfea9e7de27edcf03.html