Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Get the tnsnames.ora alias for a given service name Post 303046118 by kpg on Friday 24th of April 2020 09:42:13 AM
Old 04-24-2020
Get the tnsnames.ora alias for a given service name

Hello,

puzzling me now way to long....so hopefully someone has the answer at hand:
The following shows a sample tnsnames.ora from another topic.
What I want to get as result the tnsnames alias "PRI" when searching for the service name pri.
That is, the left hand side of the tnsnames entry where the service name 'pri' is used.
Preferably shell script or sed.


Code:
PRI =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.0.3.7)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = pri)
      (INSTANCE_NAME = pri)
    )
  )

STDBY =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.0.3.5)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = stdby)
      (INSTANCE_NAME = stdby)
    )
  )



any help appreciated


tags: linux, tnsnames, tnsname alias, service name

Last edited by kpg; 04-24-2020 at 10:44 AM.. Reason: missed tags - but how do i add tehm?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need to capture the service name from tnsnames.ora and create connect string

ghkjkjoj (4 Replies)
Discussion started by: chetankelvin
4 Replies

2. UNIX for Dummies Questions & Answers

ORA-12154: TNS:could not resolve service name

Hi everyone, when i run ; sqlplus -s username/password@TTTEST @umt.sql i take "ORA-12154: TNS:could not resolve service name" i want to run "umt.sql" query and also see result. thanx for your helping. (6 Replies)
Discussion started by: temhem
6 Replies

3. UNIX for Dummies Questions & Answers

find tnsnames.ora in unix

Can we find out what is the location of tnsnames.ora file used by the hp unix. (3 Replies)
Discussion started by: Sudipshib
3 Replies

4. Solaris

maxuprc and maxusers - ORA-27300, ORA-27301, ORA-27302

Hi all, Am intermittently getting the following errors on one of my databases. Errors in file /oracle/HRD/saptrace/background/hrd_psp0_13943.trc: ORA-27300: OS system dependent operation:fork failed with status: 12 ORA-27301: OS failure message: Not enough space ORA-27302:... (1 Reply)
Discussion started by: newbie_01
1 Replies

5. Shell Programming and Scripting

sed: parsing tnsnames.ora

All: Can sombodoy help me out with a sed command? Assume I have the following: PRI = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.0.3.7)(PORT = 1521)) ) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = pri) ... (3 Replies)
Discussion started by: BeefStu
3 Replies

6. UNIX for Advanced & Expert Users

grep all ORA errors except one ORA error

Hi - I am trying to grep all "ORA" errors in a log files.I have to grep all ORA errors except one error for example ORA-01653.How can exclude that error in "grep" command? In following "grep" command I want to exclude "ORA-01653" error grep -i ORA alert.log >>/tmp/ora_errors.txt ... (7 Replies)
Discussion started by: Mansoor8810
7 Replies

7. Shell Programming and Scripting

Tnsnames.ora

Hi, I would like to modify, in script schell, the line right above (DESCRIPTION and check three cases : if line contain ".world" then line=line-".world" concat "," concat line if line dont contain ".world" then line=line concat "," concat line concat".world" else line=line Keep in... (10 Replies)
Discussion started by: elcaro
10 Replies

8. Shell Programming and Scripting

Removing section from tnsnames.ora

Hi, I am trying to write a script or command to remove a section from tnsnames.ora file in the following example I would like to remove tns_alias2 section $ cat tnsnames.ora tns_alias1 = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = host1 )(PORT = 1521)) ... (3 Replies)
Discussion started by: ynixon
3 Replies

9. AIX

I cannot find dsn and TNSNAMES.ora on UNIX

Where can I find dsn and TNSNAMES.ora on UNIX AIX Thanks for contribution (3 Replies)
Discussion started by: digioleg54
3 Replies

10. Red Hat

Ora-27603:ora-27626:

