转载:http://blog.itpub.net/31392094/viewspace-2127788/

第一种方式(最常用):配置监听,配置tnsname.ora文件

例如:

ORA11GR2 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.6)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = PROD)
    )
  )

第二种方式(EZConnect字符串):

配置sqlnet.ora文件:

sec@secdb /home/oracle$ cat $ORACLE_HOME/network/admin/sqlnet.ora
# sqlnet.ora Network Configuration File: /oracle/app/oracle/product/10.2.0/db_1/network/admin/sqlnet.ora
# Generated by Oracle configuration tools.

NAMES.DIRECTORY_PATH= (TNSNAMES,EZCONNECT)

  cmd窗口或者 linux下:sqlplus 用户名/密码@ip/实例名称;

02-19 17:08