Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Dump ldap into tnsnames.ora ? (automatically)

Re: Dump ldap into tnsnames.ora ? (automatically)

From: <yong321_at_yahoo.com>
Date: 8 Dec 2005 15:06:56 -0800
Message-ID: <1134083216.686109.250770@g14g2000cwa.googlegroups.com>


> We are using ldap naming (oracle internet directory for name
> resolution).
>
> Is there a command to dump the whole ldap into a tnsnames.ora ?
> (we need to generate this file automatically with a batch)

Jean-Michel,

Here's a quick and dirty way to get the tnsnames.ora file. I use Softerra Ldap Browser to connect to OID. Navigate to cn=OracleContext,(dc=youroptionalsubdomain,)dc=yourdomain,dc=com(or edu,gov,etc)
Edit or right click the node and select LDIF Export to export to a file named OracleContext.ldif. You can choose One Level Only.

Assume your database connection strings are always the same as their service names:

C:\>perl -nle "if(/^orclnetdescstring:
(.*service_name\s*=\s*([^.)]+).*)/i){print \"$2 =\n $1\"}" OracleContext.ldif > tnsnames.ora

And assume some of your database connection strings are the same as SID names:
C:\>perl -nle "if(/^orclnetdescstring:
(.*SID\s*=\s*([^.)]+).*)/i){print \"$2 =\n $1\"}" OracleContext.ldif >> tnsnames.ora

If you don't have Perl, just put OracleContext.ldif on a UNIX box and run Perl there. Feel free to make the TNS entries look nicer. But some indentations are necessary.

Yong Huang Received on Thu Dec 08 2005 - 17:06:56 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US