Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Dump ldap into tnsnames.ora ? (automatically)
> 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
![]() |
![]() |