ITPub博客

首页 > 数据库 > Oracle > [20180208]ezconnect语法.txt

[20180208]ezconnect语法.txt

原创 Oracle 作者:lfree 时间:2018-02-08 09:04:51 0 删除 编辑

[20180208]ezconnect语法.txt

--昨天看书Oracle Database11g DBA Handbook.pdf,Using Easy Connect Naming P561.发现如下内容:

connect username/password@[//]host[:port][/service_name][/server][/instance_name]

Element            Description
//                 Optional. Specify // for a URL.
Host               Required. Specify the host name or the IP address.
Port               Optional. Specify the port or use the default (1521).
service_name       Optional. Specify the service name. The default value is the host name of the database server.
server             Optional. Also known as connect_type in OCI, specifies the type of service handler: dedicated, shared, or pooled.
instance_name      Optional. Corresponds to the INSTANCE_NAME initialization parameter.

For URL or JDBC connections, prefix the connect identifier with a double slash (//):
connect username/password@[//][host][:port][/service_name]

--//如果通过ezconnect连接数据库特定实例,可以这样:

sqlplus system/xxxxxxxxxxxx@192.168.aa.bb:1521/fyhis:dedicated/fyhis1

SYSTEM@192.168.aa.bb:1521/fyhis:dedicated/fyhis1> select INSTANCE_NUMBER,INSTANCE_NAME from v$instance ;
INSTANCE_NUMBER INSTANCE_NAME
--------------- ----------------
              1 fyhis1

sqlplus system/xxxxxxxxxxxx@192.168.aa.bb:1521/fyhis:dedicated/fyhis2

SYSTEM@192.168.aa.bb:1521/fyhis:dedicated/fyhis2> select INSTANCE_NUMBER,INSTANCE_NAME from v$instance ;
INSTANCE_NUMBER INSTANCE_NAME
--------------- ----------------
              2 fyhis2

--//这样可以连接不同实例.这样写也可以:
sqlplus system/xxxxxxxxxxxx@192.168.aa.bb:1521/fyhis:/fyhis1
sqlplus system/xxxxxxxxxxxx@192.168.aa.bb:1521/fyhis:/fyhis2
sqlplus system/xxxxxxxxxxxx@192.168.aa.bb:1521/fyhis/fyhis1
sqlplus system/xxxxxxxxxxxx@192.168.aa.bb:1521/fyhis/fyhis2

--//注文档有误,应该是这样,server前使用:.

connect username/password@[//]host[:port][/service_name][:server][/instance_name]
R:\>sqlplus system/xxxxxxxxxxxx@192.168.aa.bb:1521/fyhis/dedicated/fyhis2
SQL*Plus: Release 12.1.0.1.0 Production on Thu Feb 8 08:59:26 2018
Copyright (c) 1982, 2013, Oracle.  All rights reserved.
ERROR:
ORA-12521: TNS:listener does not currently know of instance requested in connect descriptor

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/267265/viewspace-2150938/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
熟悉oracle相关技术,擅长sql优化,rman备份与恢复,熟悉linux shell编程。

注册时间:2008-01-03

  • 博文量
    4006
  • 访问量
    7970307