CentOS Oracle測試運行使用root用戶修改
特別值得一提的是CentOS Oracle有很多值得學習的地方,這里我們主要介紹CentOS Oracle,包括介紹CentOS Oracle等方面。Linux : CentOS-5Oracle: 10.2.0.1.0設置 Linux 上Oracle 自動啟動 200807221、首先在/etc/rc.d/init.d/目錄下配置CentOS Oracle的服務文件。su - rootvi oracledb將***的附件腳本貼入chmod 775 oracledb
2、使用root用戶修改:[root@localhost init.d]# vi /etc/oratabcatlogdb:/oracle/product/10.2.0/db_1:Y 將***的N改為Y
3、使用CentOS Oracle用戶修改$ORACLE_HOME/bin/dbstart文件[root@localhost init.d]# su - oracle[oracle@localhost ~]$ cd $ORACLE_HOME/bin[oracle@localhost bin]$ vi dbstart找到 ORACLE_HOME_LISTNER 這行, 修改成:
ORACLE_HOME_LISTNER=/oracle/product/10.2.0/db_1或者直接修改成:ORACLE_HOME_LISTNER=$ORACLE_HOME
測試運行 dbshut, dbstart 看能否啟動CentOS Oracle 服務及l(fā)istener服務: [oracle@localhost bin]$ ps -ef|grep ora_[oracle@localhost bin]$ lsnrctl status
4、創(chuàng)建服務 chkconfig --add oracledbservice oracledb does not support chkconfig在腳本中以下兩行必須存在# chkconfig: 345 99 10# description: script for the Oracle Instance, Listener
[root@localhost ~]# chkconfig --list oracledb oracledb 0:off 1:off 2:off 3:on 4:on 5:on 6:off--附件oracledb 腳本
#!/bin/bash
#
# chkconfig: 345 99 10
# description: script for the Oracle Instance, Listener
# /etc/init.d/oracledb
#
export ORACLE_HOME=/oracle/product/10.2.0/db_1
export ORACLE_SID=catlogdb
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
echo -n "Starting Oracle: "
su $ORA_OWNR -c "$ORACLE_HOME/bin/dbstart"
su $ORA_OWNR -c "$ORACLE_HOME/bin/lsnrctl start"
touch /var/lock/oracle
su $ORA_OWNR -c $ORACLE_HOME/bin/emctl start dbconsole
echo "OK"
;;
stop)
# Oracle listener and instance shutdown
echo -n "Shutdown Oracle: "
su $ORA_OWNR -c "$ORACLE_HOME/bin/lsnrctl stop"
su $ORA_OWNR -c $ORACLE_HOME/bin/dbshut
rm -f /var/lock/oracle
su $ORA_OWNR -c $ORACLE_HOME/bin/emctl stop dbconsole
echo "OK"
;;
reload|restart)
$0 stop
$0 start
;;
****)
echo "Usage: `basename ` start|stop|restart|reload"
exit 1
esac
exit 0
CentOS Oracle備注說明# chkconfig: 345 99 10指出3,4,5級別啟動這個服務,99是在相應的/etc/rc.d/rcN.d(N為前面指定的級別,這里是345)目錄下生成的鏈接文件的序號(啟動優(yōu)先級別)S99oradbstart,10為在除前面指出的級別對應的/etc/rc.d/rcN.d(N為除345之外的級別)目錄生成的鏈接文件的序號(服務停止的優(yōu)先級別)K10oradbstart撤銷服務的話:chkconfig --del CentOS Oracledb
【編輯推薦】