不使用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

你可能感兴趣的:(数据库)