Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: How to programatically/dynamically update tnsnames.ora
Hi All,
Thanks for all of you for giving me various useful suggestions. For me
the chucks solution looked very simple and its working as i need to
create dynamically
Never attempted to update tnsnames.ora dynamically, but you can
specify
the TNS address instead of the alias in your "create database link"
command. Have you tried that?
CREATE DATABASE LINK mylink
CONNECT TO user IDENTIFIED BY password
USING '(description=(address=(protocol=tcp)(host=yourhost)(port=1521))
(connect_data=(service_name=yourServiceName)))'
Note that the "USING" line is all on one line.
This is reaallly coooool.. forgot that alias is just a matter of convenience
-thx,
avsrk
"Ana C. Dent" <anacedent_at_hotmail.com> wrote in message news:<5DhWa.33213$Ne.23188_at_fed1read03>...
> Subrahmanyam Arya wrote:
>
> > Dear oracle gurus,
> >
> > This is exactly my scenario. I have a java application which talks to
> > Master oracle DB. From with in this java application, i create
> > database links to remote oracle databases and do queries. the database
> > links are dynamically created as and when new remote database comes
> > up.
> > Presently we are distributing this application and are having the
> > customers edit the tnsnames.ora either manually or use them netasst
> > (SQL Net configurator)
> >
> > But eventually we do not want them to edit manually.
> >
> > Has anybody attempted to programatically update the tnsnames.ora
> > either using a unix script or from inside java. are there any bad
> > consequences to doing this.
> >
> > Previously i had miserable experience with editing this file manually
> > and things did not work until i used netasst (SQL Net program).
> >
> > Another reason why we donot want customers to edit tnsnames / use SQL
> > Net is licensing restrictions and contractual obligations. We got
> > oracle licenses for cheap and we cannot expose oracle or expect the
> > end user to do any kind of DBA activity
> >
> > So what i am looking for is some easy custom script / tool that does
> > exactly what SQL.Net does to tnsnames.ora
> >
> > -thx,
> > avsrk
> Once again NO Oracle version & no OS name or version. :-(
>
> Under Unix a couple of options might work as a solution.
>
> 1) cat my_custom_tns.ora >> /var/opt/oracle/tnsnames.ora
>
> 2) If the application is owned by some neutral account,
> then placing a .tnsnames.ora the "home" directory with
> the customizations will get used before any of usual
> locations.
Received on Mon Aug 04 2003 - 09:57:05 CDT