TNS-12537: TNS:connection closed TNS-12560: TNS:protocol adapter error TNS-00507: Connection clos

原因
1localhost有多个地址,引发监听冲突
2在linux中搭建的oracle没有监听配置,没有下面相应的文件

TNS-12537: TNS:connection closed TNS-12560: TNS:protocol adapter error TNS-00507: Connection clos_第1张图片

解决方法
问题1 localhost有多个地址,引发监听冲突

[oracle@localhost bin]$ cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
196.20.1.211 localhost dbserver

修改主机名

[oracle@localhost bin]$ hostname dbserver

修改hosts

[oracle@localhost bin]$ vi /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
196.20.1.211 dbserver

修改 /etc/sysconfig/network

[oracle@dbserver bin]$ vi /etc/sysconfig/network
# Created by anaconda
hostname =  dbserver

问题2 在linux中搭建的oracle没有监听配置,没有下面相应的文件
在/usr/oracle/product/network/admin中添加以下3个文件

listener.ora

SID_LIST_LISTENER =  
   (SID_LIST =  
    (SID_DESC =  
      (SID_NAME = CLRExtProc)  
      (ORACLE_HOME = /usr/oracle/product)  
       (PROGRAM = extproc)  
       (ENVS = "EXTPROC_DLLS=ONLY:/usr/oracle/product")  
    )  
  )  
   (SID_DESC =
    (GLOBAL_DBNAME = ORCL)
    (ORACLE_HOME = /usr/oracle/product)
    (SID_NAME = ORCL)
    )
LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = 196.20.1.211)(PORT = 1521))
    )
  )

ADR_BASE_LISTENER = /usr/oracle/product

sqlnet.ora

SQLNET.AUTHENTICATION_SERVICES= (NTS)
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
SQLNET_ALLOWED_LOGON_VERSIONS=(12,11,10,9,8,7)

tnsnames.ora

ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 196.160.1.211)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  )

你可能感兴趣的:(架构,oracle)