Oracle 的登录与连接
无论登录还是连接都会连接到数据库,最终都可以执行SQL语句。
登录
打开命令行,输入SQLPLUS
。
Microsoft Windows [版本 6.3.9600]
(c) 2013 Microsoft Corporation。保留所有权利。
C:\Users\Admin> SQLPLUS
SQL*Plus: Release 11.2.0.1.0 Production on 星期五 2月 4 14:53:59 2022
Copyright (c) 1982, 2010, Oracle. All rights reserved.
请输入用户名: scott
输入口令:
连接到
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
with the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
你也可以以下列格式输入进行登录。
SQLPLUS username[/password[@connect_identifier]] [AS SYSOPER | AS SYSDBA]
@connect_identifier 如: @//10.8.114.2:1521/orcl 。
连接
当你登录后想切换用户,可以用下列命令。
SQL> CONNECT scott
输入口令:
已连接。
SQL>
你也可以下列格式输入进行连接。
CONNECT username[/password[@connect_identifier]] [AS SYSOPER | AS SYSDBA]
可以发现,用SQLPLUS
登录和用CONNECT
连接的命令格式是一样的。