Aug*_*ter 3 windows oracle-11g-r2 linux sqlplus connectivity
我在我的 Mac 上的 Centos VM 上安装了 11g。我已经准备好一切并在服务器上工作。我已经包含了我在 cenos 上运行的以下命令。
$lsnrctl 状态
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 23-JUN-2014 14:49:41
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=hayer)(PORT=1522)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 23-JUN-2014 14:03:58
Uptime 0 days 0 hr. 45 min. 42 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/hayer/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=hayer)(PORT=1522)))
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
Run Code Online (Sandbox Code Playgroud)
我的 tnsnames.ora 文件如下:
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
LISTENER_ORCL =
(ADDRESS = (PROTOCOL = TCP)(HOST = hayer)(PORT = 1522))
ORCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = hayer)(PORT = 1522))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
(SID = orcl)
)
)
~
~
~
~
Run Code Online (Sandbox Code Playgroud)
在 Centos 服务器上,我也可以使用 sqlplus 登录。我在 windows 上将 tnsnames.ora 更改为与服务器相同。我在 windows 主机文件中添加了 oracle 主机信息,我可以在端口 1522 上 ping oracle 主机和 telnet 主机。
我已禁用服务 iptables,因此 centos 上不存在任何类型的防火墙。
但我仍然在 Windows 客户端上收到以下错误:
SQL*Plus: Release 11.2.0.1.0 Production on Mon Jun 23 14:51:31 2014
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Enter user-name: system as sysdba
Enter password:
ERROR:
ORA-12560: TNS:protocol adapter error
Enter user-name: system as sysdba
Enter password:
ERROR:
ORA-12560: TNS:protocol adapter error
Run Code Online (Sandbox Code Playgroud)
Jos*_*ber 10
在您的 Windows 客户端上,您需要指定 TNS alias @ORCL
,否则它假定您正在尝试连接到在您的 Windows 客户端上运行的本地数据库,而该数据库没有。此外,system as sysdba
通常不使用,甚至不确定这是否有意义。 SYS as sysdba
并且只是简单system
地使用。
Enter user-name: system@ORCL
Enter password:
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning option
Run Code Online (Sandbox Code Playgroud)
如果您没有tnsnames.ora
在 Windows 客户端上进行设置,您仍然可以通过 EZCONNECT 字符串连接@"hayer:1522/orcl"
而不是设置 tnsnames(是的,需要引号)。
Enter user-name: system@"hayer:1522/orcl"
Enter password:
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning option
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
84802 次 |
最近记录: |