Home » Other » Marketplace » McTnsping: a tnsping-like program for Windows (8iR1 to 12cR2)  () 1 Vote
McTnsping: a tnsping-like program for Windows [message #648221] Thu, 18 February 2016 12:02 Go to next message
Michel Cadot
Messages: 65317
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.
Note that this program currently accepts only tnsnames.ora or easy connect strings; ldap is currently not supported.
The help is the following one:
C:\>McTnsping -h

McTnsping Utility by Michel Cadot: Version 2018.01.13 on 13-JANV.-2018 11:20:53

Copyright (c) Michel Cadot, 2016-2018. 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.
  <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 }] [-dir <tnsnames.ora directory>]
          [-tim <timeout>] [-c <count>]
        }

with
  -c <count>             Sets the number of times the program checks the target,
                           default is 1.
  -dir <directory>       Gives the directory for sqlnet.ora and tnsnames.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.
  -t <tns entry>         Gives the net service name in the tnsnames.ora file.
  -tim <timeout>         Gives the timeout (in seconds) on connection to listener,
                           default is 5 seconds.
  -v {8|9|10|11|12|12.2} Selects the version of the simulated tnsping, default is 11.

"-s" and "-t" options are exclusive.
If "-t" is choosen, the program searches for sqlnet.ora and tnsnames.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: PORT must be after HOST in the tnsnames entry description (program restriction).
Another restriction is that a tnsnames.ora entry must be at the beginning of a line
(maybe preceded by spaces).

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/

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 2016.02.21 on 21-FÉVR.-2016 21:23:04

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

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

Found tnsnames.ora entry:
(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=...

Attempting to contact myserver:1530
OK (41 msec) -- listener version 10.2.0.4.0
OK (21 msec) -- listener version 10.2.0.4.0
OK (21 msec) -- listener version 10.2.0.4.0
Note: a small difference with tnsping is that if the tnsnames entry contains several ADDRESS parts, McTnsping reports the result of all addresses and not only the first one which works.

Latest version: 2018.01.15, download in tnsping wiki page
MD5:   fda801dacf8b54d4c36c8dd94ca136b5
SHA-1: f3549a49204202826360f7f74b1bd7f008c3e883

[Updated on: Mon, 15 January 2018 04:09]

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: 65317
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: 65317
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: 523
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: 65317
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: 523
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: 65317
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: 65317
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: 4532
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: 65317
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: 65317
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: 65317
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: 65317
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 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
Previous Topic: how to connect to oracle from ms office
Next Topic: Convert any Database to Oracle
Goto Forum:
  


Current Time: Thu Jan 18 11:05:29 CST 2018

Total time taken to generate the page: 0.01527 seconds