Home » Other » Marketplace » McTnsping: a tnsping-like program for Windows (Oracle: all versions, OS: MS/Windows all versions)
McTnsping: a tnsping-like program for Windows [message #648221] Thu, 18 February 2016 12:02 Go to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

I have posted a tnsping-like program in our tnsping wiki page.
This is a Windows stand-alone program which requires no Oracle client.
It implements easy connect strings, tnsnames.ora or ldap resolution method.
The help is the following one:
C:\>McTnsping -h

McTnsping Utility by Michel Cadot: Version 2023.07.11 on 11-JUIL.-2023 09:53:10

Copyright (c) Michel Cadot, 2016-2023. All rights reserved.

Usage 1: McTnsping.exe { <tns entry> | <host>:<port> } [<count>]

with
  <tns entry>    Gives the net service name in the tnsnames.ora file or ldap server.
  <host>:<port>  Give the server name or IP and port (which is mandatory).
  <count>        Sets the number of times the program checks the target, default is 1.

Usage 2: McTnsping.exe
        { -h |
          { -s <host>[:<port>] | -t <tns entry> }
          [-v { 8 | 9 | 10 | 11 | 12 | 12.2 | 18 | 19 | 21 }]
          [-dir <tnsnames.ora directory>]
          [-tim <timeout>] [-c <count>]
          [-rc { 0 | 1 | OR | AND }]
        }

with
  -c <count>             Sets the number of times the program checks the target,
                           default is 1.
  -dir <directory>       Gives the directory for *.ora files;
                           this option is ignored if "-s" option is given.
  -h                     Displays the version and the usage help.
  -s <host>[:<port>]     Gives the server name or IP and port to check the listener,
                           default port is 1521.
  -rc { 0 | 1 | OR | AND }
                         Gives how McTnsping return code would be in case of multiple
                           addresses in the tns entry, default value is AND=1.
  -t <tns entry>         Gives the net service name.
  -tim <timeout>         Gives the timeout (in seconds) on connection to listener,
                           default is 5 seconds.
  -v { 8 | 9 | 10 | 11 | 12 | 12.2 | 18 | 19 | 21 }
                         Selects the version of the simulated tnsping, default is 11.

"-s" and "-t" options are exclusive.

If "-t" is choosen, the program searches for *.ora files:
* if "-dir" option is given, in this directory.
* otherwise, first in TNS_ADMIN directory if set, then in ORACLE_HOME/network/admin.
Note: a program restriction is that a tnsnames.ora entry must be at the beginning of
a line (maybe preceded by spaces).
Note: a program restriction is that it connects to the LDAP server using an
anonymous bind (NAMES.LDAP_AUTHENTICATE_BIND sqlnet.ora parameter is ignored).

When there is only one address in the tns entry, McTnsping return code is 0 if the
ping was successful and 1 otherwise.
If there are multiple addresses in the tns entry, McTnsping checks all of them, "-rc"
option tells what can be the return code in cases of some addresses work and others
not. "AND" and "1" mean the return should be 1 in this case, "OR" and "0" the
return code should be 0.
So return code is 1, if at least one address is unsuccessful with option "AND" or "1";
and return code is 0, if at least one address is successful with option "OR" or "0".

The program is provided as it is without any guarantees or warranty. Although the
author has attempted to find and correct any bugs in this free program, the author
is not responsible for any damage or losses of any kind caused by the use or misuse
of the program. The author is under no obligation to provide support, service,
corrections, or upgrades to this program.

You can freely use, copy and distribute this program but you can't modify it without
the permission of the author you can contact on http://www.orafaq.com
You can post your comments, ask for improvements, report bugs... on the program at
http://www.orafaq.com/forum/t/200058/
I encourage you to subscribe to this topic (link at top of the page) if you want to
be informed when a new version is released.
Here's an example of its usage compared to the same tnsping output (I have cut the end of entry description lines):
C:\>tnsping mikb 3

TNS Ping Utility for 32-bit Windows: Version 10.2.0.4.0 - Production on 18-FÉVR.-2016 19:57:44

Copyright (c) 1997,  2007, Oracle.  All rights reserved.

Used parameter files:
E:\oracle\ora102\network\admin\sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = ...
OK (30 msec)
OK (30 msec)
OK (50 msec)

C:\>McTnsping mikb 3

McTnsping Utility by Michel Cadot: Version 2023.06.29 on 29-JUIN-2023 16:03:43

Copyright (c) Michel Cadot, 2016-2021. All rights reserved.

Using ping version 11

Used parameter files:
e:\sqlnet.ora

Used LDAP adapter to resolve the alias:
e:\ldap.ora

Found entry:
(DESCRIPTION=
  (ADDRESS_LIST=
    (ADDRESS=
      (PROTOCOL=TCP)
      (HOST=ILLUVATAR)
      (PORT=1531)))
  (CONNECT_DATA=
    (SERVICE_NAME=MIKB.ILLUVATAR)
    (SERVER=DEDICATED)))

Attempting to contact ILLUVATAR:1531
OK (15 msec)
OK (12 msec)
OK (12 msec)
Note: a small difference with Oracle tnsping is that if the tnsnames.ora entry contains several ADDRESS parts, McTnsping reports the result of all addresses and not only the first one which works.
So if you want to test all your listeners in a single command you can reference all of them in a single tnsnames.ora entry like the following one (it does not even need the tnsnames.ora entry to be complete, it only have to contain the IP/hostname and the port number):
ALL_LISTENERS = 
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.7)(PORT = 1528))
        (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.7)(PORT = 1529))
        (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.7)(PORT = 1530))
        (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.7)(PORT = 1531))
        (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.9)(PORT = 1531))
        (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.3)(PORT = 1531))
        (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.3)(PORT = 1532))
        (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.3)(PORT = 1533))
        (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.3)(PORT = 1538))
      )
    )
  )
