sqlplus连接数据库的几种方法
2016-01-06 11:23
375 查看
方法一 :
将数据库地址、端口号、SID、用户名、密码都输进去,这种方法最简单,只要有sqlplus就能使用,不需要配置。
格式:sqlplus [username]/[password]@[host]:[port]/[sid]
例:
sqlplus system/123456@192.168.8.11:1521/orcl
方法二 :
同方法一类似。
格式:
sqlplus [username]/[password]@'(description=(address_list=(address=(protocol=tcp)(host=[host])(port=[port])))(connect_data=(service_name=[sid])))'
例:sqlplus system/123456@'(description=(address_list=(address=(protocol=tcp)(host=192.168.8.11)(port=1521)))(connect_data=(service_name=orcl)))'
方法三 :
将配置tnsnames.ora,内容如下:
{CSDN:
# Modify the following content to fit your own needs.
ORCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.8.11)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ORCL)
)
)
:java}
此方法的好处是配置好后以后每次连接时都很简单,缺点是需要找到tnsnames.ora并进行配置。
格式:sqlplus [username]/[password]@[sid]
例:
sqlplus system/123456@orcl
注:此方法也可省略后面的 @[sid],如sqlplus system/123456,这样会连接默认的SID。
相关文章推荐
- QUESTION 118 You are managing an Oracle Database 11g instance with ASM storage. You lost an ASM disk
- oracle高级查询总结
- oracle rac ocr 简述
- SQL统计一个字段里某个特定字符的个数
- iOS 数据库SQL 基础
- 你真的了解 MySQL 数据库的运行状况吗?
- mongodb中的populate方法
- Mybatis 数据库物理分页插件 PageHelper
- oracle数据库密码过期报错
- plsql登录数据库,报错“ora-12541:TNS:无监听程序”错误
- MySQL存储过程调试工具-dbForge Studio for MySQL
- 你真的了解 MySQL 数据库的运行状况吗?
- mariadb 10 安装 使用官方仓库
- 你真的了解 MySQL 数据库的运行状况吗?
- 你真的了解 MySQL 数据库的运行状况吗?
- 登录plsql 报错 the account is locked --用户被锁
- Redis的安装和使用之一 -----Redis相关运用
- MySQL做为手动开启事务用法
- mysqldump常用参数
- MySQL解决[Err] 1206 - The total number of locks exceeds the lock table size问题