oracle远程连接配置

oracle安装完毕后,只能从本地连接,如果要从其他机器连接,则需要对oracle进行设置:

本机OS: winXP 32bit

oracle: 11g

1.到控制面板关闭操作系统的防火墙

2.找到C:\app\Administrator\product\11.2.0\dbhome_1\NETWORK\ADMIN\listener.ora文件,

  修改其中的HOST为oracle所在的机器的主机名hostname,

C:\Documents and Settings\Administrator>hostname
yuanyuan-0a46c6

  添加声明SID为您设置的oracle的SID名(默认是orcl)

(SID_DESC =
      (GLOBAL_DBNAME = ORCL) 
      (RACLE_HOME = C:\app\Administrator\product\11.2.0\dbhome_1)
      (SID_NAME = ORCL)
    )

最后修改后的listener.ora的内容为

# listener.ora Network Configuration File: C:\app\Administrator\product\11.2.0\dbhome_1\NETWORK\ADMIN\listener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = CLRExtProc)
      (ORACLE_HOME = C:\app\Administrator\product\11.2.0\dbhome_1)
      (PROGRAM = extproc)
      (ENVS = "EXTPROC_DLLS=ONLY:C:\app\Administrator\product\11.2.0\dbhome_1\bin\oraclr11.dll")
    )
	(SID_DESC =
      (GLOBAL_DBNAME = ORCL) 
      (RACLE_HOME = C:\app\Administrator\product\11.2.0\dbhome_1)
      (SID_NAME = ORCL)
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = yuanyuan-0a46c6)(PORT = 1521))
    )
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
    )
  )

ADR_BASE_LISTENER = C:\app\Administrator

3.重启oracle监听服务即可。

  到win的服务管理中重启OracleOraDb11g_home1TNSListener服务,

  或者在cm的窗口执行lsnrctl start.

如此,即可解决oracle数据库无法远程连接的问题。

4.常见错误:

如果以上不修改HOST,则会报如下错误:

java.sql.SQLException: The Network Adapter could not establish the connection..................Caused by: oracle.net.ns.NetException: The Network Adapter could not establish the connection

如果以上不指定SID名称,则会报如下错误:

java.sql.SQLException: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor

你可能感兴趣的:(oracle,sid,lsnrctl)