---
title: "Oracle database 11g R2 client的sqlplus无法成功连接数据库"
author: "剑雨123"
date: "2014-04-02T11:16:55Z"
tags: []
categories: ["数据库"]
slug: "oracle-database-11g-r2-client-sqlplus"
draft: false
lastmod: "2014-04-02T11:16:55Z"
id: 2039835
url: "https://cuug789.iteye.com/blog/2039835"
---

![](http://dl2.iteye.com/upload/attachment/0095/6092/40057452-d997-359a-907a-7400549e32fb.jpg)
问题环境：
1、数据库版本： Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
2、操作系统环境：Windows 7 旗舰版 64位
3、本地安装有4个Oracle 数据库软件【四个数据库软件，不是四个数据库哦】如下：
Oracle 10.2服务端软件：e:\oracle\product\10.2.0\db_1\BIN\sqlplus.exe
Oracle 11.2服务端软件：e:\oracle\product\11.2.0\db_1\BIN\sqlplus.exe
Oracle 10.2客户端软件：e:\oracle\product\11.2.0\client_1\BIN\sqlplus.exe
Oracle 11.2客户端软件：e:\oracle\product\10.2.0\client_1\BIN\sqlplus.exe

问题描述：

1、本地启动Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 ,服务名sun，服务状态如下：
C:\Windows\system32>sc query oracleservicesun
SERVICE_NAME:oracleservicesun
        TYPE               : 10  WIN32_OWN_PROCESS
        STATE              : 4  RUNNING
                                (STOPPABLE, PAUSABLE, ACCEPTS_SHUTDOWN)
        WIN32_EXIT_CODE    : 0  (0x0)
        SERVICE_EXIT_CODE  : 0  (0x0)
        CHECKPOINT         : 0x0
        WAIT_HINT          : 0x0


2、使用Oracle 10.2服务端软件可以正常连接数据库，如下：C:\Windows\system32>set ORACLE_SID=sun
C:\Windows\system32>e:\oracle\product\10.2.0\db_1\BIN\sqlplus.exe / as sysdba
SQL*Plus: Release 10.2.0.4.0- Production on 星期一 5月 14 17:06:32 2012
Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.

连接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

sys@SUN>

3、使用Oracle 11.2服务端软件可以正常连接数据库，如下：C:\Windows\system32>set ORACLE_SID=sun
C:\Windows\system32>e:\oracle\product\11.2.0\db_1\BIN\sqlplus.exe / as sysdba
SQL*Plus: Release 11.2.0.1.0Production on 星期一 5月 14 17:07:23 2012
Copyright (c) 1982, 2010, Oracle.  All rights reserved.

连接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

sys@SUN>


4、使用Oracle 10.2客户端软件可以正常连接数据库，如下：
C:\Windows\system32>set ORACLE_SID=sun
C:\Windows\system32>E:\oracle\product\10.2.0\client_1\BIN\sqlplus.exe / as sysdba
SQL*Plus: Release 10.2.0.4.0- Production on 星期一 5月 14 17:11:27 2012
Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.

连接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

sys@SUN>


5、使用Oracle 11.2客户端软件无法连接数据库，如下
C:\Windows\system32>set ORACLE_SID=sun
C:\Windows\system32>e:\oracle\product\11.2.0\client_1\BIN\sqlplus.exe / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on 星期一 5月 14 17:13:08 2012
Copyright (c) 1982, 2010, Oracle.  All rights reserved.


ERROR:
ORA-12560: TNS: 协议适配器错误

请输入用户名:

补充信息：
Oracle 11.2客户端sqlnet.ora文件如下：
# sqlnet.ora Network Configuration File: e:\oracle\product\11.2.0\client_1\network\admin\sqlnet.ora
# Generated by Oracle configuration tools.

# This file is actually generated by netca. But if customers choose to
# install "Software Only", this file wont exist and without the native
# authentication, they will not be able to connect to the database on NT.

SQLNET.AUTHENTICATION_SERVICES= (NTS)
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
请各位湿湿们不吝赐教，折腾了很久也没搞明白原因，纠结中。。