Easy Connect (EZCONNECT) Naming Method with Instance Name

Oftentimes I use the Easy Connect (EZCONNECT) to connect to a new database just to quickly verify database connectivity. The syntax I usually use is as follows:

CONNECT username/password@[//]host[:port][/service_name]
CONNECT scott/tiger@host1-vip:1522/RACDB

In RAC, this will connect to whatever instance based on the service’s load balancing goal.

I just learned that with the 11g net services client software, you can also specify the instance name to connect to. This may be useful especially for RAC setup if you have the need to connect to a specific instance.

CONNECT username@[//]host[:port][/[service_name][:server]][/instance_name]]

-- Connect to the instance name RACDB1
CONNECT scott/tiger@host1-vip:1522/RACDB/RACDB1

-- Connect to the instance name RACDB2
CONNECT scott/tiger@host1-vip:1522/RACDB/RACDB2

Also, the optional [:server] is either dedicated or shared.

CONNECT scott/tiger@host1-vip:1522/RACDB:dedicated/RACDB1

Reference: http://download.oracle.com/docs/cd/B28359_01/network.111/b28316/naming.htm#NETAG255

, , , , , , , , ,

3 Responses to Easy Connect (EZCONNECT) Naming Method with Instance Name

  1. Laurent Schneider February 15, 2011 at 6:31 am #

    Also note that the slash may be misinterpreted as username/password separator…

    SQL> connect scott/tiger@srv01:1521/DB01
    SQL> connect scott@srv01:1521/DB01
    ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA

    Warning: You are no longer connected to ORACLE.
    SQL> connect scott@'srv01:1521/DB01'
    Enter password: *****

    • ittichai February 15, 2011 at 11:38 am #

      That’s true. Thanks for pointing that out.


  1. Tweets that mention OraExplorer » Easy Connect (EZCONNECT) Naming Method with Instance Name -- Topsy.com - February 15, 2011

    […] This post was mentioned on Twitter by ψ ♥̤̣̈ JIB ﻬ ψ ☆۩ and n@hmk@hw Butarat, Oracle in Thai. Oracle in Thai said: วิธีการใช้ Easy Connect (EZCONNECT) ในการ connect DB อย่างรวดเร็ว http://j.mp/gvlOhs #oracle […]

Leave a Reply

Powered by WordPress. Designed by WooThemes