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 thoughts on “Easy Connect (EZCONNECT) Naming Method with Instance Name”

  1. Pingback: Tweets that mention OraExplorer » Easy Connect (EZCONNECT) Naming Method with Instance Name -- Topsy.com

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


    SQL> connect scott/tiger@srv01:1521/DB01
    Connected.
    SQL> connect scott@srv01:1521/DB01
    ERROR:
    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: *****
    Connected.
    SQL>

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top