linuxoracle開機啟動
Ⅰ 如何在linux中設置開機自動啟動oracle
對於LINUX 操作系統 有很多技術知識是我們需要學習的。這里我就給大家介紹Linux中設置oracle開機自動啟動的 方法 。一起來看看吧。
Linux中設置oracle開機自動啟動的方法
在terminal中切換到root用戶
查看/etc/oratab文件的內容,其內容如下
[root@golonglee ~]# cat /etc/oratab | grep -v ^$
#
# This file is used by ORACLE utilities. It is created by root.sh
# and updated by the Database Configuration Assistant when creating
# a database.
# A colon, ':', is used as the field terminator. A new line terminates
# the entry. Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
# $ORACLE_SID:$ORACLE_HOME::
#
# The first and second fields are the system identifier and home
# directory of the database respectively. The third filed indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
oel63:/home/oracle/app/oracle/proct/11.2.0/dbhome_1:N
使用命令vi /etc/oratab編輯文件/etc/oratab,在最後添加如下內容
##### what I have written is as following
oel63:/home/oracle/app/oracle/proct/11.2.0/dbhome_1:Y
#####Finished wrote in 2015-12-24
說明:/home/oracle/app/oracle/proct/11.2.0/dbhome_1為oracle的安裝目錄,要根據實際情況進行修改。
(注意:圖中我用紅色標記的N要改成Y)
找到最後的內容
oel63:/home/oracle/app/oracle/proct/11.2.0/dbhome_1:N
復制該行oel63:/home/oracle/app/oracle/proct/11.2.0/dbhome_1:N並注釋掉
粘貼該行,並將該行
oel63:/home/oracle/app/oracle/proct/11.2.0/dbhome_1:N最後的N
改為Y
最後按2次ESC鍵,並輸入:wq並按下enter保存,退出
使用命令vi /etc/rc.d/rc.local編輯rc.local文件,添加如下內容
##### what I have written is as following
su oracle -lc "/home/oracle/app/oracle/proct/11.2.0/dbhome_1/bin/lsnrctl start"
su oracle -lc /home/oracle/app/oracle/proct/11.2.0/dbhome_1/bin/dbstart
#####Finished wrote in 2015-12-24
說明:因為第一行命令中有空格所以用雙引號(英文的雙引號)
/home/oracle/app/oracle/proct/11.2.0/dbhome_1為oracle的安裝目錄,要根據實際情況進行修改。
最後按2次ESC鍵,並輸入:wq並按下enter保存,退出,重啟機器,驗證成功。
是不是很簡單呢~快跟著我一起學習吧!!!如果覺得這篇 文章 不錯的話就給我點一個贊吧。
Ⅱ 如何在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實例,怎樣設置開機默認啟動第二個
環境變數ORACLE_SID設成db1,再啟動就行了
啟動腳本里再寫一遍,跟第一個啟動是一樣的
Ⅳ 怎樣在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資料庫
啟動oracle資料庫步驟:
首先使用oracle用戶登錄Linux,然後在shell命令行中執行下面的命令:
第一步:打開Oracle監聽
$ lsnrctl start
第二步:進入sqlplus
$ sqlplus /nolog
SQL>
第三步:使用sysdab角色登錄sqlplus
SQL> conn /as sysdba
第四步:啟動資料庫
SQL> startup
經過上面的四個步驟,oracle資料庫就可以啟動了。
關閉資料庫用 shutdown 是要等待事物結束才關閉,強制關閉用 shutdown abort。
Ⅵ 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
Linux下oracle資料庫啟動和關閉操作
第一步:登陸
root登陸之後切換到oracle用戶上,輸入
su oracle
第二步:連接
在oracle用戶下,輸入
sqlplus /nolog
第三步:使用管理員許可權
輸入
connect /as sysdba
第四步:啟動/關閉服務
輸入
startup
startup參數
不帶參數,啟動資料庫實例並打開資料庫,以便用戶使用資料庫,在多數情況下,使用這種方式!
nomount,只啟動資料庫實例,但不打開資料庫,在你希望創建一個新的資料庫時使用,或者在你需要這樣的時候使用!
mount,在進行資料庫更名的時候採用。這個時候資料庫就打開並可以使用了!
謝謝!不準確的地方請指教!
shutdown
shutdown的參數
Normal 需要等待所有的用戶斷開連接
Immediate 等待用戶完成當前的語句
Transactional 等待用戶完成當前的事務
Abort 不做任何等待,直接關閉資料庫
normal需要在所有連接用戶斷開後才執行關閉資料庫任務,所以有的時候看起來好象命令沒有運行一樣!在執行這個命令後不允許新的連接
immediate在用戶執行完正在執行的語句後就斷開用戶連接,並不允許新用戶連接。
transactional 在擁護執行完當前事物後斷開連接,並不允許新的用戶連接資料庫。
abort 執行強行斷開連接並直接關閉資料庫。
第五步:如果是啟動服務,要開啟監聽
退出sqlplus模式,輸入
lsnrctl start
Ⅷ linux伺服器重啟了,怎麼啟動oracle資料庫
重啟之後如果你設置了oracle的啟動批處理直接運行sh文件就可以了。沒有就按啟動的步驟一步步來吧
Ⅸ 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
Ⅹ oracleLinux開機啟動提示kernel panic 重啟添加enforcing=0還是不行要怎麼解決
內核升級混亂,不用怕,使用以前老版本內核再啟動就行了
如果你是使用的系統自帶的升級內核的工具的話,那麼在啟動欄里找到以前老的版本內核來啟動即可
如果你是編譯內核,然後啟動之後再出現這個問題的話,也不要緊,同樣在啟動欄里使用e或者c來載入老內核即可
不過前面這些操作的前提是,你的老內核沒有被你刪除
如果刪除了,那就只能重裝了,其實還有一個另類的辦法來搶救,太麻煩了,不想寫了