求帮忙解决tnsname.ora文件问题
十分感谢文件内容如下
# This file contains the syntax information for 
# the entries to be put in any tnsnames.ora file
# The entries in this file are need based. 
# There are no defaults for entries in this file
# that Sqlnet/Net3 use that need to be overridden 
#
# Typically you could have two tnsnames.ora files
# in the system, one that is set for the entire system
# and is called the system tnsnames.ora file, and a
# second file that is used by each user locally so that
# he can override the definitions dictated by the system
# tnsnames.ora file.# The entries in tnsnames.ora are an alternative to using
# the names server with the onames adapter.
# They are a collection of aliases for the addresses that 
# the listener(s) is(are) listening for a database or 
# several databases.# The following is the general syntax for any entry in 
# a tnsnames.ora file. There could be several such entries 
# tailored to the user's needs.<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

解决方案 »

  1.   

    在你的tnsnames.ora文件中,复制下面的内容,更改IP地址为你远程数据库的IP地址
    TEADB =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.2)(PORT = 1521))
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = teadb)
        )
      )连接字符串TEADB的名称可以随便取一个,注意
    1)更改HOST=后面的IP地址为你远程数据库的IP地址;
    2)更改SERVICE_NAME=后面的teadb为你数据库的服务名(可以在数据库本机上使用sqlplus执行查询:show parameter service 得到结果)
    3)如果远程数据库监听不是使用默认的1521端口的话,注意更改PORT=后面的1521为你远程数据库监听的真实端口。
    4.可能需要注意,你sqlnet.ora文件中配置的连接方式,是不是使用tnsnames.ora来解析。
    如果sqlnet.ora中包含内容:NAMES.DIRECTORY_PATH= (TNSNAMES)
    则就是对了。
    5.配置完tnsnames.ora后,可以使用tnsping命令测试连接是否正常。
    在命令行(windows下在ms-dos窗口下)执行:tnsping TEADB 10
    表示使用oracle的ping(叫tnsping,区别于网络上的物理ping命令)命令,去测试10次该连接字符串TEADB
      

  2.   

    tnsnames.ora你还没搞清楚哈
    你贴的根本就不是tnsnames.ora的内容!
    二楼的那个你可以参考一下
      

  3.   

    HOST 
    PORT 
    SERVICE_NAME
    这几个配置好了,就差不多了