Solved

Script to Find tns names on server

Posted on 2014-11-06
7
130 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

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

From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
Introduction to Processes

729 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