Re: TNS alias synonym entry

From: Mladen Gogala <gogala.mladen_at_gmail.com>
Date: Tue, 26 May 2020 19:26:53 -0400
Message-ID: <73c54054-6dff-01cf-7b29-d6889efd11eb_at_gmail.com>



Yes, it is possible to alias a TNS connection name. It's done like this:

*ORA19c.HOME.COM, alias.home.com =

   (DESCRIPTION =
     (ADDRESS_LIST =
       (ADDRESS = (PROTOCOL = TCP)(HOST = ora19c.home.com)(PORT = 1521))
     )
     (CONNECT_DATA =
       (SERVER = DEDICATED)
       (SERVICE_NAME = orclpdb1.home.com)
     )
    )*

*So, now I have 2 names listed in the tnsnames.ora. Let's try connecting to them:*

*mgogala_at_umajor:/usr/local/tns$ sql scott/tiger_at_ora19c

SQLcl: Release 19.4 Production on Tue May 26 19:17:08 2020

Copyright (c) 1982, 2020, Oracle.  All rights reserved.

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.7.0.0.0

SQL>
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.7.0.0.0

*

*mgogala_at_umajor:/usr/local/tns$ sql scott/tiger_at_alias

SQLcl: Release 19.4 Production on Tue May 26 19:19:34 2020

Copyright (c) 1982, 2020, Oracle.  All rights reserved.

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.7.0.0.0

SQL>
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.7.0.0.0
*

*As you can see, both TNS entries work as advertised. I'm not quite sure what are you trying to do with "MONIT" entries?*

*Regards
*

On 5/26/20 10:07 AM, Luis Claudio Dias dos Santos wrote:
> Is is possible to define a TNS alias /synonym/? Despite the confuse it
> seems, I will explain.
>
> We have a LDAP server serving most of our TNS names resolutions.
>
> But in a specific case I want a special TNS entry, called MONIT, be
> resolved different in different servers. So I can't use LDAP.
>
> The most usual way to do is to create a FULL TNS entry, in each
> defined servers, with different MONITs entries. For example:
>
> *server 1:*
> *
> *
>
> *MONIT =
> **   (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST =
> someserver01)(PORT = 1521))
> **     (CONNECT_DATA =
> **     (SERVER = DEDICATED)
> **      (SERVICE_NAME = DB01)
> **   )
> ** )*
>
>
> *server 2:*
> *
> *
>
> *MONIT =
> **   (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST =
> someserver02)(PORT = 1521))
> **     (CONNECT_DATA =
> **     (SERVER = DEDICATED)
> **      (SERVICE_NAME = DB02)
> **   )
> ** )*
>
>
> But this entries, for DB01 and DB02 service names, are well defined on
> LDAP server with some other alias:
>
> *$ tnsping DB01*
>
> *
> *
>
> *Used LDAP adapter to resolve the alias
> **Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL =
> TCP)(HOST =  someserver01)(PORT = 1521)) (CONNECT_DATA = (SERVER =
> DEDICATED) (SERVICE_NAME = DB01)))
> **OK (10 msec) *
>
> *
> *
>
> *$ tnsping DB02
> **Used LDAP adapter to resolve the alias
> **Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL =
> TCP)(HOST =  someserver02)(PORT = 1521)) (CONNECT_DATA = (SERVER =
> DEDICATED) (SERVICE_NAME = DB02)))
> **OK (10 msec)*
>
>
> SO, I want locally, on TNSNAMES.ORA, with of course SQLNET.ORA
> containing *NAMES.DIRECTORY_PATH= (TNSNAMES,LDAP)*, the following in
> local TNSNAMES.ORA:
>
> *server 1:*
>
> *MONIT = DB01*
>
>
> *server 2:
> *
> *
> *
>
> *MONIT = DB02*
>
>
> But this does not work...
>
>
>
>

-- 
Mladen Gogala
Database Consultant
Tel: (347) 321-1217


--
http://www.freelists.org/webpage/oracle-l
Received on Wed May 27 2020 - 01:26:53 CEST

Original text of this message