Then:
C:\>McTnsping -dir c: -t all_listeners

cTnsping Utility by Michel Cadot: Version 2023.06.29 on 29-JUIN-2023 16:06:51

opyright (c) Michel Cadot, 2016-2021. All rights reserved.

sing ping version 11

sed parameter files:
 No known name methods found in sqlnet.ora; trying TNSNAMES

sed TNSNAMES adapter to resolve the alias:
:\tnsnames.ora

ound entry:
DESCRIPTION_LIST=
 (DESCRIPTION=
   (ADDRESS_LIST=
     (ADDRESS=
       (PROTOCOL=TCP)
       (HOST=192.168.1.7)
       (PORT=1528))
     (ADDRESS=
       (PROTOCOL=TCP)
       (HOST=192.168.1.7)
       (PORT=1529))
     (ADDRESS=
       (PROTOCOL=TCP)
       (HOST=192.168.1.7)
       (PORT=1530))
     (ADDRESS=
       (PROTOCOL=TCP)
       (HOST=192.168.1.7)
       (PORT=1531))
     (ADDRESS=
       (PROTOCOL=TCP)
       (HOST=192.168.1.9)
       (PORT=1531))
     (ADDRESS=
       (PROTOCOL=TCP)
       (HOST=192.168.1.9)
       (PORT=1532))
     (ADDRESS=
       (PROTOCOL=TCP)
       (HOST=192.168.1.3)
       (PORT=1531))
     (ADDRESS=
       (PROTOCOL=TCP)
       (HOST=192.168.1.3)
       (PORT=1532))
     (ADDRESS=
       (PROTOCOL=TCP)
       (HOST=192.168.1.3)
       (PORT=1533))
     (ADDRESS=
       (PROTOCOL=TCP)
       (HOST=192.168.1.3)
       (PORT=1538)))))
Attempting to contact 192.168.1.7:1528
OK (23 msec) -- listener version 8.1.7.4.0
Attempting to contact 192.168.1.7:1529
OK (17 msec) -- listener version 9.2.0.8.0
Attempting to contact 192.168.1.7:1530
OK (12 msec)
Attempting to contact 192.168.1.7:1531
OK (12 msec)
Attempting to contact 192.168.1.9:1531
TNS-12541: TNS:no listener
Attempting to contact 192.168.1.3:1531
OK (531 msec)
Attempting to contact 192.168.1.3:1532
OK (8 msec)
Attempting to contact 192.168.1.3:1533
OK (19 msec)
Attempting to contact 192.168.1.3:1538
OK (7 msec)
Latest version: 2023.07.11, download in tnsping wiki page
MD5:   defe9f0ed184bc7bf501b85e565a145b
SHA-1: 85eca3e3bb74c4cc32769591b0d4e0aa02e4cf94

[Updated on: Tue, 11 July 2023 03:27]

Report message to a moderator

