1.非集群下 Windows环境下数据库
127.0.0.1 只是个IP代表 实际要输入你要访问的数据库服务器IP地址的
如果数据库服务器不在本机上,需要加上数据库服务器的地址:用户名/密码@IP地址/数据库名称。
①运行->cmd
sqlplus/nolog 然后
第一种方式 :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)))集群下连接
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)))