navicat连接客户端报错

Posted wxzhe

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了navicat连接客户端报错相关的知识,希望对你有一定的参考价值。

怎么感觉oracle和sql server是一个货色。装个服务得装半天,还是mysql好,一下子就好了!下面有一个在centos7上面安装oracle11g的详细步骤,感觉找不到比这个更详细的了吧!

centos7安装详细步   :https://www.cnblogs.com/VoiceOfDreams/p/8308601.html

安装数据库之后在使用客户端连接数据库的时候总是报如下错误:

ORA-12514: TNS:listener does not currently know of service requested in connect

然后百度+谷歌,解决办法说是修改listener.ora文件,在文件中添加如下内容:【下面文件中标红的表示添加的内容】

[[email protected] ~]$ cd /data/oracle/product/11.2.0/db_1/network/admin/
[[email protected] admin]$ cat listener.ora 
# listener.ora Network Configuration File: /data/oracle/product/11.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.9.8.201)(PORT = 1521))
    )


   (SID_DESC =
      (GLOBAL_DBNAME = orcl)
      (ORACLE_HOME = /data/oracle/product/11.2.0/db_1)
      (SID_NAME = orcl)
    )
  )

ADR_BASE_LISTENER = /data/oracle

添加完之后重新启动监听器,连接的时候报如下错误:

ERROR:
ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA

又去百度+谷歌,大部分答案都是说tnsnames.ora中service_name写成了server_name等,可是tnsnames.ora这个文件是oracle服务器自己生成的啊。

这时候查看监听器状态会有如下提示:

[[email protected] ~]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 14-MAY-2019 21:35:17

Copyright (c) 1991, 2009, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                14-MAY-2019 19:16:38
Uptime                    0 days 2 hr. 18 min. 39 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /data/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File         /data/oracle/diag/tnslsnr/oracle/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.9.8.201)(PORT=1521)))
The listener supports no services                                 #这里提示没有服务
The command completed successfully

最后的解决办法,重启监听器,重启服务器。

[[email protected] admin]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.1.0 Production on Tue May 14 21:57:46 2019

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

SQL> connect sys / as sysdba
Enter password: 
Connected.
SQL> shutdown immediate                    #关闭oracle服务器
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup                               #启动oracle服务器
ORACLE instance started.

Total System Global Area  759943168 bytes
Fixed Size            2217224 bytes
Variable Size          507513592 bytes
Database Buffers      247463936 bytes
Redo Buffers            2748416 bytes
Database mounted.
Database opened.
SQL> 

查看监听器状态:

[[email protected] admin]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 14-MAY-2019 22:18:47

Copyright (c) 1991, 2009, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                14-MAY-2019 19:16:38
Uptime                    0 days 3 hr. 2 min. 8 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /data/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File         /data/oracle/diag/tnslsnr/oracle/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.9.8.201)(PORT=1521)))
Services Summary...
Service "orcl" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully

使用客户端连接oracle数据库:

[[email protected] admin]$ sqlplus scott/[email protected]10.9.8.201/orcl

SQL*Plus: Release 11.2.0.1.0 Production on Tue May 14 22:19:21 2019

Copyright (c) 1982, 2009, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> 

客户端连接成功:

技术图片

 

更改oracle监听端口

oracle安装之后监听的本地的127.0.0.1这个ip,但是在window系统连接很显然不行的,更改上面提到的哪两个文件中的localhost为服务器的ip即可,然后重启监听器。

[[email protected] admin]$ cat listener.ora 
# listener.ora Network Configuration File: /data/oracle/product/11.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.9.8.201)(PORT = 1521))
    )


   (SID_DESC =
      (GLOBAL_DBNAME = orcl)
      (ORACLE_HOME = /data/oracle/product/11.2.0/db_1)
      (SID_NAME = orcl)
    )
  )

ADR_BASE_LISTENER = /data/oracle

[[email protected] admin]$ cat tnsnames.ora 
# tnsnames.ora Network Configuration File: /data/oracle/product/11.2.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

LISTENER_ORCL =
  (ADDRESS = (PROTOCOL = TCP)(HOST = 10.9.8.201)(PORT = 1521))


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

 

以上是关于navicat连接客户端报错的主要内容,如果未能解决你的问题,请参考以下文章

navicat连接oracle报错:ORA-12737 Instant Client Light:unsupported server character set ZHS16GBK

navicat连接oracle报错:ORA-12737 Instant Client Light:unsupported server character set ZHS16GBK

Navicat连接Mysql(Windows环境下)报错提示错误代码1130和1251的解决方法

Navicat Premium 连接Oracle数据库报错 instant Client LIght : unsupported server charcter ser ZHS16GBK

navicat 连接Oracle数据库及报错问题处理:ORA-28547 nonnection to server failed, probable Oracle Net admin error

navicat 连接Oracle数据库及报错问题处理:ORA-28547 nonnection to server failed, probable Oracle Net admin error