在oracle測試伺服器上還原恢複了一個資料庫後,啟動監聽服務時出現了tns-12541, tns-12560,tns-00511之類的錯誤,具體情況如下所示:
[oracle@getlnx01 admin]$ lsnrctl status
lsnrctl for linux: version 10.2.0.4.0 - production on 09-mar-2015 09:13:29
copyright (c) 1991, 2007, oracle. all rights reserved.
connecting to (description=(address=(protocol=ipc)(key=extproc1)))
tns-12541: tns:no listener
tns-12560: tns:protocol adapter error
tns-00511: no listener
linux error: 111: connection refused
connecting to (description=(address=(protocol=tcp)(host=getlnx01.esqule.com)(port=1521)))
[oracle@getlnx01 dbs]$ lsnrctl start
lsnrctl for linux: version 10.2.0.4.0 - production on 09-mar-2015 09:20:46
starting /u01/app/oracle/product/10.2.0/db_1/bin/tnslsnr: please wait...
tnslsnr for linux: version 10.2.0.4.0 - production
system parameter file is /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
log messages written to /u01/app/oracle/product/10.2.0/db_1/network/log/listener.log
listening on: (description=(address=(protocol=ipc)(key=extproc1)))
listening on: (description=(address=(protocol=tcp)(host=getlnx01.esqule.com)(port=1521)))
tns-12547: tns:lost contact
tns-00517: lost contact
linux error: 104: connection reset by peer
因為曾經遇到并解決過tns-12541這類錯誤,立即檢查/etc/hosts檔案,結果發現ip位址寫錯了,正确的ip位址應該為192.168.7.221,而不是粗心手誤寫錯的192.168.7.211
<b></b>
<b>cause</b>
<b></b>
1. there is possibly an incorrect ip address specified for the host in the /etc/hosts file.
for example:
192.168.101.101 prod1.us.oracle.com prod1
whereas the actual ip address for the host "prod1.us.oracle.com" is 192.168.101.110
2. also, the localhost reference may be incorrect or missing from the /etc/hosts file.
3. oracle may not have read access to /etc/nsswitch.conf file.
<b>solution</b>
to implement the solution, please execute the following steps:
1. correct the mapping
in the /etc/hosts file by adding/correcting the ip address and/or
hostname reference for the unix/linux server (both long and short host
names).
# add or edit the /etc/hosts file to include a valid entry for the server:
192.168.101.110 prod1.us.oracle.com prod1
2. check that the localhost loopback name and address are correct (both long and short host names).
an example of a correct localhost entry would be as follows:
127.0.0.1 localhost.localdomain localhost
3. remember to save the /etc/hosts file and then start the listener.
4. check permissions on /etc/nsswitch.conf file to ensure group and other have read access.
- if necessary change permisions on /etc/nsswitch.conf as follows:
chmod 644 /etc/nsswitch.conf