Solved

Script to Find tns names on server

Posted on 2014-11-06
7
127 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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

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 connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

732 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