一般oracle10g的文件所在目录为:C:\oracle\product\10.2.0\db_1\network\ADMIN
其他版本的可在oracle目录下搜索tnsname.ora文件名进行修改。
ora =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = xxx.xxx.xxx.xxx)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
其中ora为本地实例名,xxx.xxx.xxx.xxx为远程IP地址,1521为端口号,orcl为远程数据库实例名,按照对方提供的内容进行修改即可。
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数据库
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)