Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Merging tnsnames.ora for two databases

Jibba JabbaJul 26 2016 — edited Jul 27 2016

Hi,

I've just installed 12c and so I now have 11gR2 and 12c installed in the same oracle base directory.

Of course, as things stand, they each are using their own tnsnames.ora.

It was too much to expect I could just run "conn /@orcl12" in my existing sqlplus (11g) session.  It was never going to work :-/

SYS@ORCL> conn /@orcl12

ERROR:

ORA-12154: TNS:could not resolve the connect identifier specified

Warning: You are no longer connected to ORACLE.

SYS@ORCL>

I just took at look at the 12c tnsnames.ora file and it's not even listening on the same port, which was a surprise..I thought both databases would be listening on the same port (1521):

# tnsnames.ora Network Configuration File: C:\oracleee\product\12.1.0\dbhome_12\network\admin\tnsnames.ora

# Generated by Oracle configuration tools.

ORACLR_CONNECTION_DATA =

  (DESCRIPTION =

    (ADDRESS_LIST =

      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1522))

    )

    (CONNECT_DATA =

      (SID = CLRExtProc)

      (PRESENTATION = RO)

    )

  )

ORCL12 =

  (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1522))

    (CONNECT_DATA =

      (SERVER = DEDICATED)

      (SERVICE_NAME = orcl12)

    )

  )

LISTENER_ORCL12 =

  (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1522))

My 11g tnsnames.ora is:

# tnsnames.ora Network Configuration File: C:\oracleee\product\11.2.0\dbhome_1\network\admin\tnsnames.ora

# Generated by Oracle configuration tools.

LISTENER_ORCL =

  (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))

ORACLR_CONNECTION_DATA =

  (DESCRIPTION =

    (ADDRESS_LIST =

      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))

    )

    (CONNECT_DATA =

      (SID = CLRExtProc)

      (PRESENTATION = RO)

    )

  )

ORCL =

  (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))

    (CONNECT_DATA =

      (SERVER = DEDICATED)

      (SERVICE_NAME = orcl)

    )

  )

Can anybody tell me is it possible that I can do something with these files so that in sqlplus I can do something like:

conn scott@orcl12

or

conn scott@orcl

?

I.e. connect to either one database or the other from teh same sqlplus session. Is that possible?  Should be, yes?  This listener/tnsnames stuff seems to be a bit of a dark art.

Thanks a lot.

This post has been answered by EdStevens on Jul 27 2016
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 24 2016
Added on Jul 26 2016
15 comments
4,235 views