今天尝试手工编写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/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/18841027/viewspace-1059866/