Oracle问题之ORA-12560TNS:协议适配器错误Oracle问题之ORA-12560TNS:协议适配器错误
⼀、造成ORA-12560: TNS: 协议适配器错误的问题的原因有三个:
1.监听服务没有起起来。windows平台个⼀如下操作:开始---程序---管理⼯具---服务,打开服务⾯板,
  启动OracleOraDb11g_home1TNSlistener服务。
2.database instance没有起起来。windows平台如下操作:开始---程序---管理⼯具---服务,打开服务
  ⾯板,启动OracleServiceBOOKSALES,  BOOKSALES就是你的database SID   
3.注册表问题。regedit,然后进⼊HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\HOME
  将该环境变量ORACLE_SID设置为XXXX, XXXX就是你的database SID.
  或者右击我的电脑,属性--⾼级--环境变量---系统变量--新建,变量名=oracle_sid,变量值=XXXX, XXXX就是你的database SID.  或者进⼊sqlplus前,在command line下输 set oracle_sid=XXXX, XXXX就是你的database SID.
 经过以上步骤,⼀般就可以解决问题。
⼆、如果还没有解决的话则会遇到以下问题:
1、执⾏请求的操作时遇到错误:
IO 错误: The Network Adapter could not establish the connection
供应商代码 17002
2、执⾏请求的操作时遇到错误:
Listener refused the connection with the following error:
ORA-12514, TNS:listener does not currently know of service requested in connect descriptor
供应商代码 12514
三、解决⽅法如下:
  假如只有⼀个数据库的话:
  1、到如下路径:
    D:\install\oracle\oracle-install\product\11.2.0\dbhome_1\NETWORK\ADMIN
  2、将⽂件中的内容修改如下,当然要结合⾃⼰的实际情况做简单修改:
     //a
1 # a Network Configuration File: D:\install\oracle\oracle-install\product\11.2.0\dbhome_1\network\a
2 # Generated by Oracle configuration tools.
3
4 SID_LIST_LISTENER =
5  (SID_LIST =
6    (SID_DESC =
7      (SID_NAME = CLRExtProc)
8      (ORACLE_HOME = D:\install\oracle\oracle-install\product\11.2.0\dbhome_1)
9      (PROGRAM = extproc)
10      (ENVS = "EXTPROC_DLLS=ONLY:D:\install\oracle\oracle-install\product\11.2.0\dbhome_1\bin\oraclr11.dll")
11    )
12    (SID_DESC =
13      (SID_NAME = BOOKSALES)
14      (ORACLE_HOME = D:\install\oracle\oracle-install\product\11.2.0\dbhome_1)
15    (GLOBAL_DBNAME = BOOKSALES)
16  )
17  )
18
19 LISTENER =
20  (DESCRIPTION_LIST =
21    (DESCRIPTION =
22      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
23    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.100)(PORT = 1521))
24    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
25    (ADDRESS = (PROTOCOL = TCP)(HOST = acer)(PORT = 1521))
26    )
27  )
28
29 ADR_BASE_LISTENER = D:\install\oracle\oracle-install
View Code
     //a   
1 # a Network Configuration File: D:\install\oracle\oracle-install\product\11.2.0\dbhome_1\network\a
2 # Generated by Oracle configuration tools.
3
4 # This file is actually generated by netca. But if customers choose to
5 # install "Software Only", this file wont exist and without the native
6 # authentication, they will not be able to connect to the database on NT.
7
8 SQLNET.AUTHENTICATION_SERVICES= (NTS)
9
10 NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
View Code
     //a
1 # a Network Configuration File: D:\install\oracle\oracle-install\product\11.2.0\dbhome_1\network\a
oracle 新建用户
2 # Generated by Oracle configuration tools.
3
4 BOOKSALES =
5  (DESCRIPTION =
6    (ADDRESS_LIST =
7      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.100)(PORT = 1521))
8    )
9    (CONNECT_DATA =
10      (SERVICE_NAME = BOOKSALES)
11    )
12  )
View Code
   3、重新启动 tnslistener
   4、测试的时候要注意修改对应数据库的⽤户名和密码
    Oracle SQL Developer连接的时候也要注意⽤对应的⽤户名和密码
执⾏请求的操作时遇到错误:
IO 错误: The Network Adapter could not establish the connection
供应商代码 17002
执⾏请求的操作时遇到错误:
Listener refused the connection with the following error:
ORA-12514, TNS:listener does not currently know of service requested in connect descriptor 供应商代码 12514
也是按照上⾯修改配置⽂件

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。