[DB-SIG] cx_Oracle: getting names of present TNS entries
Andy Todd
andy47 at halfcooked.com
Sat Feb 10 08:55:59 CET 2007
Harald Armin Massa wrote:
> Hello,
>
> is there a fine method to query the defined TNS-names on a computer?
>
> with "fine" I am asking for something higherlevel then "find
> tnsnames.ora, parse it"
>
> Harald
>
>
> --
> GHUM Harald Massa
> persuadere et programmare
> Harald Armin Massa
> Reinsburgstraße 202b
> 70197 Stuttgart
> 0173/9409607
> fx 01212-5-13695179
> -
> Python: the only language with more web frameworks than keywords.
>
Not to my knowledge no. As far as I'm aware both SQL Developer and TOAD
do exactly that.
Of course it gets trickier if you've got multiple Oracle homes and
therefore more than one tnsnames.ora file.
It also depends on what you are trying to find out. Don't forget that
tnsnames.ora entries are essentially just aliases and any given
tnsnames.ora file can contain multiple entries pointing to the same
physical database. Also that it is possible to have a 'name' in your
tnsnames.ora file that is completely different to the one the database
knows itself as.
If you are trying to find out 'which aliases does this computer know
about that I can connect to' then you can just parse the file. If it's
'what databases can I get to' then you need to parse the file and then
verify which database each entry is connecting to (either through the
details of the entry in the file or actually connecting and
interrogating something like V$DATABASE).
HTH,
Andy
--
--------------------------------------------------------------------------------
From the desk of Andrew J Todd esq - http://www.halfcooked.com/
More information about the DB-SIG
mailing list