Re: McTnsping: a tnsping-like program for Windows [message #661893 is a reply to message #648221] Wed, 05 April 2017 07:54 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

New version with full 12cR1 support.

[Updated on: Wed, 05 April 2017 09:09]

Report message to a moderator

Re: McTnsping: a tnsping-like program for Windows [message #663798 is a reply to message #661893] Tue, 20 June 2017 10:10 Go to previous messageGo to next message
jeng1111
Messages: 1
Registered: June 2017
Junior Member
Great utility! Thanks for sharing. It does not resolve host names for me, I need to use it with IP addresses, but still a wonderful standalone for Oracle listener troubleshooting!
Re: McTnsping: a tnsping-like program for Windows [message #663799 is a reply to message #663798] Tue, 20 June 2017 11:43 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Have you any error with host names?
Are the following displayed lines:
- "Found tnsnames.ora entry" (if you used a tnsnames.ora entry)
- "Attempting to connect..."
show the correct connect information?
Can you ping the host name from where you executed McTnsping?

If you share your error, I will (may) be able to fix it for everyone.

Re: McTnsping: a tnsping-like program for Windows [message #663873 is a reply to message #663799] Thu, 22 June 2017 06:38 Go to previous messageGo to next message
_jum
Messages: 577
Registered: February 2008
Senior Member
Load and tested the program, but with no success, got no output:

C:\>McTnsping -h
C:\>

Michel, what am I doing wrong?

PS:
MD5 checksum of McTnsping.exe, the only fiel in McTnsping.zip is
afea32c6270a4b2e1537d61a783aa433


[Updated on: Thu, 22 June 2017 06:38]

Report message to a moderator

Re: McTnsping: a tnsping-like program for Windows [message #663877 is a reply to message #663873] Thu, 22 June 2017 07:30 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

MD5 is correct (I will add it to the top message).
The program uses your TEMP directory, is it set?
The program is self-sufficient, try to execute it clearing PATH, *LIB environment variables.
Which Windows version have you?

Re: McTnsping: a tnsping-like program for Windows [message #663878 is a reply to message #663877] Thu, 22 June 2017 10:34 Go to previous messageGo to next message
_jum
Messages: 577
Registered: February 2008
Senior Member
TEMP was set. After clearing PATH it runs fine Smile

Will test it in the next days.
Thanks for sharing!!
Re: McTnsping: a tnsping-like program for Windows [message #663879 is a reply to message #663878] Thu, 22 June 2017 10:42 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

TEMP can be set but it must be set to a directory on which you have full accesses.

Re: McTnsping: a tnsping-like program for Windows [message #665715 is a reply to message #663879] Sun, 17 September 2017 05:08 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

New version with full 12cR2 support.

Re: McTnsping: a tnsping-like program for Windows [message #665755 is a reply to message #665715] Wed, 20 September 2017 01:03 Go to previous messageGo to next message
Frank Naude
Messages: 4579
Registered: April 1998
Senior Member
I assume one will be able to use Michel's program to quickly test if a firewall is allowing/blocking traffic between a client and a database server.
Re: McTnsping: a tnsping-like program for Windows [message #667743 is a reply to message #665755] Fri, 12 January 2018 09:42 Go to previous messageGo to next message
SimacSE
Messages: 3
Registered: January 2018
Junior Member
Hi Michel. Thanks for your tool. Smile
I've encountered one issue however. If the entry in the tnsnames.ora is a complete single line, mctnsping gets confused and starts using a different entry.

Example tnsnames.ora:

Quote:

TEST01 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = blah1)(PORT = 1521)) (CONNECT_DATA = (SERVICE_NAME = TEST01)))
TEST02 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = blah2)(PORT = 1522)) (CONNECT_DATA = (SERVICE_NAME = TEST02)))

Run:

Quote:

PS P:\NetworkCheck> .\McTnsping.exe -dir p:\networkcheck -t test01

McTnsping Utility by Michel Cadot: Version 2017.09.17 on 12-JAN-2018 16:35:03

Copyright (c) Michel Cadot, 2016-2017. All rights reserved.

Used parameter files:
p:\networkcheck\sqlnet.ora
p:\networkcheck\tnsnames.ora

Found tnsnames.ora entry:
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=blah2)(PORT=1522))(CONNECT_DATA=(SERVICE_NAME=TEST02)))

Attempting to contact blah2:1522
TNS-12541: TNS:no listener

As soon as I start the description on a new line, it works:

Quote:

TEST01 =
(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = blah1)(PORT = 1521)) (CONNECT_DATA = (SERVICE_NAME = TEST01)))

TEST02 =
(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = blah2)(PORT = 1522)) (CONNECT_DATA = (SERVICE_NAME = TEST02)))

Quote:

PS P:\NetworkCheck> .\McTnsping.exe -dir p:\networkcheck -t test01

McTnsping Utility by Michel Cadot: Version 2017.09.17 on 12-JAN-2018 16:39:48

Copyright (c) Michel Cadot, 2016-2017. All rights reserved.

Used parameter files:
p:\networkcheck\sqlnet.ora
p:\networkcheck\tnsnames.ora

Found tnsnames.ora entry:
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=blah1)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=TEST01)))

