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
testb(9F)						   Kernel Functions for Drivers 						 testb(9F)

NAME
testb - check for an available buffer SYNOPSIS
#include <sys/stream.h> int testb(size_t size, uint_t pri); INTERFACE LEVEL
Architecture independent level 1 (DDI/DKI). PARAMETERS
size Size of the requested buffer. pri Priority of the allocb request. DESCRIPTION
testb() checks to see if an allocb(9F) call is likely to succeed if a buffer of size bytes at priority pri is requested. Even if testb() returns successfully, the call to allocb(9F) can fail. The pri argument is no longer used, but is retained for compatibility. RETURN VALUES
Returns 1 if a buffer of the requested size is available, and 0 if one is not. CONTEXT
testb() can be called from user or interrupt context. EXAMPLES
Example 1: testb() example In a service routine, if copymsg(9F) fails (line 6), the message is put back on the queue (line 7) and a routine, tryagain, is scheduled to be run in one tenth of a second. Then the service routine returns. When the timeout(9F) function runs, if there is no message on the front of the queue, it just returns. Otherwise, for each message block in the first message, check to see if an allocation would succeed. If the number of message blocks equals the number we can allocate, then enable the service procedure. Otherwise, reschedule tryagain to run again in another tenth of a second. Note that tryagain is merely an approximation. Its accounting may be faulty. Consider the case of a message comprised of two 1024-byte message blocks. If there is only one free 1024-byte message block and no free 2048-byte message blocks, then testb() will still succeed twice. If no message blocks are freed of these sizes before the service procedure runs again, then the copymsg(9F) will still fail. The reason testb() is used here is because it is significantly faster than calling copymsg. We must minimize the amount of time spent in a timeout() routine. 1 xxxsrv(q) 2 queue_t *q; 3 { 4 mblk_t *mp; 5 mblk_t *nmp; . . . 6 if ((nmp = copymsg(mp)) == NULL) { 7 putbq(q, mp); 8 timeout(tryagain, (intptr_t)q, drv_usectohz(100000)); 9 return; 10 } . . . 11 } 12 13 tryagain(q) 14 queue_t *q; 15 { 16 register int can_alloc = 0; 17 register int num_blks = 0; 18 register mblk_t *mp; 19 20 if (!q->q_first) 21 return; 22 for (mp = q->q_first; mp; mp = mp->b_cont) { 23 num_blks++; 24 can_alloc += testb((mp->b_datap->db_lim - 25 mp->b_datap->db_base), BPRI_MED); 26 } 27 if (num_blks == can_alloc) 28 qenable(q); 29 else 30 timeout(tryagain, (intptr_t)q, drv_usectohz(100000)); 31 } SEE ALSO
allocb(9F), bufcall(9F), copymsg(9F), timeout(9F) Writing Device Drivers STREAMS Programming Guide NOTES
The pri argument is provided for compatibility only. Its value is ignored. SunOS 5.10 11 Nov 1996 testb(9F)
All times are GMT -4. The time now is 04:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy