Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: script
"Pons" <pons_at_gmx.li> wrote in message news:<b0u2ne$t5jeo$1_at_ID-172702.news.dfncis.de>...
> Greetings
> I am gonna switch to new Orcale system with load balance,
> due to that I have to change the Alias and HOST IP in all
> tnsnames of my remote users, I do not want to do it manually.
> I want to write a script to search for tnsnames file in a remote
> local machines C: and D: and replace it with a new tnsnames,
> then I am going place this script on my Intranet web page so
> by double click the script can execute this take automatically
> and place the file with a new one.
>
> any help in this issue.
>
> -Pons
> pons_at_gmx.li
>
> old tnsnames
> ......
> ora.world =
> (DESCRIPTION =
> (ADDRESS_LIST =
> (ADDRESS =
> (PROTOCOL = TCP)
> (Host = A.B.C.D)
> (Port = 1521)
> )
> )
> (CONNECT_DATA = (SID = COMPANY)
> )
> )
>
> new alias
> risc.world =
> (DESCRIPTION=
> (load_balance=on)
> (ADDRESS=
> (PROTOCOL=TCP)
> (Host=X.X.X.X)
> (Port=1521)
> )
> (ADDRESS=
> (PROTOCOL=TCP)
> (Host=Y.Y.Y.Y)
> (Port=1521)
> )
>
> (CONNECT_DATA=
> (SERVICE_NAME=COMPANY)
>
> )
> )
And how do you expect Oracle server/Sqlplus/PLSQL to handle this? You might want to post it in some scripting language NG like Perl, WinBatch etc. But since you are here, I'll take a stab at it.
Approach 1:
Just the way you want to do it. Write a script which connects to
client machine, finds correct tnsnames.ora file, replaces the entry.
Doable but bit of a scripting work. I use WinBatch
http://www.winbatch.com scripting tool a lot on Windoze and I have not
seen a more powerfull tool to do stuff like this. A while back I wrote
a tnsnames.ora parser in Java and Winbatch. The one in Winbatch does
almost the same thing except replace the entry. Sorry can't share the
code...company property.
Approach 2:
Assuming all clients have identical tnsnames.ora files. Write a new
tnsnames.ora file and put it in everyone's logon script. Next time
they logon to the network, let the script replace the file.
Approach 3:
Use TNS_ADMIN system variable to point all client machines to one
central location where you can have one copy of all configuration
files (sqlnet.ora, tnsnames.ora) files. No fuss, no hassles. Modify
one file and all clients use same file to connect.
Take your pick but I personally like Approach 3.
Regards
/Rauf Sarwar
Received on Sat Jan 25 2003 - 20:06:09 CST
![]() |
![]() |