万急啊!oracle10g中tnsping出现TNS-03505:无法解析名称

chenjian361 2010-12-15 12:36:45
我已创建数据库实例test 能进入sqlplus ,scott/tiger@172.20.2.20:1521/test也能连接。但我在dos下
tnsping test 时
出现了以下错误信息:
C:\>tnsping test

TNS Ping Utility for 32-bit Windows: Version 10.2.0.1.0 - Production on 15-12月-2010 00:27:16

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

已使用的参数文件:
f:\oracle\product\10.2.0\db_1\network\admin\sqlnet.ora

TNS-03505: 无法解析名称
还有啊 我用PL/SQL Developer时也出现了“ora-12154: tns: 无法解析指定的连接标识符”。
另外,我用的是oracle10g10.2.0,在F:\oracle\product\10.2.0\db_1\NETWORK\ADMIN目录下只有sqlnet.ora一个文件,里面是:
# This file is actually generated by netca. But if customers choose to
# install "Software Only", this file wont exist and without the native
# authentication, they will not be able to connect to the database on NT.
SQLNET.AUTHENTICATION_SERVICES = (NTS)

而在F:\oracle\product\10.2.0\db_1\NETWORK\ADMIN\SAMPLE里面却有LISTENER.ORA、SQLNET.ORA和TNSNAMES.ORA三个文件

