简体   繁体   English

Oracle Instant Client-SQL * Plus-错误:没有TNS侦听器(MacOSX)

[英]Oracle Instant Client - SQL*Plus - ERROR: No TNS Listener (MacOSX)

I am developing a web application that has to be connected with the ORACLE database. 我正在开发一个必须与ORACLE数据库连接的Web应用程序。

Presently I am working on macOS X and I have downloaded Oracle Instant Client . 目前,我正在使用macOS X,并且已经下载了Oracle Instant Client I am able to run sqlplus , but while logging in the interface I get the following error: 我能够运行sqlplus ,但是在登录界面时出现以下错误:

SQL*Plus: Release 12.2.0.1.0 Production on Sun Jul 8 10:55:48 2018

Copyright (c) 1982, 2017, Oracle.  All rights reserved.
Enter user-name: hr
Enter password: 
ERROR:
ORA-12541: TNS:no listener

For your information, I have downloaded nothing except the client software by Oracle and installed it according to the official installation documentation. 供您参考,除Oracle的客户端软件外,我没有下载任何东西,并根据官方安装文档进行了安装。 I really need to work on sqlplus for the database. 我真的需要在数据库的sqlplus上工作。

PLEASE HELP. 请帮忙。

Also, could you please tell me how can I use sqlplus in my machine? 另外,能否请您告诉我如何在我的计算机中使用sqlplus

Instant client does not provide you with a Oracle database to work with, they are just tools to connect to a database.From the documentation of Instant Client Instant Client不会为您提供要使用的Oracle数据库,它们只是连接到数据库的工具。来自Instant Client文档

Oracle Instant Client enables applications to connect to a local or remote Oracle Database for development and production deployment. Oracle Instant Client使应用程序可以连接到本地或远程Oracle数据库,以进行开发和生产部署。 The Instant Client libraries provide the necessary network connectivity, as well as basic and high end data features, to make full use of Oracle Database. Instant Client库提供必要的网络连接以及基本和高端数据功能,以充分利用Oracle数据库。

So, prior to using an instant client, you need to have an Oracle database somewhere(local or remote).If you have a database server on a remote host, you may connect it using the easy connect syntax. 因此,在使用即时客户端之前,您需要在某个地方(本地或远程)安装Oracle数据库。如果远程主机上有数据库服务器,则可以使用easy connect语法进行连接。

sqlplus user/pwd@//remote_hostname:1521/remote_dbname

If you have a tnsnames.ora file in your $TNS_ADMIN preconfigured to contain the list of database instances available, you may simply use this to connect 如果$TNS_ADMINtnsnames.ora文件已预先配置为包含可用的数据库实例列表,则可以简单地使用它来连接

 sqlplus user/pwd@tns_entry_for_DB

Putting the tns entry in command line also works. 将tns条目放在命令行中也可以。

 sqlplus user/pwd@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=remote_hostname)(Port=1521))(CONNECT_DATA=(SID=remote_dbname)))

Moreover,Oracle doesn't provide you database software versions beyond 10gr2 to install locally on a Mac. 此外,Oracle不会为您提供10gr2以上版本的数据库软件版本,而无法在Mac上本地安装。

If you want to install and connect to a local database version 12.2 in Mac, One option is to host a virtual machine for Linux/Windows or run a docker container . 如果要在Mac中安装并连接到本地数据库版本12.2,一种选择是为Linux / Windows托管虚拟机或运行docker container Please read my post here for details: Oracle SQL for Mac OS X 请在此处阅读我的文章以获取详细信息: Mac OS X的Oracle SQL

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM