如何用cmd命令连接oracle数据库
1,非集群下 Windows环境下数据库
conn scott/123@127.0.0.1:1521/orcl
conn scott/123456@(DESCRIPTION =(ADDRESS_LIST =(ADDRESS =
(PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521)))(CONNECT_DATA =
(SERVER = DEDICATED)(SERVICE_NAME = orcl)))
Linux环境下数据库
conn scott/123@(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST
= 127.0.0.1)(PORT = 1521)))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME =
orcl)))
2,集群下连接
conn scott/123@(DESCRIPTION=(ADDRESS_LIST=(LOAD_BALANCE = yes)(FAILOVER = on)
(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521))(ADDRESS=
(PROTOCOL=TCP)(HOST=127.0.0.2)(PORT=1521)))(CONNECT_DATA=(SERVER=default)
(SERVICE_NAME=orcl)))
扩展资料
在命令行中登录oracle数据库:
sqlplus username/password 如:普通用户登录 sqlplus scott/tiger
sqlplus username/password as sysdba 如:sqlplus sys/admin as sysdba
sqlplus username/password@net_service_name 如: sqlplus scott/tiger@orcl
sqlplus username/password@//host:port/sid
参考资料:百度百科 - Oracle数据库
用户名和密码是略过的,因为默认使用操作系统认证