[oracle@OLE1 ~]$ sqlplus scott/tiger
SQL*Plus: Release 11.2.0.1.0 Production on Wed Jul 12 23:29:30 2017
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@OLE1 ~]$ sqlplus scott/tiger@orcl
SQL*Plus: Release 11.2.0.1.0 Production on Wed Jul 12 23:30:00 2017
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected
[oracle@OLE1 ~]$
[oracle@OLE1 ~]$ sqlplus scott/tiger@192.168.244.128:1521/orcl
SQL*Plus: Release 11.2.0.1.0 Production on Wed Jul 12 23:30:00 2017
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected
[oracle@OLE1 ~]$
[oracle@OLE1 ~]$ sqlplus scott/tiger@//192.168.244.128:1521/orcl
SQL*Plus: Release 11.2.0.1.0 Production on Wed Jul 12 23:30:00 2017
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected
[oracle@OLE1 ~]$
[oracle@OLE1 ~]$ sqlplus "scott/tiger@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ole1)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)))"
SQL*Plus: Release 11.2.0.1.0 Production on Thu Jul 13 12:30:23 2017
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
SQL> show user
USER is "SCOTT"
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@OLE1 ~]$
3 回答
嗯,是的,当然,你需要使用SQL * Plus . 但是,在此之前,您需要确保一些事情:
例如,
例如,
例如,
确保正确配置了
tnsnames.ora
确保
listener
已启动并正在运行并正在侦听正确的端口 .您应该能够连接到数据库:
设置ORACLE_HOME和ORACLE_SID环境变量 . 然后使用sqlplus用户名@ ORACLE_SID
确保您已在unix用户路径环境中导出所有必需的Oracle变量,如下所示:
并确保正确配置tnsnames.ora文件,并且应该启动并运行侦听器,如下所示 .
现在,您有多种方法可以从unix命令提示符连接数据库 .
[oracle @ OLE1~] $ sqlplus scott / tiger
[oracle @ OLE1~] $ sqlplus scott / tiger @ orcl
[oracle @ OLE1~] $ sqlplus scott /tiger@192.168.244.128:1521 / orcl
[oracle @ OLE1~] $ sqlplus scott / tiger @ // 192.168.244.128:1521/orcl
[oracle @ OLE1~] $ sqlplus“scott / tiger @(DESCRIPTION =(ADDRESS =(PROTOCOL = TCP)(HOST = ole1)(PORT = 1521))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = orcl))) “