Attempting to contact blah1:1521
TNS-12541: TNS:no listener
Re: McTnsping: a tnsping-like program for Windows [message #667746 is a reply to message #667743] Fri, 12 January 2018 11:28 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Thanks for the feedback.
Yes, the simplest test is always the one that fails. Sad

I will soon fix it and provide a new version of the program.
For now you know the workaround: there must be a new line anywhere in the entry after the entry name and before the last character before the final right parentheses. Smile
In your example:
TEST01 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = blah1)(PORT = 1521)) (CONNECT_DATA = (SERVICE_NAME = TEST01))) 
     ^-- after this character and .......................................................... before this character --^
Re: McTnsping: a tnsping-like program for Windows [message #667755 is a reply to message #667746] Sat, 13 January 2018 04:47 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

The new version fixing the bug is available (see link in the first post of this topic).

Note: an entry must start at the beginning of a line (maybe preceded by spaces), i.e. there can't be multiple entries in a single line. This is a program restriction which is also a restriction of Oracle tnsping (although McTnsping can use the first entry of the line whereas Oracle tnsping can't and returns an error).

Re: McTnsping: a tnsping-like program for Windows [message #667774 is a reply to message #667755] Mon, 15 January 2018 02:46 Go to previous messageGo to next message
SimacSE
Messages: 3
Registered: January 2018
Junior Member
Hi Michel. Thanks for the quick update! Smile

I just tested it, and it works fine. However... Smile
Some still didn't work right and I managed to pinpoint it to comment lines.

This TNSNAMES.ORA:

Quote:

# Added blah1, blah2
blah1 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = blah1)(PORT = 1521)) (CONNECT_DATA = (SERVICE_NAME = blah1)))
blah2 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = blah2)(PORT = 1522)) (CONNECT_DATA = (SERVICE_NAME = blah2)))
Leads to a similar issue:

Quote:

P:\NetworkCheck>McTnsping.exe -dir p:\networkcheck -t blah2

McTnsping Utility by Michel Cadot: Version 2018.01.13 on 15-JAN-2018 09:40:27

Copyright (c) Michel Cadot, 2016-2018. All rights reserved.

Used parameter files:
p:\networkcheck\sqlnet.ora
p:\networkcheck\tnsnames.ora

Found tnsnames.ora entry:
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=blah1)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=blah1)))

Attempting to contact blah1:1521
TNS-12541: TNS:no listener

If I change blah2 in the comment to something like blah22, blah2 becomes pingable again.

Regards,
Ruud


Re: McTnsping: a tnsping-like program for Windows [message #667776 is a reply to message #667774] Mon, 15 January 2018 03:25 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Aargh! Comments are syntax analyzer killer. Smile

I will fix that today.
Thanks for your cooperation in this software.

Re: McTnsping: a tnsping-like program for Windows [message #667777 is a reply to message #667776] Mon, 15 January 2018 04:10 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

New version supporting comments in tnsnames.ora is available.

Re: McTnsping: a tnsping-like program for Windows [message #667782 is a reply to message #667777] Mon, 15 January 2018 10:05 Go to previous messageGo to next message
SimacSE
Messages: 3
Registered: January 2018
Junior Member
Hi Michel,

It works! Smile
Thanks for the quick update once again!

Quote:
Thanks for your cooperation in this software.

You're welcome. Smile

Regards,
Ruud
Re: McTnsping: a tnsping-like program for Windows [message #671219 is a reply to message #648221] Fri, 17 August 2018 06:45 Go to previous messageGo to next message
ProWalrus
Messages: 2
Registered: August 2018
Junior Member
Mike!

McTnsping is a great idea - already has helped and I've only had it 5 minutes! But... looks like you still have a comments-related bug in there someplace.

This is my TNSNames.ora content:


#TCORACLE.WORLD = (DESCRIPTION= (ADDRESS = (PROTOCOL = TCP)(HOST = orafdb01.mysystems.com)(PORT = 1521))
# (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orafdb01.mysystems.com)))


ORCLWGA1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = Hyper-W7-Ora12c.mysystems.com)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = ORCLWGA1.world)
)
)

N.B.: the blanks preceding the 2nd+ line of the real entry above were collapsed when this posted.

...and this is my McTnsping operation:

C:\Users\wande\Downloads\McTnsping>mctnsping orclWGA1

McTnsping Utility by Michel Cadot: Version 2018.01.15 on 17-AUG-2018 07:17:43

Copyright (c) Michel Cadot, 2016-2018. All rights reserved.

Used parameter files:
C:\app\wgand\product\11.2.0\client_32\network\admin\sqlnet.ora
C:\app\wgand\product\11.2.0\client_32\network\admin\tnsnames.ora

Found tnsnames.ora entry:
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=orafdb01.mysystems.com)(PORT=1521))#(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orafdb01. mysystems.com)))

