1問題描述:近日根據網上別人的相應腳本,在虛擬機上測試設置Oracle控制腳本的時候遇到如下問題:在創建了Oracle控制腳本后,執行
1問題描述:
近日根據網上別人的相應腳本,在虛擬機上測試設置Oracle控制腳本的時候遇到如下問題:
在創建了Oracle控制腳本后,執行如下啟動命令時報錯:
# services oracle9i stop
錯誤信息如下:
cat: /etc/oratab: 沒有那個文件或目錄
2錯誤分析
不使用創建的服務控制腳本執行Oracle數據庫的停止命令,而是直接使用Oracle的相關指令直接執行,,進行逐條檢查。
1) 關閉Oracle監聽
# su - oracle -c "/opt/ora9/product/9.2/bin/lsnrctl stop"
執行沒問題,正常通過。
2) 關閉Oracle數據庫
#su - oracle -c "/opt/ora9/product/9.2/bin/dbshut"
執行這條語句的時候出現上述錯誤,即“cat: /etc/oratab: 沒有那個文件或目錄”
進而,確定是執行指令dbshut 時引起錯誤。
3) 打開dbshut 指令查看,發現了引起錯誤的語句:
:
#
# $Header: dbshut.sh.pp 03-apr-2001.13:38:20 jboyce Exp $ dbshut.sh.pp Copyr (c) 1991 Oracle
#
###################################
#
# usage: dbshut
#
# This script is used to shutdown ORACLE from /etc/rc(.local).
# It should ONLY be executed as part of the system boot procedure.
#
#####################################
ORATAB=/etc/oratab
4) 查看相應的文件
# find /etc/oratab
find: /etc/oratab: 沒有那個文件或目錄
這個文件居然不存在,確定是由于該文件的丟失引起的原因。
5) 通過如下指令查看該文件是否在系統其它地方
# find / -name “oratab”
結果居然沒找到。
估計是當初安裝Oracle的遺留問題。
3 解決方案
由于該文件已經丟失,所以到另外一臺安裝了同樣版本的Oracle的服務器上查詢相應的文件,果然找到了相應的文件,內容如下:
#
# 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.
#
#
# *:/opt/ora9/product/9.2:N
# *:/opt/ora9/product/9.2:N
*:/opt/ora9/product/9.2:N
oracle:/opt/ora9/product/9.2:N
demo:/opt/ora9/product/9.2:N
下面的操作就簡單了,拷貝該服務器上的文件到相應的目錄即可。
注意:拷貝完以后一定記得要修改相應的內容。
P.S.
對于oratab文件的說明:
1.只在Linux環境中存在
2.設置格式::: 示例:oracle:/opt/ora9/product/9.2:N
3.可以為不同的數據庫設置相應的選項
4.如果想用$ORACLE_HOME/bin/dbstart腳本來啟動數據庫,則需要將/etc/oratab文件中相應的數據庫的項置為Y,
簡單的說即dbstart腳本根據oratab文件中的配置決定啟動哪幾個數據庫。
5.如果不使用dbstart腳本啟動數據庫,而是用自己的腳本來啟動,那么根本不用關心oratab文件。
聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com