手工配置listener.ora檔案及TNS-01201錯誤

kuqlan發表於2012-12-06


今天嘗試手工編寫listener.ora檔案,結果遇到了如下錯誤:
TNS-01201: Listener cannot find executable /u01/app/oracle/OracleHome/db10g/bin/extproc2 for SID PLSExtProc
改了幾次好容易才找到原因,雖然原因很簡單,但是關於listener.ora及tnsnames.ora在內的檔案有幾個簡單的語法需要注意,這個在官方文件上也有類此解釋。


[oracle@ocm1 admin]$ vi listener.ora

LISTENER =
  (DESCRIPTION =
   (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = ocm1)(PORT = 1521))
    (ADDRESS=(PROTOCOL=ipc)(KEY=extproc))
   )
  )


SID_LIST_LISTENER =
  (SID_LIST =
   (SID_DESC =
    (SID_NAME = PLSExtProc)
    (ORACLE_HOME = /u01/app/oracle/OracleHome/db10g)
    (PROGRAM = extproc2)
   )
  )

[@more@]

~當啟動監聽時:
~[oracle@ocm1 admin]$ lsnrctl start

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 06-DEC-2012 07:39:02

Copyright (c) 1991, 2005, Oracle. All rights reserved.

Starting /u01/app/oracle/OracleHome/db10g/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 10.2.0.1.0 - Production
System parameter file is /u01/app/oracle/OracleHome/db10g/network/admin/listener.ora
Log messages written to /u01/app/oracle/OracleHome/db10g/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ocm1)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=extproc)))
TNS-01201: Listener cannot find executable /u01/app/oracle/OracleHome/db10g/bin/extproc2 for SID PLSExtProc

Listener failed to start. See the error message(s) above...

改了幾次好容易才找到原因,雖然原因很簡單,但是關於listener.ora及tnsnames.ora在內的檔案有幾個簡單的語法需要注意,這個在官方文件上也有類此解釋。
尤其是Oracle? Database Net Services Reference的Part II Configuration Parameters章節的相關內容值得看一遍。
其中第三章的如下內容已經講述了最基本但是很重要的語法:
Configuration File Syntax OverviewThe Oracle Net Services configuration files consist of parameters which include keyword-value pairs. Keyword-value pairs are surrounded by parentheses:

parameter=(keyword=value)

Some keywords have other keyword-value pairs as their values:
(keyword=
(keyword=value)
(keyword=value))

For example, the address portion of a local naming configuration file (tnsnames.ora) might include the following lines:

(ADDRESS=
(PROTOCOL=tcp)
(HOST=sales-server)
(PORT=1521))
Set up configuration files so that indentation reflects what keyword is the parent or owner of other keyword-value pairs.
Even if you do not choose to indent your files in this way, you must indent a wrapped line by at least one space, or it will be misread as a new parameter. The following layout is acceptable:
(ADDRESS=(PROTOCOL=tcp)
(HOST=sales-server)(PORT=1521))

The following layout is not acceptable:

(ADDRESS=(PROTOCOL=tcp)
(HOST=sales-server)(PORT=1521))

最終將完整的listener.ora檔案內容作為備忘記錄到這兒:
動態監聽時:


LISTENER =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = ocm1)(PORT = 1521))
(ADDRESS=(PROTOCOL=ipc)(KEY=extproc))
)
)

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/app/oracle/OracleHome/db10g)
(PROGRAM=extproc)
)
)


靜態監聽時(建設sid為PROD):
~
LISTENER =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = ocm1)(PORT = 1521))
(ADDRESS=(PROTOCOL=ipc)(KEY=extproc))
)
)

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/app/oracle/OracleHome/db10g)
(PROGRAM=extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = PROD)
(ORACLE_HOME = /u01/app/oracle/OracleHome/db10g)
(SID_NAME=PROD)
)
)
~
~
~

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/18841027/viewspace-1059866/,如需轉載,請註明出處,否則將追究法律責任。

相關文章