SUSE 9 SP3 環境安裝 Oracle 9.2.0.8 / 11.1.0.6,安裝完成後啟動監聽器與資料庫雙雙報錯:
LSNRCTL> start
...
Error listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oracle15)(PORT=1521)))
TNS-12545: Connect failed because target host or object does not exist
TNS-12560: TNS:protocol adapter error
TNS-00515: Connect failed because target host or object does not exist
IBM/AIX RISC System/6000 Error: 13: Permission denied
Listener failed to start.
SQL> startup
ORA-00000: normal, successful completion
SQL> shutdown immediate;
ORA-00000: normal, successful completion
Oracle 啟動過程需讀取 /etc/hosts 解析主機名,若該檔案缺乏執行權限(o+x),Oracle 進程(以 oracle 用戶身分)無法存取,導致主機名解析失敗,進而引發 TNS 協議適配器錯誤與資料庫實例掛載異常。
# 檢查當前權限
ls -l /etc/hosts
# -rw-r--r-- 1 root root 342 ... ← 缺乏 o+x
# 賦予其他用戶執行權限(關鍵)
chmod 755 /etc/hosts
# 或最小權限:chmod o+x /etc/hosts
# 驗證
ls -l /etc/hosts
# -rw-r--r-x 1 root root 342 ... ← 已有 o+x
# 重新啟動監聽器與資料庫
lsnrctl start
sqlplus / as sysdba
SQL> startup
/etc/hosts 為目錄項目,進程遍歷目錄樹解析路徑時,需對目錄擁有 x 權限;對檔案本身讀取需 r,但某些系統呼叫(如 gethostbyname 內部實作)在檢查檔案屬性時會檢測 x 位。Oracle 進程以非 root 用戶運行,屬於「其他」類別,故需 o+x。chmod 755 不會洩露內容(hosts 本質公開),僅允許遍歷與讀取,風險極低。/etc/resolv.conf、/etc/nsswitch.conf 等系統解析關鍵檔同樣需保證 o+r(必要時 o+x)。ping oracle15 解析正常tnsping ORCL 回傳 OKlsnrctl status 顯示 LISTENER 狀態 READYsqlplus / as sysdba 連線成功,startup 開啟資料庫無錯誤一個 chmod o+x /etc/hosts 解決了困擾多時的 Oracle 啟動連環錯誤。系統級關鍵配置檔權限缺失 是跨平台資料庫部署的隱形殺手,建議納入安裝前檢查清單(Pre-flight Checklist)。