码迷,mamicode.com
首页 > 数据库 > 详细

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

时间:2015-02-13 01:28:00      阅读:176      评论:0      收藏:0      [点我收藏+]

标签:

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/rusky@127.0.0.1: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

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

标签:

原文地址:http://www.cnblogs.com/rusking/p/4289449.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!