Oracle自動(dòng)啟動(dòng)(解決了Failed to auto-start Oracle Net Listene和Message 1053 not found錯(cuò)誤)
執(zhí)行dbstart啟動(dòng)數(shù)據(jù)庫時(shí)報(bào)錯(cuò)
Failed to auto-start Oracle Net Listene using /ade/vikrkuma_new/oracle/bin/tnslsnr
看來是listener服務(wù)沒有起來,但是執(zhí)行l(wèi)snrctl start卻能啟動(dòng)listener服務(wù)。
搜索dbstart文件中的tnslsnr字符串
grep tnslsnr dbstart
返回結(jié)果:
if [ -f $ORACLE_HOME_LISTNER/bin/tnslsnr ] ; then
echo "Failed to auto-start Oracle Net Listene using $ORACLE_HOME_LISTNER/bin/tnslsnr"
看來可能是ORACLE_HOME_LISTNER環(huán)境變量引起的,查找 ORACLE_HOME_LISTNER
grep ORACLE_HOME_LISTNER dbstart
返回結(jié)果
# 3) Set ORACLE_HOME_LISTNER
ORACLE_HOME_LISTNER=/ade/vikrkuma_new/oracle
if [ ! $ORACLE_HOME_LISTNER ] ; then
echo "ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener"
LOG=$ORACLE_HOME_LISTNER/listener.log
if [ -f $ORACLE_HOME_LISTNER/bin/tnslsnr ] ; then
$ORACLE_HOME_LISTNER/bin/lsnrctl start >> $LOG 2>&1 &
export VER10LIST=`$ORACLE_HOME_LISTNER/bin/lsnrctl version | grep "LSNRCTL for " | cut -d' ' -f5 | cut -d'.' -f1`
echo "Failed to auto-start Oracle Net Listene using $ORACLE_HOME_LISTNER/bin/tnslsnr"
$LOGMSG "Restart Oracle Net Listener using an alternate ORACLE_HOME_LISTNER: lsnrctl start"
其中有一段給ORACLE_HOME_LISTNER環(huán)境變量賦值,但是這個(gè)路徑是不對(duì)的,編輯dbstart文件
vi dbstar
將該行改為export ORACLE_HOME_LISTNER=$ORACLE_HOME
保存退出,然后執(zhí)行dbstart就沒問題了。呵呵
想系統(tǒng)啟動(dòng)是自動(dòng)啟動(dòng)數(shù)據(jù)庫可以通過修改/etc/rc.d/rc.local文件
一開始我寫的命令是
su oracle -c ora_App/product/10.2.0/db_1/bin/lsnrctl start
su oracle -c ora_App/product/10.2.0/db_1/bin/dbstart
但是su oracle -c ora_App/product/10.2.0/db_1/bin/lsnrctl start是參數(shù)start不起作用,它進(jìn)入了lsnrctl命令提示符,并沒有啟動(dòng),后來把命令用雙引號(hào)引起來就可以了如下:
su oracle -c "ora_App/product/10.2.0/db_1/bin/lsnrctl start"
是可以啟動(dòng)了,但是啟動(dòng)時(shí)報(bào)錯(cuò)如下:
Message 1053 not found; No message file for product=network, facility=TNSTNS-12541: Message 12541 not found; No message file for product=network, facility=TNS
TNS-12560: Message 12560 not found; No message file for product=network, facility=TNS
但是如果我用oracle用戶登陸執(zhí)行l(wèi)snrctl start就不報(bào)錯(cuò),看來是在root用戶中執(zhí)行su oracle -c "ora_App/product/10.2.0/db_1/bin/lsnrctl start"有些Oracle環(huán)境變量沒有設(shè)置。查了一下su 命令的參數(shù),其中有個(gè)-l參數(shù)
-.-l或--login 改變身份時(shí),也同時(shí)變更工作目錄,以及HOME,SHELL,USER,LOGNAME。此外,也會(huì)變更PATH變量。
加上參數(shù)
su oracle -lc "ora_App/product/10.2.0/db_1/bin/lsnrctl start"
Failed to auto-start Oracle Net Listene using /ade/vikrkuma_new/oracle/bin/tnslsnr
看來是listener服務(wù)沒有起來,但是執(zhí)行l(wèi)snrctl start卻能啟動(dòng)listener服務(wù)。
搜索dbstart文件中的tnslsnr字符串
grep tnslsnr dbstart
返回結(jié)果:
if [ -f $ORACLE_HOME_LISTNER/bin/tnslsnr ] ; then
echo "Failed to auto-start Oracle Net Listene using $ORACLE_HOME_LISTNER/bin/tnslsnr"
看來可能是ORACLE_HOME_LISTNER環(huán)境變量引起的,查找 ORACLE_HOME_LISTNER
grep ORACLE_HOME_LISTNER dbstart
返回結(jié)果
# 3) Set ORACLE_HOME_LISTNER
ORACLE_HOME_LISTNER=/ade/vikrkuma_new/oracle
if [ ! $ORACLE_HOME_LISTNER ] ; then
echo "ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener"
LOG=$ORACLE_HOME_LISTNER/listener.log
if [ -f $ORACLE_HOME_LISTNER/bin/tnslsnr ] ; then
$ORACLE_HOME_LISTNER/bin/lsnrctl start >> $LOG 2>&1 &
export VER10LIST=`$ORACLE_HOME_LISTNER/bin/lsnrctl version | grep "LSNRCTL for " | cut -d' ' -f5 | cut -d'.' -f1`
echo "Failed to auto-start Oracle Net Listene using $ORACLE_HOME_LISTNER/bin/tnslsnr"
$LOGMSG "Restart Oracle Net Listener using an alternate ORACLE_HOME_LISTNER: lsnrctl start"
其中有一段給ORACLE_HOME_LISTNER環(huán)境變量賦值,但是這個(gè)路徑是不對(duì)的,編輯dbstart文件
vi dbstar
將該行改為export ORACLE_HOME_LISTNER=$ORACLE_HOME
保存退出,然后執(zhí)行dbstart就沒問題了。呵呵
想系統(tǒng)啟動(dòng)是自動(dòng)啟動(dòng)數(shù)據(jù)庫可以通過修改/etc/rc.d/rc.local文件
一開始我寫的命令是
su oracle -c ora_App/product/10.2.0/db_1/bin/lsnrctl start
su oracle -c ora_App/product/10.2.0/db_1/bin/dbstart
但是su oracle -c ora_App/product/10.2.0/db_1/bin/lsnrctl start是參數(shù)start不起作用,它進(jìn)入了lsnrctl命令提示符,并沒有啟動(dòng),后來把命令用雙引號(hào)引起來就可以了如下:
su oracle -c "ora_App/product/10.2.0/db_1/bin/lsnrctl start"
是可以啟動(dòng)了,但是啟動(dòng)時(shí)報(bào)錯(cuò)如下:
Message 1053 not found; No message file for product=network, facility=TNSTNS-12541: Message 12541 not found; No message file for product=network, facility=TNS
TNS-12560: Message 12560 not found; No message file for product=network, facility=TNS
但是如果我用oracle用戶登陸執(zhí)行l(wèi)snrctl start就不報(bào)錯(cuò),看來是在root用戶中執(zhí)行su oracle -c "ora_App/product/10.2.0/db_1/bin/lsnrctl start"有些Oracle環(huán)境變量沒有設(shè)置。查了一下su 命令的參數(shù),其中有個(gè)-l參數(shù)
-.-l或--login 改變身份時(shí),也同時(shí)變更工作目錄,以及HOME,SHELL,USER,LOGNAME。此外,也會(huì)變更PATH變量。
加上參數(shù)
su oracle -lc "ora_App/product/10.2.0/db_1/bin/lsnrctl start"
posted on 2011-10-11 16:44 嚕嚕 閱讀(6724) 評(píng)論(0) 編輯 收藏