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/liste1.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oel1.oracle.com)(PORT=1521)))
Listener failed to start. See the error message(s) above...
我试了一下,故意把address后面的右括号放到了下一行,然后顶格。
LISTE1=
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=tcp)(HOST=oel1.oracle.com)(PORT=1521)
)
)
)
启动监听的时候还是报错,这次貌似指向的错误信息更明确了。
LSNRCTL> start liste1
Starting /u01/app/oracle/product/10.2.0/db_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 10.2.0.1.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/liste1.log
TNS-01150: The address of the specified listener name is incorrect
Listener failed to start. See the error message(s) above...
改成如下的形式,监听马上好了。
LISTE1=
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=tcp)(HOST=oel1.oracle.com)(PORT=1521)
)
)
)
案例四
Listener.ora的情况在tnsnames.ora里也是一样的情况,不过报错是ORA的错误,有一个好处是都是ORA-12154错误。
PROD=
(DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)(HOST=oel1.oracle.com)(PORT=1521))
(ADDRESS=(PROTOCOL=tcp)(HOST=oel1.oracle.com)(PORT=1525))
(CONNECT_DATA=(SERVICE_NAME=PROD)
)
)
[oracle@oel1 admin]$ sqlplus system/oracle@PROD
SQL*Plus: Release 10.2.0.1.0 - Production on Sun Dec 1 16:55:03 2013
Copyright (c) 1982, 2005, Oracle. All rights reserved.
ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified
案例五
多加一个空格,报错也是ora-12154
PROD=
(DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)(HOST=oel1.oracle.com)(PORT=1521))
(ADDRESS=(PROTOCOL=tcp)(HOST=oel1.oracle.com)(PORT=1525))
(CONNECT_DATA=(SERVICE_NAME=PROD))
)
[oracle@oel1 admin]$ sqlplus system/oracle@PROD
SQL*Plus: Release 10.2.0.1.0 - Production on Sun Dec 1 17:28:47 2013
Copyright (c) 1982, 2005, Oracle. All rights reserved.
ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified
成功例子
最后贴出能够正确识别的Listener.ora和tnsnames.ora (格式当然不是很好)
listener.ora
LISTE1=
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=tcp)(HOST=oel1.oracle.com)(PORT=1521)
)
)
)
SID_LIST_LISTE1=
(SID_LIST=
(SID_DESC=
(GLOBAL_DBNAME=PROD)
(ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1)
(SID_NAME=PROD)
)
)
tnsnames.ora
PROD=
(DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)(HOST=oel1.oracle.com)(PORT=1521))
(ADDRESS=(PROTOCOL=tcp)(HOST=oel1.oracle.com)(PORT=1525))
(CONNECT_DATA=(SERVICE_NAME=PROD))
)
来一个成功连接的例子收尾:
[oracle@oel1 admin]$ sqlplus system/oracle@PROD
SQL*Plus: Release 10.2.0.1.0 - Production on Sun Dec 1 17:00:46 2013
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options