Solved

Script to Find tns names on server

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

746 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now