Solved

Script to Find tns names on server

Posted on 2014-11-06
7
113 Views
Last Modified: 2015-06-23
I need a script to find all tnsnames on server reading from a text file with all server names
0
Comment
Question by:bmac712
7 Comments
 
LVL 23

Accepted Solution

by:
David earned 125 total points
ID: 40427664
Windows: > 
cd \    rem for each drive searched
C:       rem whichever
dir/s tnsnames.ora

Linux:
cd \  # goto root
find . -name "tnsnames.ora" -type f 2>&1 #  search from root down, permission errors redirected to SYSOUT
0
 
LVL 16

Assisted Solution

by:Wasim Akram Shaik
Wasim Akram Shaik earned 125 total points
ID: 40427701
Basically tnsnames.ora will present in the Network/Admin Directory under ORACLE_HOME

if you know your ORACLE_HOME which will be pointing to some directory in Operating system, then go to the mentioned folders you can find one.

If you have environment variables set, then doing this would help to find it so

cd $ORACLE_HOME/network/admin
0
 
LVL 13

Assisted Solution

by:Alexander Eßer [Alex140181]
Alexander Eßer [Alex140181] earned 250 total points
ID: 40427922
Basically tnsnames.ora will present in the Network/Admin Directory under ORACLE_HOME
As long as "TNS_ADMIN" is NOT set, this is true ;-)
0
 
LVL 13

Assisted Solution

by:Alexander Eßer [Alex140181]
Alexander Eßer [Alex140181] earned 250 total points
ID: 40427927
What OS?!
Upon *nix based systems, this could be done in various ways, e.g.:
sed -n -e "/DESCRIPTION/{g;s/ .*=.*//p;}" -e "h" tnsnames.ora

Open in new window

or
awk '!/^\(/ && $2== "=" {print $1}' tnsnames.ora

Open in new window

or
awk -F"[ =]" '/DESCRIPTION/ { print X }{ X=$1 }' tnsnames.ora

Open in new window

0
 
LVL 22

Expert Comment

by:Steve Wales
ID: 40845981
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
T-SQL:  Sigh---Boy, this is fun.... 12 46
form builder not starting 3 34
Transform normalized CSV to line in powershell 7 37
Creation date for a PDB 5 21
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question