当我用lsnrctl status 查询db port status 时,发现:
[oracle@test admin]$ lsnrctl status testdb
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 06-AUG-2009 01:27:27
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(SID_NAME=testdb)(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROCTEST)))
STATUS of the LISTENER
------------------------
Alias testdb
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 05-AUG-2009 05:49:53
Uptime 0 days 19 hr. 37 min. 33 sec
Trace Level offSecurity ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/oracle/product/10.2.0/db_3/network/admin/listener.ora
Listener Log File /u01/app/oracle/oracle/product/10.2.0/db_3/network/log/testdb.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROCTEST))(SID_NAME=testdb))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1666))(SID_NAME=testdb))
The listener supports no services
The command completed successfully
[oracle@test admin]$ tail -15 sqlnet.logFatal NI connect error 12514, connecting to:
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1666))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=testdb)(CID=())))
VERSION INFORMATION:
TNS for Linux: Version 10.2.0.1.0 - Production
TCP/IP NT Protocol Adapter for Linux: Version 10.2.0.1.0 - Production
Time: 05-AUG-2009 05:07:10
Tracing not turned on.-------> how to turn on this tracing?----------------- Tns error struct: |
ns main err code: 12564 |
TNS-12564: TNS:connection refused |
ns secondary err code: 0 |
nt main err code: 0 |
nt secondary err code: 0 |
nt OS err code: 0
|
------->方法是:vi sqlnet.ora 添加以下红色部分的配置:
[oracle@test admin]$ cat sqlnet.ora # sqlnet.ora Network Configuration File: /u01/app/oracle/oracle/product/10.2.0/db_3/network/admin/sqlnet.ora
# Generated by Oracle configuration tools.
NAMES.DIRECTORY_PATH= (TNSNAMES,hostname)trace_level_client=16
trace_timestamp_client=true
trace_unique_client=on
trace_level_client 这个参数Indicates the level at which the client program is to be traced.
# Available Values:
# 0 or OFF - No Trace output
# 4 or USER - User trace information
# 10 or ADMIN - Administration trace information
# 16 or SUPPORT - Worldwide Customer Support trace information
###########################
#trace_unique_client = ON
###########################
#
#Possible values: {ON, OFF}
#Default: OFF
#
#Purpose: Used to make each client trace file have a unique name to
# prevent each trace file from being overwritten by successive
# runs of the client program
你再次查看sqlnet.log:
[ admin]$ tail -15 sqlnet.log
Fatal NI connect error 12505, connecting to:
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1666))(CONNECT_DATA=(SERVER=DEDICATED)(SID=testdb)(CID=())))
VERSION INFORMATION:
TNS for Linux: Version 10.2.0.1.0 - Production
TCP/IP NT Protocol Adapter for Linux: Version 10.2.0.1.0 - Production
Time: 06-AUG-2009 02:45:00
Tracing to file: /u01/app/oracle/oracle/product/10.2.0/db_3/network/admin/cli_1861.trc Tns error struct:
ns main err code: 12564
TNS-12564: TNS:connection refused
ns secondary err code: 0
nt main err code: 0
nt secondary err code: 0
nt OS err code: 0
或许trace log会对你分析问题提供一些线索。
值得注意的是,每当你连一次DB,就会产生一个trace log file,所以,当你找到并解决问题会,可以将tracing log 关掉,不然会产生很多的log file.