最近在布置一個應用程序連接oracle后台數據庫,數據庫為oracle11g(11.2.0.2)。應用程序屬於root用戶,所以需要以root用戶通過系統認證的方式連接數據庫。設置了root用戶的環境變量並將root用戶加入了dba組中。但是在root用戶中啟動sqlplus連接數據庫一直報
ERROR:
----------------
ORA-12547: TNS:lost contact
起初以為是oracle_home目錄的權限不夠,給了最大的權限仍然報同樣的錯誤。在root用戶下通過網絡服務名可以連接成功就是通過系統認證一直不成功,說明我的環境變量沒有問題。通過一位朋友的幫助,查了oracle的maintant link。獲取如下信息:
Symptoms
- Not able to make a local connection.
- Getting the following error when trying to connect to scott/tiger
ERROR:
----------------
ORA-12547: TNS:lost contact
Cause
1. This could be due to kernel parameters settings
2. Incorrect permissions on the ORACLE executable
Solution
To implement the solution, please execute the following steps:
1.
This could be due to kernel parameters settings
Please check the notes below that provide the required settings for kernel parameters
Note 169706.1 Oracle Database on AIX,HP-UX,Linux,MacOSX,Solaris,Tru64
Note 201021.1 SOLARIS: Quick Start Guide - 9.2.0 RDBMS Installation
2.
This could be due to Incorrect permissions on the ORACLE.exe
The 'ls' command should show permissions 6751 (as follows)
Please check the following:
$ cd $ORACLE_HOME/bin
$ ls -l oracle
The output should be
-rwsr-s--x 1 oracle dba
If not then please execute the following
$ chmod 6751 oracle
Please also verify if the following are correct
echo $ORACLE_HOME
echo $ORACLE_SID
echo $LD_LIBRARY_PATH
echo $PATH
3.
If the above does not resolve I suggest that you shutdown the database and listener and then
"relink all"
Note 131321.1 How to Relink Oracle Database Software on UNIX
根據提示查看系統的配置,內核參數是按照官方的說明進行配置應該沒有問題可以排除。到第二個的時候發現$ORACLE_HOME/bin目錄下的oracle程序權限有問題,修改為文檔提示的權限后測試連接成功。原來是該腳本的權限不夠導致該錯誤報錯。