oraclelinux自动启动
⑴ ORACLE如何在linux设置自动启动
1. 写一个启动脚本,比如名字叫dbora,放到/etc/rc.d/init.d,内容可以参考(注意相关环境变量要修改):
#!/bin/bash
#
# chkconfig: 345 60 50
# description: Oracle auto start-stop script.
# Modify the variables $ORA_HOME, $ORA_OWNER and $LOG as appropriate for each server.
# - Nabeel Moi
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
[ -r /etc/sysconfig/network ] && . /etc/sysconfig/network
# Modify the variables $ORA_HOME, $ORA_OWNER and $LOG as appropriate for each server.
# - Nabeel Moi
ORA_HOME=/u01/oracle/proct/10.2.0.1
ORA_OWNER=ora10g
LOG=$ORA_HOME/log/server/dbora/dbora.log
if [ ! -f $ORA_HOME/bin/dbstart -o ! -d $ORA_HOME ]
then
echo "Oracle startup: cannot start"
exit
fi
case "$1" in
start)
echo "$0: starting up" >> $LOG
# Start the Oracle databases:
su - $ORA_OWNER -c "$ORA_HOME/bin/dbstart &" >> $LOG
# Start Oracle listener
date >> $LOG
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start" >> $LOG 2>&1
touch /var/lock/subsys/dbora
echo "Refer to $LOG for details"
;;
stop)
echo "$0: stopping down" >> $LOG
date >> $LOG
# Stop Oracle Net
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop" >> $LOG 2>&1
# Stop the Oracle databases:
su - $ORA_OWNER -c "$ORA_HOME/bin/dbshut &" >> $LOG
rm -f /var/lock/subsys/dbora
;;
restart)
$0 stop
sleep 120
$0 start
;;
status)
if [ -f /var/lock/subsys/dbora ]; then
echo $0 started.
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl status"
else
echo $0 stopped.
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl status"
fi
;;
*)
echo "usage: dbora {start|stop|restart|status}"
exit 1
esac
exit 0
2. # chmod 755 /etc/rc.d/init.d/dbora
3. # chkconfig dbora on
4. 把 /etc/oratab中的N改为Y
⑵ linux下怎么让oracle自启动
写个脚本加进rc.local里脚本内容类似下面
ORACLE_BASE=xxxxx
ORACLE_HOME=XXXXX
ORACLE_SID=XXXXX
su
-
oracle
-c
sqlplus
XXXXX后面忘了嘿嘿自己查查帮助把命令补齐了就行了
⑶ linux下的oracle数据库怎么设置开机自启动
写一个脚本加入到/etc/rc.local里,比如: sh /etc/startora.sh /etc/startora.sh 内容如下(根据自己需要进行修改): su - oracle -c 'dbstart' 使用dbstart需要修改/etc/oratab文件最后一行,将N 改成Y orcl:/db/oracle/proct/11.2.0/db_1:Y
⑷ Linux如何设置Oracle实例和监听自启动
1.安装好Oracle数据库后: 执行 dbstart和dbshut会提示:
[oracle@oracle11g ~]$ dbstart
ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener
Usage: /u01/app/oracle/oracle/proct/10.2.0/db_1/bin/dbstart ORACLE_HOME
错误原因是:dbstart和dbshut脚本文件中ORACLE_HOME_LISTNER的设置有问题,分别打开两个文件找到:ORACLE_HOME_LISTNER=$1,修改为
ORACLE_HOME_LISTNER=$ORACLE_HOME,命令如下:
[oracle@oracle11g ~]$ vi $ORACLE_HOME/bin/dbstart
[oracle@oracle11g ~]$ vi $ORACLE_HOME/bin/dbshut
修改后保存退出,第一个问题已解决;
2.如何在Linux启动时自动启动Oracle监听和实例
首先要解决上面的问题,才能继续哟!
第一步:修改/etc/oratab文件,命令如下:
[oracle@oracle11g ~]$ vi /etc/oratab
找到:accp:/u01/oracle:N 修改为: accp:/u01/oracle:Y
第二步:把lsnrctl start和dbstart添加到rc.local文件中,命令如下:
[oracle@oracle11g ~]$ vi /etc/rc.d/rc.local
添加:
su oracle -lc "/u01/oracle/bin/lsnrctl start"
su oracle -lc /u01/oracle/bin/dbstart
注意:第一个命令有空格,所以要用引号的
重启试试吧!
转自ChinaUnix博客。
⑸ 如何在LINUX下启动ORACLE
手动启动:
用 oracle用户登录(或su - oracle)
lsnrctl start
sqlplus / as sysdba
startup
exit
自动启动,要编写一个启动脚本,用root用户拷到/etc/init.d下,取名叫oracle
然后, chkconfig oracle on,即可加入服务列表
/etc/init.d/oracle start #启动
/etc/init.d/oracle stop #停止
脚本的示例(里面的变量要按实际情况修改):
#!/bin/bash
#
# chkconfig: 345 99 01
# description: This is a program that is responsible for taking care of
# configuring the Oracle Database 11g Stardard/Enterprise Edition and its associated
# services.
#
# Source fuction library
if [ -f /lib/lsb/init-functions ]
then
. /lib/lsb/init-functions
elif [ -f /etc/init.d/functions ]
then
. /etc/init.d/functions
fi
# Set path if path not set (if called from /etc/rc)
case $PATH in
"") PATH=/bin:/usr/bin:/sbin:/etc
export PATH ;;
esac
# Save LD_LIBRARY_PATH
SAVE_LLP=$LD_LIBRARY_PATH
RETVAL=0
ORACLE_OWNER=oracle
ORACLE_OWNER_HOME=/opt/oracle
ORACLE_BASE=$ORACLE_OWNER_HOME/app/oracle
ORACLE_HOME=$ORACLE_BASE/proct/11.2.0/dbhome_1
ORACLE_SID=orcl
ORACLE_UNQNAME=$ORACLE_SID
LSNR=$ORACLE_HOME/bin/lsnrctl
SQLPLUS=$ORACLE_HOME/bin/sqlplus
STARTDB_SQL=$(mktemp /tmp/start.XXXXXX)
echo -e "startup;\nquit;\n" > $STRTDB_SQL
STOPDB_SQL=$(mktemp /tmp/stop.XXXXXX)
echo -e "shutdown immediate;\nquit;\n" > $STOPDB_SQL
SU=/bin/su
export ORACLE_HOME
export ORACLE_SID
export PATH=$ORACLE_HOME/bin:$PATH
LOG="$ORACLE_HOME_LISTNER/listener.log"
export LC_ALL=C
if [ $(id -u) != "0" ]
then
echo "You must be root to run the configure script. Login as root and then run the
configure script."
exit 1
fi
if [ -f /etc/redhat-release ]
then
. /etc/init.d/functions
init_status()
{
return 0
}
exit_status()
{
exit $?
}
success_status()
{
success
echo
}
failure_status()
{
failure $?
echo
}
elif [ -f /etc/SuSE-release ]
then
. /etc/rc.status
init_status()
{
rc_reset
}
success_status()
{
echo "OK"
return 0
}
failure_status()
{
echo "Failed"
return 1
}
exit_status()
{
exit $?
}
else
if [ -d /etc/default ]
then
CONFIGURATION="/etc/default/$CONFIG_NAME"
fi
init_status()
{
return 0
}
success_status()
{
echo "OK"
return 0
}
failure_status()
{
echo "Failed"
return 0
}
exit_status()
{
exit $?
}
fi
init_status
start() {
status=`ps -ef | grep tns | grep oracle`
if [ "$status" == "" ]
then
if [ -f $ORACLE_HOME/bin/tnslsnr ]
then
echo "Starting Oracle Net Listener."
$SU -s /bin/bash $ORACLE_OWNER -c "$LSNR start" # > /dev/null 2>&1
fi
fi
echo "Starting Oracle Database 11g Instance."
$SU -s /bin/bash $ORACLE_OWNER -c "$SQLPLUS -s /nolog @${STARTDB_SQL}" # > /dev/null 2>&1
RETVAL=$?
if [ $RETVAL -eq 0 ]
then
echo
else
echo Failed to start Oracle Net Listener using $ORACLE_HOME/bin/tnslsnr\
and Oracle Database using $ORACLE_HOME/bin/sqlplus.
RETVAL=1
return $RETVAL
fi
}
startconsole() {
$SU -s /bin/bash $ORACLE_OWNER -c "$ORACLE_HOME/bin/emctl start dbconsole &" # > /dev/null 2>&1
RETVAL=$?
return $RETVAL
}
stop() {
# Stop Oracle 11g Database and Listener
$SU -s /bin/bash $ORACLE_OWNER -c "$ORACLE_HOME/bin/emctl stop dbconsole &" # > /dev/null 2>&1
echo Shutting down Oracle Database 11g Instance.
$SU -s /bin/bash $ORACLE_OWNER -c "$SQLPLUS -s /nolog @${STOPDB_SQL}" # > /dev/null 2>&1
echo Stopping Oracle Net Listener.
$SU -s /bin/bash $ORACLE_OWNER -c "$LSNR stop" # > /dev/null 2>&1
RETVAL=$?
echo
if [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$LSNR
then
return $RETVAL
fi
}
stopconsole() {
# Stop Oracle 11g Database and Listener
$SU -s /bin/bash $ORACLE_OWNER -c "$ORACLE_HOME/bin/emctl stop dbconsole &" # > /dev/null 2>&1
RETVAL=$?
return $RETVAL
}
# See how we were called
case "$1" in
start)
start
;;
startconsole)
startconsole
;;
stop)
stop
;;
stopconsole)
stopconsole
;;
restart|reload|force-reload)
stop
start
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|restart|reload|force-reload}"
exit 1
esac
⑹ linux怎么设置oracle自动启动
工具:
win10
方法如下:
1、先点击桌面右下角的时间,然后点击日期和时间设置;
2、在日期和时间那一项找到格式,然后点击更改格式,看图;
3、按图示找到短时间设置和长时间设置;
4、设置完成,直接就生效了,在右下角看一眼,然后关闭就可以了。
⑺ 怎样在linux上配置oracle 11g 数据库开机自启动
root用户登陆
编辑/etc/init.d/oracle文件,输入以下内容(修改自己的ORACLE_BASE)
#!/bin/bash
# For RedHat and cousins:
# chkconfig: 2345 40 40
# description:
# processname:
# For SuSE and cousins
### BEGIN INIT INFO
# Provides: probe
# Required-Start: $syslog $remote_fs
# Should-Start: sendmail
# Required-Stop: $syslog $remote_fs
# Should-Stop: sendmail
# Default-Start: 2 3 5
# Default-Stop:
# Short-Description:
# Description:
# X-UnitedLinux-Default-Enabled: yes
### END INIT INFO
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=$ORACLE_BASE/oracle
export PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_USER=oracle
export ORACLE_SID=dbbha
# see how we are called:
case $1 in
start)
su - "$ORACLE_USER"<<EOO
lsnrctl start
sqlplus /nolog<<EOS
connect / as sysdba
startup
EOS
emctl start dbconsole
EOO
touch /var/lock/subsys/$scriptname
;;
stop)
su - "$ORACLE_USER"<<EOO
lsnrctl stop
sqlplus /nolog<<EOS
connect / as sysdba
shutdown immediate
EOS
emctl stop dbconsole
EOO
rm -f /var/lock/subsys/scriptname
;;
*)
echo "Usage: $0 {start|stop}"
;;
esac
设置oracle文件属性:
linux-udly:~ # chown root.root /etc/init.d/oracle
linux-udly:~ # chmod 755 /etc/init.d/oracle
linux-udly:~ #
配置oracle服务
linux-udly:~ # service oracle start (启动oracle服务)
linux-udly:~ # chkconfig oracle on (配置该服务系统重启后有效)
⑻ Linux怎么自动启动Oracle服务和ArcSDE服务
1:修改Oracle系统配置文件/etc/oratab
[root@localhost ~]# vi /etc/oratab
我们查看下面内容,如果安装好了Oracle,这个配置文件会自动将ORACLE_HOME标识清楚
但是默认为:orcl:/opt/oracle/proct/11.2.0/dbhome_1:N,我们只需要修改为Y如下所示即可
orcl:/opt/oracle/proct/11.2.0/dbhome_1:Y
2:编写服务脚本
我们可以首先创建一个Oracle配置文件,位置为:/etc/rc.d/init.d文件夹里面
然后进行编辑该文件
[root@localhost ~]# vi /etc/rc.d/init.d/oracle
将下面的信息填入即可
#!/bin/bash
#
#chkconfig:3459910
#description:
#/etc/rc.d/init.d/oradbstart
exportORACLE_BASE=/opt/oracle/
exportORACLE_HOME=/opt/oracle/proct/11.2.0/dbhome_1
exportORACLE_SID=orcl
exportSDEHOME=/home/arcsde/sdeexe100
exportPATH=$PATH:$ORACLE_HOME/bin:$SDEHOME/bin
case"$1"in
start)
echo"-----startuporacle-----">>/var/log/oracle11log
su-oracle-c$ORACLE_HOME/bin/dbstart
touch/var/lock/subsys/oracle11
echo"-----startuporaclesuccessful-----">>/var/log/oracle11log
echo"OK"su-arcsde-c"sdemon-ostart-psde"
;;
stop)
echo"-----shutdownoracle-----">>/var/log/oracle11log
su-oracle-c$ORACLE_HOME/bin/dbshut
rm-f/var/lock/subsys/oracle11
echo"-----shutdownoraclesuccessful-----">>/var/log/oracle11log
echo"OK"
;;
*)
echo"Usage:'basename$0'start|stop"
exit1
esac
exit0
exportORACLE_SID=orcl
exportPATH=$PATH:$ORACLE_HOME/bin
case"$1"in
start)
echo"-----startuporacle-----">>/var/log/oracle11log
su-oracle-c$ORACLE_HOME/bin/dbstart
touch/var/lock/subsys/oracle11
echo"-----startuporaclesuccessful-----">>/var/log/oracle11log
echo"OK"
;;
stop)
echo"-----shutdwnoracle-----">>/var/log/oracle11log
su-oracle-c$ORACLE_HOME/bin/dbshut
rm-f/var/lock/subsys/oracle11
echo"-----shutdownoraclesuccessful-----">>/var/log/oracle11log
echo"OK"
;;
*)
echo"Usage:'basename$0'start|stop"
exit1
esac
exit0
⑼ Linux下怎样自动启动oracle数据库服务
启动oracle数据库步骤: 首先使用oracle用户登录Linux,然后在shell命令行中执行下面的命令: 第一步:打开Oracle监听 $ lsnrctl start 第二步:进入sqlplus $ sqlplus /nolog SQL> 第三步:使用sysdab角色登录sqlplus SQL> conn /as sysdba
⑽ linux下怎么配置oracle开机自动启动脚本
说明:以下操作环境在CentOS 6.4 + Oracle 11gR2(Oracle安装在ORACLE_BASE=/opt/oracle中,其ORACLE_HOME=/opt/oracle/11g)
用OUI安装并配置Oracle数据库后,Oracle就开启了(包括:数据库实例、监听器、EM)。在重启操作系统之后,Oracle默认是没有启动的。使用如下命令查看Oracle相关服务是否已启动:
ps aux | grep ora_ #若无ora_**_**相关的进程,则oracle数据库实例未启动
netstat -tlnup | grep 1521 #若无任何显示,则监听器未启动
lsnrctl status #查看监听器状态
netstat -tlnup | grep 1158 #若无任何显示,则EM未启动
emctl status dbconsole #查看EM状态