Hi, User claim that job is running slow from their end. I DBA found in database the below errors in alert log file. ORA-27603: Cell storage I/O error, I/O failed on disk o/192.168.10.3/RECO_DM01_CD_01_drm01 at offset 13335789568 for data length 1048576 ORA-27626: Exadata error: 2201 (IO... (2 Replies)
Discussion started by: Maddy123
2 Replies
SHOREWALL-BLACKLIST(5)						  [FIXME: manual]					    SHOREWALL-BLACKLIST(5)

NAME
blacklist - Shorewall Blacklist file SYNOPSIS
/etc/shorewall/blacklist DESCRIPTION
The blacklist file is used to perform static blacklisting. You can blacklist by source address (IP or MAC), or by application. The columns in the file are as follows (where the column name is followed by a different name in parentheses, the different name is used in the alternate specification syntax). ADDRESS/SUBNET (networks) - {-|~mac-address|ip-address|address-range|+ipset} Host address, network address, MAC address, IP address range (if your kernel and iptables contain iprange match support) or ipset name prefaced by "+" (if your kernel supports ipset match). Exclusion (shorewall-exclusion[1](5)) is supported. MAC addresses must be prefixed with "~" and use "-" as a separator. Example: ~00-A0-C9-15-39-78 A dash ("-") in this column means that any source address will match. This is useful if you want to blacklist a particular application using entries in the PROTOCOL and PORTS columns. PROTOCOL (proto) - {-|[!]protocol-number|[!]protocol-name} Optional - If specified, must be a protocol number or a protocol name from protocols(5). PORTS - {-|[!]port-name-or-number[,port-name-or-number]...} Optional - may only be specified if the protocol is TCP (6) or UDP (17). A comma-separated list of destination port numbers or service names from services(5). OPTIONS - {-|{dst|src|whitelist|audit}[,...]} Optional - added in 4.4.12. If specified, indicates whether traffic from ADDRESS/SUBNET (src) or traffic to ADDRESS/SUBNET (dst) should be blacklisted. The default is src. If the ADDRESS/SUBNET column is empty, then this column has no effect on the generated rule. Note In Shorewall 4.4.12, the keywords from and to were used in place of src and dst respectively. Blacklisting was still restricted to traffic arriving on an interface that has the 'blacklist' option set. So to block traffic from your local network to an internet host, you had to specify blacklist on your internal interface in shorewall-interfaces[2] (5). Note Beginning with Shorewall 4.4.13, entries are applied based on the blacklist setting in shorewall-zones[3](5): 1. 'blacklist' in the OPTIONS or IN_OPTIONS column. Traffic from this zone is passed against the entries in this file that have the src option (specified or defaulted). 2. 'blacklist' in the OPTIONS or OUT_OPTIONS column. Traffic to this zone is passed against the entries in this file that have the dst option. In Shorewall 4.4.20, the whitelist option was added. When whitelist is specified, packets/connections that match the entry are not matched against the remaining entries in the file. The audit option was also added in 4.4.20 and causes packets matching the entry to be audited. The audit option may not be specified in whitelist entries and require AUDIT_TARGET support in the kernel and iptables. EXAMPLE
Example 1: To block DNS queries from address 192.0.2.126: #ADDRESS/SUBNET PROTOCOL PORT 192.0.2.126 udp 53 Example 2: To block some of the nuisance applications: #ADDRESS/SUBNET PROTOCOL PORT - udp 1024:1033,1434 - tcp 57,1433,1434,2401,2745,3127,3306,3410,4899,5554,6101,8081,9898 FILES
/etc/shorewall/blacklist SEE ALSO
http://shorewall.net/blacklisting_support.htm http://shorewall.net/configuration_file_basics.htm#Pairs shorewall(8), shorewall-accounting(5), shorewall-actions(5), shorewall-hosts(5), shorewall_interfaces(5), shorewall-ipsets(5), shorewall-maclist(5), shorewall-masq(5), shorewall-nat(5), shorewall-netmap(5), shorewall-params(5), shorewall-policy(5), shorewall-providers(5), shorewall-proxyarp(5), shorewall-rtrules(5), shorewall-routestopped(5), shorewall-rules(5), shorewall.conf(5), shorewall-secmarks(5), shorewall-tcclasses(5), shorewall-tcdevices(5), shorewall-tcrules(5), shorewall-tos(5), shorewall-tunnels(5), shorewall-zones(5) NOTES
1. shorewall-exclusion http://www.shorewall.net/manpages/shorewall-exclusion.html 2. shorewall-interfaces http://www.shorewall.net/manpages/shorewall-interfaces.html 3. shorewall-zones http://www.shorewall.net/manpages/shorewall-zones.html [FIXME: source] 06/28/2012 SHOREWALL-BLACKLIST(5)
All times are GMT -4. The time now is 07:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy