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狀態