Attempting to contact orafdb01.mysystems.com:1521
TNS-12541: TNS:no listener

C:\Users\wande\Downloads\McTnsping>

... as you can see, those pesky comments are still something of an issue. And you are right! Dealing with comments in an (otherwise) parsable file is a pain!

Using the latest 2018-01-15 McTnsping.exe, and it is pointed to the correct TNSNAMES.ora file (content shown).

Re: McTnsping: a tnsping-like program for Windows [message #671226 is a reply to message #671219] Fri, 17 August 2018 08:18 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Here's what I get copying and pasting what you posted in a file:
C:\>type c:\tnsnames.ora
#TCORACLE.WORLD = (DESCRIPTION= (ADDRESS = (PROTOCOL = TCP)(HOST = orafdb01.mysystems.com)(PORT = 1521))
#                               (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orafdb01.mysystems.com)))


ORCLWGA1 =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = Hyper-W7-Ora12c.mysystems.com)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = ORCLWGA1.world)
    )
  )

C:\>McTnsping -t orclWGA1 -dir c:

McTnsping Utility by Michel Cadot: Version 2018.01.15 on 17-AOÛT-2018 15:01:30

Copyright (c) Michel Cadot, 2016-2018. All rights reserved.

Used parameter files:
c:\tnsnames.ora

Found tnsnames.ora entry:
(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=Hyper-W7-Ora12c.mysystems.com)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=ORCLWGA1.world)))

Attempting to contact Hyper-W7-Ora12c.mysystems.com:1521
TNS-12545: Connect failed because target host or object does not exist


Quote:
N.B.: the blanks preceding the 2nd+ line of the real entry above were collapsed when this posted.
You can avoid this using tags as explain in How to use [code] tags and make your code easier to read.


[Updated on: Fri, 17 August 2018 08:33]

Report message to a moderator

Re: McTnsping: a tnsping-like program for Windows [message #671228 is a reply to message #671226] Fri, 17 August 2018 08:30 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

I get what you got inserting the commented CONNECT_DATA inside the ORCLWGA1 entry:
C:\>type c:\tnsnames.ora
ORCLWGA1 =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = Hyper-W7-Ora12c.mysystems.com)(PORT = 1521))
    )
#                               (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orafdb01.mysystems.com)))
    (CONNECT_DATA =
      (SERVICE_NAME = ORCLWGA1.world)
    )
  )



C:\>McTnsping -t orclWGA1 -dir c:

McTnsping Utility by Michel Cadot: Version 2018.01.15 on 17-AOÛT-2018 15:22:08

Copyright (c) Michel Cadot, 2016-2018. All rights reserved.

Used parameter files:
c:\tnsnames.ora

Found tnsnames.ora entry:
(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=Hyper-W7-Ora12c.mysystems.com)(PORT=1521)))#(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orafdb01.mysystems.com)))

Attempting to contact Hyper-W7-Ora12c.mysystems.com:1521
TNS-12545: Connect failed because target host or object does not exist
So sure, there's a bug with these bl... comments, I will fix it as soon as possible (most likely this week-end), thanks for finding it. Smile

[Updated on: Fri, 17 August 2018 08:31]

Report message to a moderator

