如何从UNIX连接到Oracle数据库 [英] how to connect to an oracle database from unix
问题描述
我正在尝试从我的UNIX计算机连接到oracle数据库。我是脚本编写新手。我知道如何浏览unix并编写基本脚本(read / display)并使用bash命令执行它们。我也知道如何在Unix(用户和系统)中查看变量。你能告诉我我需要做些什么来连接到Oracle数据库吗?我如何使用sqlplus命令?
I am trying to connect to an oracle database from my unix machine. I am new to script writing in general. I know how to browse round unix and have written basic scripts ( read / display ) and execute them with bash command. Also I know how to view the variables in unix ( user and system). Could you tell me what i need to do to connect to an oracle database? do I use the sqlplus command? are there any variables I have to set before that?
推荐答案
你能告诉我我需要什么吗?做连接到Oracle数据库?我如何使用sqlplus命令?
Could you tell me what i need to do to connect to an oracle database? do I use the sqlplus command?
当然,是的,您需要使用SQL * Plus。但是,在此之前,您需要确定几件事:
Well, yes of course, you need to use SQL*Plus. However, before that, you need to make sure of few things:
- export ORACLE_HOME变量
例如,
export ORACLE_HOME=/u01/app/oracle/product/11.2.0
- 导出路径变量
例如
export PATH=$PATH:$ORACLE_HOME/bin
- export SID
例如,
export ORACLE_SID="your database service name"
- 确保您正确配置了
tnsnames.ora
- 确保您具有
监听器
正常运行并正在侦听正确的端口。
- Make sure you have the
tnsnames.ora
configured properly - Make sure you have the
listener
up and running and is listening to the correct port.
您应该能够以以下方式连接到数据库:
You should be able to connect to the database as:
sqlplus username/password@sid
这篇关于如何从UNIX连接到Oracle数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!