本文共 1643 字,大约阅读时间需要 5 分钟。
- 设置oracle用户变量。
[oracle@db01 ~]$ vi /etc/oratab# end line: changedb01:/oracle/app/product/11.2.0/db_1:Y[oracle@db01 ~]$ vi ~/.bash_profile# add follows to the endexport ORACLE_SID=db01
- 以root身份创建init文件。
[root@db01 ~]# vi /etc/rc.d/init.d/oracle# it's an example, edit it you like.#!/bin/bash# oracle: Start/Stop Oracle Database 11g R2## chkconfig: 345 90 10# description: The Oracle Database is an Object-Relational Database Management System.## processname: oracle. /etc/rc.d/init.d/functionsLOCKFILE=/var/lock/subsys/oracleORACLE_HOME=/oracle/app/product/11.2.0/db_1ORACLE_USER=oraclecase "$1" in'start') if [ -f $LOCKFILE ]; then echo $0 already running. exit 1 fi echo -n $"Starting Oracle Database:" su - $ORACLE_USER -c "$ORACLE_HOME/bin/lsnrctl start" su - $ORACLE_USER -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME" su - $ORACLE_USER -c "$ORACLE_HOME/bin/emctl start dbconsole" touch $LOCKFILE ;;'stop') if [ ! -f $LOCKFILE ]; then echo $0 already stopping. exit 1 fi echo -n $"Stopping Oracle Database:" su - $ORACLE_USER -c "$ORACLE_HOME/bin/lsnrctl stop" su - $ORACLE_USER -c "$ORACLE_HOME/bin/dbshut" su - $ORACLE_USER -c "$ORACLE_HOME/bin/emctl stop dbconsole" rm -f $LOCKFILE ;;'restart') $0 stop $0 start ;;'status') if [ -f $LOCKFILE ]; then echo $0 started. else echo $0 stopped. fi ;;*) echo "Usage: $0 [start|stop|status]" exit 1esacexit 0[root@db01 ~]# chmod 755 /etc/rc.d/init.d/oracle[root@db01 ~]# chkconfig --add oracle[root@db01 ~]# chkconfig oracle on
转载于:https://www.cnblogs.com/MagicLetters/p/4382879.html