Re: McTnsping: a tnsping-like program for Windows [message #671229 is a reply to message #671228] Fri, 17 August 2018 08:36 Go to previous messageGo to next message
ProWalrus
Messages: 2
Registered: August 2018
Junior Member
Mike,

You are welcome; all programmers hate it folks find bugs, but we also are grateful for the input (usually!).

Interesting that it behaves differently for me than it does for you... any suggestions as to why my experience is different from yours? I would be happy to try some additional tests if that would be helpful for you.

McTnsping is a great tool, it really does help a lot in isolating client/instance communication problems! I'll also note the CODE "tag" in future posts.
Re: McTnsping: a tnsping-like program for Windows [message #671230 is a reply to message #671229] Fri, 17 August 2018 08:48 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Quote:
any suggestions as to why my experience is different from yours?
No, I don't know, I first thought this is because your end of lines are just LF instead of the Windows CR+LF, but nope, my program supports both.
Maybe you can attach the complete file as it is so I can study how the program behaves with it.


Re: McTnsping: a tnsping-like program for Windows [message #671231 is a reply to message #671230] Fri, 17 August 2018 08:53 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

You can also PM it to me (clicking on the PM button below) if you don't want the file to be public.

Re: McTnsping: a tnsping-like program for Windows [message #671235 is a reply to message #671231] Fri, 17 August 2018 10:23 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

The new version fixing the bug is available (see link in the first post of this topic).

I tested the program with the following humanly unreadable entry (putting your comments everywhere iside your entry Smile ):
C:\>type c:\tnsnames.ora
#TCORACLE.WORLD = (DESCRIPTION= (ADDRESS = (PROTOCOL = TCP)(HOST = orafdb01.mysystems.com)(PORT = 1521))
# (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orafdb01.mysystems.com)))


ORCLWGA1 =
#TCORACLE.WORLD = (DESCRIPTION= (ADDRESS = (PROTOCOL = TCP)(HOST = orafdb01.mysystems.com)(PORT = 1521))
# (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orafdb01.mysystems.com)))

  (DESCRIPTION = #TCORACLE.WORLD = (DESCRIPTION= (ADDRESS = (PROTOCOL = TCP)(HOST = orafdb01.mysystems.com)(PORT = 1521))
# (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orafdb01.mysystems.com)))


#TCORACLE.WORLD = (DESCRIPTION= (ADDRESS = (PROTOCOL = TCP)(HOST = orafdb01.mysystems.com)(PORT = 1521))
# (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orafdb01.mysystems.com)))

    (ADDRESS_LIST =#TCORACLE.WORLD = (DESCRIPTION= (ADDRESS = (PROTOCOL = TCP)(HOST = orafdb01.mysystems.com)(PORT = 1521))
# (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orafdb01.mysystems.com)))


#TCORACLE.WORLD = (DESCRIPTION= (ADDRESS = (PROTOCOL = TCP)(HOST = orafdb01.mysystems.com)(PORT = 1521))
# (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orafdb01.mysystems.com)))

      (ADDRESS = (PROTOCOL = TCP)(HOST = Hyper-W7-Ora12c.mysystems.com)(PORT = 1521))
    )
#                               (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orafdb01.mysystems.com)))
    (CONNECT_DATA =
#TCORACLE.WORLD = (DESCRIPTION= (ADDRESS = (PROTOCOL = TCP)(HOST = orafdb01.mysystems.com)(PORT = 1521))
# (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orafdb01.mysystems.com)))

      (SERVICE_NAME = ORCLWGA1.world) #TCORACLE.WORLD = (DESCRIPTION= (ADDRESS = (PROTOCOL = TCP)(HOST = orafdb01.mysystems.com)(PORT = 1521))
# (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orafdb01.mysystems.com)))


#TCORACLE.WORLD = (DESCRIPTION= (ADDRESS = (PROTOCOL = TCP)(HOST = orafdb01.mysystems.com)(PORT = 1521))
# (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orafdb01.mysystems.com)))

    )
#TCORACLE.WORLD = (DESCRIPTION= (ADDRESS = (PROTOCOL = TCP)(HOST = orafdb01.mysystems.com)(PORT = 1521))
# (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orafdb01.mysystems.com)))

  )

# Added blah1, blah2
TEST01 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = blah1)(PORT = 1521)) (CONNECT_DATA = (SERVICE_NAME = TEST01)))
TEST02 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = blah2)(PORT = 1522)) (CONNECT_DATA = (SERVICE_NAME = TEST02)))



C:\>McTnsping -t orclWGA1 -dir c:

McTnsping Utility by Michel Cadot: Version 2018.08.17 on 17-AOÛT-2018 17:18:12

Copyright (c) Michel Cadot, 2016-2018. All rights reserved.

Used parameter files:
c:\tnsnames.ora

Found tnsnames.ora entry:
(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=Hyper-W7-Ora12c.mysystems.com)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=ORCLWGA1.world)))

Attempting to contact Hyper-W7-Ora12c.mysystems.com:1521
TNS-12545: Connect failed because target host or object does not exist

[Updated on: Fri, 17 August 2018 10:24]

Report message to a moderator

