不使用TNS直连数据库的三种方式

1、在当前目录下新建tnsnames.ora文件

如windows环境下,在C:\Users\Administrator目录下新建tnsnames.ora文件,内容如下:
test =(description=(address=(protocol=tcp)(host=192.168.0.1)(port=1521))(connect_data=(server=dedicated)(service_name=orcl)))
C:\Users\Administrator>sqlplus sys/rusky@test as sysdba;

SQL*Plus: Release 11.2.0.1.0 Production on 星期五 2月 13 00:03:51 2015

Copyright (c) 1982, 2010, Oracle. All rights reserved.

连接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options


2、sqlplus连接时同时添加DESCTIPTION内容
C:\Users\Administrator>sqlplus SYS/rusky@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=rusky-PC)(port=1521))(CONNECT_DATA=(SID=orcl))) as sysdba;

SQL*Plus: Release 11.2.0.1.0 Production on 星期四 2月 12 23:56:33 2015

Copyright (c) 1982, 2010, Oracle. All rights reserved.

连接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

 

3、使用IP、端口号、实例名直接连接
C:\Users\Administrator>sqlplus sys/[email protected]:1521/orcl as sysdba;

SQL*Plus: Release 11.2.0.1.0 Production on 星期四 2月 12 23:58:24 2015

Copyright (c) 1982, 2010, Oracle. All rights reserved.


连接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

《FROM:http://blog.csdn.net/hhuck/article/details/5337764

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。