访问数据库的几种方法
作者:网络转载 发布时间:[ 2015/11/24 10:29:18 ] 推荐标签:数据库
这部分很基础,但是如果搞不清楚,对以后的学习会有影响。
SQL> select * from v$version where rownum=1;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
1.
sqlplus username/password@net_service_name (这是通过网络访问)
C:UsersAdministrator>sqlplus hr/hr@55
SQL*Plus: Release 11.2.0.1.0 Production on 星期日 5月 17 01:14:04 2015
Copyright (c) 1982, 2010, Oracle. All rights reserved.
连接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
========================================================
C:UsersAdministrator>sqlplus
SQL*Plus: Release 11.2.0.1.0 Production on 星期日 5月 17 01:16:47 2015
Copyright (c) 1982, 2010, Oracle. All rights reserved.
请输入用户名: hr@55
输入口令:
连接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> exit
从 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
开
================================================================
C:UsersAdministrator>sqlplus /nolog
SQL*Plus: Release 11.2.0.1.0 Production on 星期日 5月 17 01:17:17 2015
Copyright (c) 1982, 2010, Oracle. All rights reserved.
SQL> conn hr/hr@55
已连接。
当然也可以过EZCONNECT连接数据库(easy connect):
CONNECT username/password@host[:port]/service_name[/instance_name]
CONNECT username/password@[//]host[:port]/service_name
假如你连接没有成功检查一下客户端
etworkadminsqlnet.ora下:
SQL> select * from v$version where rownum=1;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
添加EZCONNECT:
NAMES.DIRECTORY_PATH= (TNSNAMES,EZCONNECT)
下面模拟不添加EZCONNECT:
通过模拟去除服务器端
etworkadminsqlnet.ora中 NAMES.DIRECTORY_PATH的参数EZCONNECT,客户端任然可以通过EZCO连接,这一点我不是太清楚,希望有朋友可以分享一下。
2.
[oracle@localhost ~]$ sqlplus hr/hr
SQL*Plus: Release 11.2.0.1.0 Production on 星期日 5月 17 02:12:05 2015
Copyright (c) 1982, 2009, Oracle. All rights reserved.
连接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
3.
[oracle@localhost ~]$ sqlplus sys/manager as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on 星期日 5月 17 02:12:49 2015
Copyright (c) 1982, 2009, Oracle. All rights reserved.
连接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
4.
[oracle@localhost ~]$ sqlplus
SQL*Plus: Release 11.2.0.1.0 Production on 星期日 5月 17 02:13:45 2015
Copyright (c) 1982, 2009, Oracle. All rights reserved.
请输入用户名: hr
输入口令:
连接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
5.
[oracle@localhost ~]$ sqlplus /nolog
SQL*Plus: Release 11.2.0.1.0 Production on 星期日 5月 17 02:15:09 2015
Copyright (c) 1982, 2009, Oracle. All rights reserved.
SQL> connect hr/hr
已连接。
SQL> exit
从 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options 断开
[oracle@localhost ~]$ sqlplus /nolog
SQL*Plus: Release 11.2.0.1.0 Production on 星期日 5月 17 02:15:40 2015
Copyright (c) 1982, 2009, Oracle. All rights reserved.
SQL> connect sys/manager as sysdba
已连接。
此种方法是启动了sqlplus,然后通过connect连接上了数据库.
6.
通过oracle提供的工具或第三方工具:
sql developer ,pl/sql developer,toad,spotlight.......
如果通过网络连接数据库掌握了,这都是非常简单的了。
以上比较简洁的介绍了这些方法,但是并没有罗列全部,比如还有:
HOSTNAME,LDAP,NIS等方法,感兴趣可以自行实验。
相关推荐
更新发布
功能测试和接口测试的区别
2023/3/23 14:23:39如何写好测试用例文档
2023/3/22 16:17:39常用的选择回归测试的方式有哪些?
2022/6/14 16:14:27测试流程中需要重点把关几个过程?
2021/10/18 15:37:44性能测试的七种方法
2021/9/17 15:19:29全链路压测优化思路
2021/9/14 15:42:25性能测试流程浅谈
2021/5/28 17:25:47常见的APP性能测试指标
2021/5/8 17:01:11