Re: McTnsping: a tnsping-like program for Windows [message #673613 is a reply to message #667777] Tue, 27 November 2018 04:25 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

McTnsping now supports Oracle version 18c.

Re: McTnsping: a tnsping-like program for Windows [message #674486 is a reply to message #673613] Tue, 29 January 2019 08:44 Go to previous messageGo to next message
sloc
Messages: 8
Registered: January 2019
Junior Member
Hi there, i just downloaded this version (Version 2018.11.27). Unfortunately it does not seem to parse the tnsnames.ora.
I have tried setting the tns_admin in advance and also using the -dir Parameter.
In both cases it shows that it would use the correct tnsnames.ora file, but no matter which alias I try it never finds it.

The errors is this:

McTnsping Utility by Michel Cadot: Version 2018.11.27 on 29-JAN-2019 15:38:13

Copyright (c) Michel Cadot, 2016-2018. All rights reserved.

Label not found for "last 2" at script/McTnsping.pl line 576, <FILE> line 3.


I have tried unsetting the path, changing the entry in case it is case sensitive, but no matter what I do I always get the same response.
Our tnsnames.ora has a lot of entries (in the thousands, and these are normally look like this:

test.eng.domain.ch = (DESCRIPTION =
    (ADDRESS=(PROTOCOL = TCP)(Host = testserver.eng.domain.ch)(Port = 12004 ))

There are also a lots of comments in the file and a header from svn/git, as the file is versioned.

Thank you for your time, let me know if you need more input.

Re: McTnsping: a tnsping-like program for Windows [message #674488 is a reply to message #674486] Tue, 29 January 2019 09:44 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

I will check and come back as soon as possible.

Re: McTnsping: a tnsping-like program for Windows [message #674489 is a reply to message #674488] Tue, 29 January 2019 11:23 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Program is fixed, new version is available to download.
There was a bug when a right parenthesis is missing in the tnsnames.ora entry (like in your exemple).

Note that, as I used a very basic syntax analyzer, in case of a syntax error in an entry, this one is stated as "not found" and the return code is always:
TNS-03505: Failed to resolve name
whereas Oracle tnsping will give a clearer error (but not necessary accurate), in this case:
TNS-12533: TNS:illegal ADDRESS parameters

[Updated on: Tue, 29 January 2019 11:26]

Report message to a moderator

Re: McTnsping: a tnsping-like program for Windows [message #674527 is a reply to message #674489] Thu, 31 January 2019 05:47 Go to previous messageGo to next message
sloc
Messages: 8
Registered: January 2019
Junior Member
Wow, that was fast Smile

Sorry to bother you again. I downloaded and tested the new version, unfortunately it is still not working.


c:\Workarea\Oracle_Client_Tests>McTnsping.exe -t test81.eng.domain.ch -dir "c:\Workarea\Oracle_Client_Tests" -db 3

McTnsping Utility by Michel Cadot: Version 2019.01.29 on 31-JAN-2019 12:29:25

Copyright (c) Michel Cadot, 2016-2019. All rights reserved.

DEBUG main: p_tns='test81.eng.domain.ch', p_dir='c:\Workarea\Oracle_Client_Tests', oh='', tnsadmin=''
DEBUG main: sqlnet='c:\Workarea\Oracle_Client_Tests\sqlnet.ora', flag=1, domain='prod.domain.ch'
DEBUG CheckTnsnames: file='c:\Workarea\Oracle_Client_Tests\tnsnames.ora', entry='test81.eng.domain.ch.prod.domain.ch'
DEBUG CheckTnsnames: line='TEST81.eng.domain.ch = (DESCRIPTION =  '
DEBUG CheckTnsnames: modified line='TEST81.eng.domain.ch = (DESCRIPTION =  '
DEBUG CheckTnsnames: line='    (ADDRESS=(PROTOCOL = TCP)(Host = dbsrv81.eng.domain.ch)(Port = 10945 ))'
DEBUG CheckTnsnames: modified line='    (ADDRESS=(PROTOCOL = TCP)(Host = dbsrv81.eng.domain.ch)(Port = 10945 ))'
DEBUG CheckTnsnames: line='    (CONNECT_DATA=(SERVICE_NAME = TEST81_RW.eng.domain.ch)))'
DEBUG CheckTnsnames: modified line='    (CONNECT_DATA=(SERVICE_NAME = TEST81_RW.eng.domain.ch)))'
DEBUG CheckTnsnames: entry=''
DEBUG CheckTnsnames: end - flag=1, ret=''
DEBUG main: tnsnames='c:\Workarea\Oracle_Client_Tests\tnsnames.ora', flag=1
Used parameter files:
c:\Workarea\Oracle_Client_Tests\sqlnet.ora
c:\Workarea\Oracle_Client_Tests\tnsnames.ora

*** TNS-03505: Failed to resolve name


I reduced the tnsnames.ora to just one entry and it still won't resolve it. I tried also the -v option with all available clients we have (11, 12, 12.2 and 18).

The normal tnsping has no issue with the entry. The entry looks like this:

TEST81.eng.domain.ch = (DESCRIPTION =  
    (ADDRESS=(PROTOCOL = TCP)(Host = dbsrv81.eng.domain.ch)(Port = 10945 ))
    (CONNECT_DATA=(SERVICE_NAME = TEST81_RW.eng.domain.ch)))

In the sqlnet.ora there is a domain zone set, it seems that the program concatenates the domain zone to the entry and searchs for it.

Settings in the sqlnet.ora
NAMES.DEFAULT_DOMAIN = prod.domain.ch
NAMES.DEFAULT_ZONE= prod.domain.ch

Thank you

[Updated on: Thu, 31 January 2019 05:56]

Report message to a moderator

Re: McTnsping: a tnsping-like program for Windows [message #674534 is a reply to message #674527] Thu, 31 January 2019 10:11 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

You do not bother me, I thank you to help me to debug the program.

You're right, the problem comes from the settings in sqlnet.ora: I should not add this domain name if one is already provided in input (here "eng.domain.ch") this is the reason I can't see the wanted entry.
I'll fix the program and post a new one asap.

Re: McTnsping: a tnsping-like program for Windows [message #674535 is a reply to message #674527] Thu, 31 January 2019 10:57 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Program is fixed, new version is available to download.
Now if a domain name is given with the tnsnames.name entry, sqlnet.ora, if present, is ignored (it is used only to get the default domain name).

Note that a difference with Oracle tnsping is that if you have several times the same entry, McTnsping uses the FIRST one. In the opposite, Oracle tnsping will use the LAST one.
I think the reason Oracle tnsping does that is because "netca" tool writes the new entries at the end of the file, so the most recent, and likely the most correct, entries would be at the bottom of the file.
The reason I don't do the same thing is that, I don't use "netca" but simple editor tool to manage my tnsnames.ora and so if I have to modify an entry I search for the first occurrence of it.


Re: McTnsping: a tnsping-like program for Windows [message #674653 is a reply to message #674535] Thu, 07 February 2019 04:31 Go to previous messageGo to next message
sloc
Messages: 8
Registered: January 2019
Junior Member
Hi again, sorry it took me so long to test.

It works now!! Smile

It's awesome that it checks both nodes. I caught a couple of configuration errors due to this this morning.

Thank you very much for your time and effort.
Re: McTnsping: a tnsping-like program for Windows [message #674660 is a reply to message #674653] Thu, 07 February 2019 10:18 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

I'm glad to know it helps you, this encourages me to continue to improve it (as well as the other tools I published here).

Re: McTnsping: a tnsping-like program for Windows [message #674756 is a reply to message #674660] Thu, 14 February 2019 09:05 Go to previous messageGo to next message
Raulforg
Messages: 3
Registered: February 2019
Junior Member
Useful. Thanks for sharing. An ugly message about locale is shown in every response but the application works great.

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LC_ALL = "es_PE.UTF-8",
        LC_CTYPE = "es_PE.UTF-8",
        LANG = "es_PE.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the system default locale ("Spanish_Peru.1252").

How can I modify the default locale of app. I can't change System Locale because i'm not admin.
Re: McTnsping: a tnsping-like program for Windows [message #674760 is a reply to message #674756] Thu, 14 February 2019 10:55 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

The first thing to try is to set them manually before calling McTnsping in a DOS box:
SET LC_ALL=es_PE.UTF-8
SET LC_CTYPE=es_PE.UTF-8
SET LANG=es_PE.UTF-8
Tell me if this fix the problem or not.

Re: McTnsping: a tnsping-like program for Windows [message #674762 is a reply to message #674760] Thu, 14 February 2019 11:42 Go to previous messageGo to next message
Raulforg
Messages: 3
Registered: February 2019
Junior Member
It doesn't.

/foru/forum/fa/14029/0/


Also I tried with en_US.UTF-8 in a DOS and cygwin (with export). Same warnings.
  • Attachment: locale.png
    (Size: 15.80KB, Downloaded 2879 times)
Re: McTnsping: a tnsping-like program for Windows [message #674763 is a reply to message #674762] Thu, 14 February 2019 12:46 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

OK, please try setting it the environment of your profile if you can: right-click on "workstation" (or similar), "properties", "advanced" then "environment variables" and set "user variables" as program asks (depending on your Windows version the path may change a bit), then open a new DOS box and retry.

Re: McTnsping: a tnsping-like program for Windows [message #674859 is a reply to message #674762] Tue, 19 February 2019 14:42 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Is it OK now for you? Or did you find another solution?

Re: McTnsping: a tnsping-like program for Windows [message #674907 is a reply to message #674859] Thu, 21 February 2019 08:48 Go to previous messageGo to next message
Raulforg
Messages: 3
Registered: February 2019
Junior Member
It didn't. Maybe environment variables does not work because perl is embedded in the .exe.
Re: McTnsping: a tnsping-like program for Windows [message #674911 is a reply to message #674907] Thu, 21 February 2019 10:07 Go to previous messageGo to previous message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

OK, I'll build a new version trying to fix the issue and will send it to you via PM, if you're OK to test a beta version.
If it works I'll publish it.

[Updated on: Thu, 21 February 2019 10:08]

Report message to a moderator

Previous Topic: Explore the Oracle data dictionary with VISKey
Next Topic: Oracle Enterprise Manager plugin testers required
Goto Forum:
  


Current Time: Thu Mar 28 07:48:24 CDT 2024