F:\oracle\product\10.2.0\db_1\NETWORK\ADMIN\SAMPLE\TNSNAMES.ORA文件内容如下:
<alias>= [ (DESCRIPTION_LIST = # Optional depending on whether u have
# one or more descriptions
# If there is just one description, unnecessary ]
(DESCRIPTION=
[ (SDU=2048) ] # Optional, defaults to 2048
# Can take values between 512 and 32K
[ (ADDRESS_LIST= # Optional depending on whether u have
# one or more addresses
# If there is just one address, unnecessary ]
(ADDRESS=
[ (COMMUNITY=<community_name>) ]
(PROTOCOL=tcp)
(HOST=<hostname>)
(PORT=<portnumber (1521 is a standard port used)>)
)
[ (ADDRESS=
(PROTOCOL=ipc)
(KEY=<ipckey (PNPKEY is a standard key used)>)
)
]
[ (ADDRESS=
[ (COMMUNITY=<community_name>) ]
(PROTOCOL=decnet)
(NODE=<nodename>)
(OBJECT=<objectname>)
)
]
... # More addresses
[ ) ] # Optional depending on whether ADDRESS_LIST is used or not
[ (CONNECT_DATA=
(SID=<oracle_sid>)
[ (GLOBAL_NAME=<global_database_name>) ]
)
]
[ (SOURCE_ROUTE=yes) ]
)
(DESCRIPTION=
[ (SDU=2048) ] # Optional, defaults to 2048
# Can take values between 512 and 32K
[ (ADDRESS_LIST= ] # Optional depending on whether u have more
# than one address or not
# If there is just one address, unnecessary
(ADDRESS
[ (COMMUNITY=<community_name>) ]
(PROTOCOL=tcp)
(HOST=<hostname>)
(PORT=<portnumber (1521 is a standard port used)>)
)
[ (ADDRESS=
(PROTOCOL=ipc)
(KEY=<ipckey (PNPKEY is a standard key used)>)
)
]
... # More addresses
[ ) ] # Optional depending on whether ADDRESS_LIST
# is being used
[ (CONNECT_DATA=
(SID=<oracle_sid>)
[ (GLOBAL_NAME=<global_database_name>) ]
)
]
[ (SOURCE_ROUTE=yes) ]
)
[ (CONNECT_DATA=
(SID=<oracle_sid>)
[ (GLOBAL_NAME=<global_database_name>) ]
)
]
... # More descriptions
[ ) ] # Optional depending on whether DESCRIPTION_LIST is used or not

...全文
1399 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
sally-wang 2011-04-20
  • 打赏
  • 举报
回复
我的怎么这些都配了也不行啊。
chenjian361 2010-12-16
  • 打赏
  • 举报
回复
问题终于解决了啊。原来创建数据库的时候是没有创建监听器(貌似是自带有的 在命令行上输入 lsnrctl start 就可以启动,如果真没有,必须得自己配置一个了。不过默认的在netmgr中没看着,无奈了)和服务名。要自己手动去添加。这样就行了……然后就有了LISTENER.ORA和TNSNAMES.ORA这两个文件,一切OK
chenjian361 2010-12-15
  • 打赏
  • 举报
回复
# MODIFIED
# ajacobs 09/09/03 - Fix wallet_location parameter
# ajacobs 01/20/03 - CyberSafe desupport
# ajacobs 09/17/02 - remove crypto_seed
# cozhang 03/07/02 - Change connect_time to inbound_connect_time.
# mhho 01/15/02 - update sample with new parameter changes
# cozhang 12/04/01 - Add params for DoS timout handling
# ajacobs 10/23/00 - Remove identix, securid
# ajacobs 09/07/00 - Update for Oracle Advanced Security encryption/integ
# tclarke 05/26/00 - bug 515765
# jtran 03/24/98 - add radius configuration
# skanjila 06/06/97 - Correct default for Automatic_IPC
# eminer 05/15/97 - Add the relevant onrsd parameters.
# asriniva 04/23/97 - Merge with version from doc
# ggilchri 03/31/97 - mods
# bvasudev 02/07/97 - Change sqlnet.authentication_services documentation
# bvasudev 11/25/96 - Merge sqlnet.ora transport related parameters
# asriniva 11/12/96 - Revise with new OSS parameters.
# asriniva 11/05/96 - Add ANO parameters.
# ____________________________________________________________________

# - ONames Client ----------------------------------------------------
#
#names.default_domain = world
#
#Syntax: domain-name
#Default: NULL
#
# Indicates the domain from which the client most often requests names. When
# this parameter is set the default domain name (for example, US.ACME), the
# domain name will be automatically appended to any unqualified name in an
# ONAmes request (query, register, deregister, etc). Any name which contains
# an unescaped dot ('.') will not have the default domain appended. Simple
# names may be qualified with a trailing dot (for example 'rootserver.').
#
#
#names.initial_retry_timeout = 30
#
#Syntax: 1-600 seconds
#Default: 15 (OSD)
#
# Determines how long a client will wait for a response from a Names Server
# before reiterating the request to the next server in the preferred_servers
# list.
#
#
#names.max_open_connections = 3
#
#Syntax: 3-64
#Default: ADDRS in preferred_servers
#
# Determines how many connections an ONames client may have open at one time.
# Clients will ordinarily keep connections to servers open once they are
# established until the operation (or session in namesctl) is complete. A
# connection will be opened whenever needed, and if the maximum would be
# exceeded the least recently used connection will be closed.
#
#
#names.message_pool_start_size = 10
#
#Syntax: 3-256
#Default: 10
#
# Determines the initial number of messages allocated in the client's message
# pool. This pool provides the client with pre-allocated messages to be used
# for requests to ONames servers. Messages which are in the pool and unused
# may be reused. If a message is needed and no free messages are available in
# the pool more will be allocated.
#
#
#names.preferred_servers = (address_list =
# (address=(protocol=ipc)(key=n23))
# (address=(protocol=tcp)(host=nineva)(port=1383))
# (address=(protocol=tcp)(host=cicada)(port=1575))
# )
#
#Syntax: ADDR_LIST
#Default: Well-Known (OSD)
#
# Specifies a list of ONames servers in the client's region; requests will be
# sent to each ADDRESS in the list until a response is recieved, or the list
# (and number of retries) is exhausted.
#
# Addresses of the following form specify that messages to the ONames server
# should use Oracle Remote Operations (RPC):
#
# (description =
# (address=(protocol=tcp)(host=nineva)(port=1383))
# (connect_data=(rpc=on))
# )
#
#
#
#names.request_retries = 2
#
#Syntax: 1-5
#Default: 1
#
# Specifies the number of times the client should try each server in the list
# of preferred_servers before allowing the operation to fail.
#
#
#names.directory_path
#
#Syntax: <adapter-name>
#Default: TNSNAMES,ONAMES,HOSTNAME
#
# Sets the (ordered) list of naming adaptors to use in resolving a name.
# The default is as shown for 3.0.2 of sqlnet onwards. The default was
# (TNSNAMES, ONAMES) before that. The value can be presented without
# parentheses if only a single entry is being specified. The parameter is
# recognized from version 2.3.2 of sqlnet onward. Acceptable values include:
# TNSNAMES -- tnsnames.ora lookup
# ONAMES -- Oracle Names
# HOSTNAME -- use the hostname (or an alias of the hostname)
# NIS -- NIS (also known as "yp")
# CDS -- OSF DCE's Cell Directory Service
# NDS -- Novell's Netware Directory Service
#
# - Client Cache (ONRSD) ---------------------------------------------
#names.addresses = (ADDRESS=(PROTOCOL=IPC)(KEY=ONAMES))
#
#Syntax: ADDR
#Default: (ADDRESS=(PROTOCOL=IPC)(KEY=ONAMES))
#
# Address on which the client cache listens (is available to clients).
# Any valid TNS address is allowed. The default should be used if at
# all possible; clients have this entry hardwired as the first line
# of their server-list file (sdns.ora). If the address is set to a
# non-default value the client's preferred_servers parameter should
# be set to include the client-cache address first.
#
#
#names.authority_required = False
#
#Syntax: T/F
#Default: False
#
# Determines whether system querys (for the root etc) require Authoritative
# answers.
#
#
#names.auto_refresh_expire = 259200
#
#Syntax: Number of seconds, 60-1209600
#Default: 259200
#
# This is the amount of time (in seconds) the server will cache the addresses
# of servers listed in server-list file (sdns.ora). When this time expires the
# server will issue another query to the servers in those regions to refresh
# the data.
#
#
#names.auto_refresh_retry = 180
#
#Syntax: Number of seconds, 60-3600
#Default: sec. 180
#
# This set how often the server will retry when the auto_refresh query fails.
#
#
#names.cache_checkpoint_file = cache.ckp
#
#Syntax: filename
#Default: $ORACLE_HOME/network/names/ckpcch.ora
#
# Specifies the name of the operating system file to which the Names Server
# writes its foreign data cache.
#
#
#names.cache_checkpoint_interval = 7200
#
#Syntax: Number of seconds, 10-259200
#Default: 0 (off)
#
# Indicates the interval at which a Names Server writes a checkpoint of its
# data cache to the checkpoint file.
#
#
#names.default_forwarders=
# (FORWARDER_LIST=
# (FORWARDER=
# (NAME= rootserv1.world)
# (ADDRESS=(PROTOCOL=tcp)(PORT=42100)(HOST=roothost))))
#
chenjian361 2010-12-15
  • 打赏
  • 举报
回复
F:\oracle\product\10.2.0\db_1\NETWORK\ADMIN\SAMPLE\SQLNET.ORA

# Copyright (c) 1996, 2003, Oracle Corporation. All rights reserved.
#
# NAME
# sqlnet.ora
# FUNCTION
# Oracle Network Client startup parameter file example
# NOTES
# This file contains examples and instructions for defining all
# Oracle Network Client parameters. It should be possible to read
# this file and setup a Client by uncommenting parameter definitions
# and substituting values. The comments should provide enough
# explanation to enable a reasonable user to manage his TNS connections
# without having to resort to 'real' documentation.
# SECTIONS
# ONames Client
# Namesctl
# Native Naming Adpaters
# ...
chenjian361 2010-12-15
  • 打赏
  • 举报
回复
三个文件内容如下:
F:\oracle\product\10.2.0\db_1\NETWORK\ADMIN\SAMPLE、LISTENER.ORA


# copyright (c) 1997 by the Oracle Corporation
#
# NAME
# listener.ora
# FUNCTION
# Network Listener startup parameter file example
# NOTES
# This file contains all the parameters for listener.ora,
# and could be used to configure the listener by uncommenting
# and changing values. Multiple listeners can be configured
# in one listener.ora, so listener.ora parameters take the form
# of SID_LIST_<lsnr>, where <lsnr> is the name of the listener
# this parameter refers to. All parameters and values are
# case-insensitive.

# <lsnr>
# This parameter specifies both the name of the listener, and
# it listening address(es). Other parameters for this listener
# us this name in place of <lsnr>. When not specified,
# the name for <lsnr> defaults to "LISTENER", with the default
# address value as shown below.
#
# LISTENER =
# (ADDRESS_LIST=
# (ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521))
# (ADDRESS=(PROTOCOL=ipc)(KEY=PNPKEY)))

# SID_LIST_<lsnr>
# List of services the listener knows about and can connect
# clients to. There is no default. See the Net8 Administrator's
# Guide for more information.
#
# SID_LIST_LISTENER=
# (SID_LIST=
# (SID_DESC=
# #BEQUEATH CONFIG
# (GLOBAL_DBNAME=salesdb.mycompany)
# (SID_NAME=sid1)
# (ORACLE_HOME=/private/app/oracle/product/8.0.3)
# #PRESPAWN CONFIG
# (PRESPAWN_MAX=20)
# (PRESPAWN_LIST=
# (PRESPAWN_DESC=(PROTOCOL=tcp)(POOL_SIZE=2)(TIMEOUT=1))
# )
# )
# )

# PASSWORDS_<lsnr>
# Specifies a password to authenticate stopping the listener.
# Both encrypted and plain-text values can be set. Encrypted passwords
# can be set and stored using lsnrctl.
# LSNRCTL> change_password
# Will prompt for old and new passwords, and use encryption both
# to match the old password and to set the new one.
# LSNRCTL> set password
# Will prompt for the new password, for authentication with
# the listener. The password must be set before running the next
# command.
# LSNRCTL> save_config
# Will save the changed password to listener.ora. These last two
# steps are not necessary if SAVE_CONFIG_ON_STOP_<lsnr> is ON.
# See below.
#
# Default: NONE
#
# PASSWORDS_LISTENER = 20A22647832FB454 # "foobar"

# SAVE_CONFIG_ON_STOP_<lsnr>
# Tells the listener to save configuration changes to listener.ora when
# it shuts down. Changed parameter values will be written to the file,
# while preserving formatting and comments.
# Default: OFF
# Values: ON/OFF
#
# SAVE_CONFIG_ON_STOP_LISTENER = ON

# USE_PLUG_AND_PLAY_<lsnr>
# Tells the listener to contact an Onames server and register itself
# and its services with Onames.
# Values: ON/OFF
# Default: OFF
#
# USE_PLUG_AND_PLAY_LISTENER = ON

# LOG_FILE_<lsnr>
# Sets the name of the listener's log file. The .log extension
# is added automatically.
# Default=<lsnr>
#
# LOG_FILE_LISTENER = lsnr

# LOG_DIRECTORY_<lsnr>
# Sets the directory for the listener's log file.
# Default: <oracle_home>/network/log
#
# LOG_DIRECTORY_LISTENER = /private/app/oracle/product/8.0.3/network/log

# TRACE_LEVEL_<lsnr>
# Specifies desired tracing level.
# Default: OFF
# Values: OFF/USER/ADMIN/SUPPORT/0-16
#
# TRACE_LEVEL_LISTENER = SUPPORT

# TRACE_FILE_<lsnr>
# Sets the name of the listener's trace file. The .trc extension
# is added automatically.
# Default: <lsnr>
#
# TRACE_FILE_LISTENER = lsnr

# TRACE_DIRECTORY_<lsnr>
# Sets the directory for the listener's trace file.
# Default: <oracle_home>/network/trace
#
# TRACE_DIRECTORY_LISTENER=/private/app/oracle/product/8.0.3/network/trace
# CONNECT_TIMEOUT_<lsnr>
# Sets the number of seconds that the listener waits to get a
# valid database query after it has been started.
# Default: 10
#
# CONNECT_TIMEOUT_LISTENER=10
fingerfox 2010-12-15
  • 打赏
  • 举报
回复
netmgr--配置一个tns服务名。

都是oracle 自带工具。

本身Oracle 实例是自带一个默认的本地监听,无需另外配置。

通过这种方式就可以连接:
sqlplus /nolog
conn /as sysdba
fingerfox 2010-12-15
  • 打赏
  • 举报
回复
netca --配置一个listener。
chenjian361 2010-12-15
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 small_well 的回复:]
你开始进入SQL*PLUS的方法是easy connect名称解析的方法,没有使用本地名称解析的方法.有二个地方需要加东西:f:\oracle\product\10.2.0\db_1\network\admin\ tnsnames.ora和LISTENER.ORA.
tnsnames.ora是建立连接字符串,listener.ora是建立侦听器.
[/Quote]

这个要怎么加啊?我装的时候它没有啊?要怎么配?能否给我一个详细的配置
chenjian361 2010-12-15
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 iihero 的回复:]
至少得配一个listener啊,还有F:\oracle\product\10.2.0\db_1\NETWORK\ADMIN下边也得有tnsnames.ora文件
[/Quote]

这个为什么要手动配啊?我装的时候它没有啊?要怎么配?能否给我一个详细的配置
small_well 2010-12-15
  • 打赏
  • 举报
回复
你开始进入SQL*PLUS的方法是easy connect名称解析的方法,没有使用本地名称解析的方法.有二个地方需要加东西:f:\oracle\product\10.2.0\db_1\network\admin\ tnsnames.ora和LISTENER.ORA.
tnsnames.ora是建立连接字符串,listener.ora是建立侦听器.
iihero_ 2010-12-15
  • 打赏
  • 举报
回复
至少得配一个listener啊,还有F:\oracle\product\10.2.0\db_1\NETWORK\ADMIN下边也得有tnsnames.ora文件

17,377

社区成员

发帖
与我相关
我的任务
社区描述
Oracle 基础和管理
社区管理员
  • 基础和管理社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