?
Solved

Script to Find tns names on server

Posted on 2014-11-06
7
Medium Priority
?
134 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 500 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 500 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 1000 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 1000 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
Starting up a Project
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses

801 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