ORA-12154: TNS:could not resolve service name

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers ORA-12154: TNS:could not resolve service name
# 1  
Old 11-09-2009
Error 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.
# 2  
Old 11-09-2009
The oracle instance TTTEST is not defined in the tnsnames.ora file on the box where you issued the sqlplus command.
# 3  
Old 11-09-2009
You can (most of the time) get a pretty good description of the causes of an error by running oerr, eg
$ oerr ora 12154
12154, 00000, "TNS:could not resolve service name"
// *Cause:  The service name specified is not defined correctly in the
// *Action:  Make the following checks and correct the error:
//           - Verify that a TNSNAMES.ORA file exists and is in the proper
//             place and accessible. See the operating system specific manual
//             for details on the required name and location.
//           - Check to see that the service name exists in one of the
//             TNSNAMES.ORA files and add it if necessary.
//           - Make sure there are no syntax errors anywhere in the file.
//             Particularly look for unmatched parentheses or stray characters.
//             Any error in a TNSNAMES.ORA file makes it unusable. See
//             Chapter 4 in the SQL*Net V2 Administrator's Guide. If
//             possible, regenerate the configuration files using the Oracle
//             Network Manager.

# 4  
Old 11-09-2009
TTTEST is defined in my tnsnames.ora , i checked it before.

---------- Post updated at 07:12 AM ---------- Previous update was at 07:01 AM ----------

How can i try other structure for sqlplus?
or are there any other way for running sqlplus?
# 5  
Old 11-09-2009
Most likely the process is reading a different parameter file.
You could:

1. Try to set and export the TNS_ADMIN variable to the correct path explicitly.
2. Use the following syntax (requires version >= 9?).

sqlplus <user>/<pass>@'(description=(address=(protocol=tcp)(host=<hostname>)(port=<port>))(connect_data=(sid=<oracle_sid>)))'

# 6  
Old 11-10-2009
thanx radoulov,pludi,jim.

i tried it on production environment and result is successfully.

But now, i need to assign result of sql to variable. How can i do this?

Assume that "select t.deger from parametre t where t.id=30" is return me 100 value,
i need to assign 100 to x variable.
How can i do this.

by the way my sql expression is in the umtt.sql

Thanx for helping
# 7  
Old 11-10-2009
I think it should be better if you try to explain what exactly you're trying to achieve.
Do you really need to use shell scripting? Why don't you do all the processing in the database?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat


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/ at offset 13335789568 for data length 1048576 ORA-27626: Exadata error: 2201 (IO... (2 Replies)
Discussion started by: Maddy123
2 Replies

2. Shell Programming and Scripting

Replacing old TNS entries with New one in multiple files

I have requirement to replace old TNS entries with New one in multiple files. one file may contain more then one occurrence of tns. Example: Below is the one of occurrence in a current file(s). i am interested to replace only red part. <connection-pool name="Google_APP_CP"... (4 Replies)
Discussion started by: KDDubai333
4 Replies

3. Shell Programming and Scripting

Grep all lines with the string "TNS-" but skip those with "TNS-12514"

Platform: Oracle Linux 6.3 From a log file, I want to grep all lines with the pattern "TNS-" but I want to skip those with the pattern "TNS-12514" . How can I do this ? (3 Replies)
Discussion started by: John K
3 Replies

4. Red Hat

TNS Timeout Error when connecting to SQLPLUS through scripts only

Hi, I am facing a strange issue when connecting to SQLPLUS via a shell scripts. I am using Linux 2.6.18-274.18.1 and gbash shell. When I connect to SQLPLUS through scripts then it throws TNS Time Out error ""sometimes"" and connects successfully other times.This is only happening when... (9 Replies)
Discussion started by: aashish.sharma8
9 Replies

5. 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

6. 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

7. UNIX for Advanced & Expert Users

TNS no listener error when connecting to a new DB

Hi all We connect to 10 Oracle Databases from our UNIX box through the regular TNS file we have on any oracle client installation. Recently we acquired a new connection. I added the entries as usual to the TNS file. The connection fails with the below error message ORA-12541: TNS:no... (2 Replies)
Discussion started by: b_sri
2 Replies

8. 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

9. Linux

After famous ORA-12514 error, another erro TNS-12535

Recently I was struggling to resolve ORA-12514 error, after I solved that there is a another error "TNS-12535: TNS: operation timed out". For your information in my machine I have disabled firewall & also added SQLNET.EXPIRE_TIME = 10. But the problem is still persists. Again all your help is... (2 Replies)
Discussion started by: yajneshilu
2 Replies

10. Linux

Try thousand times could not resolve famous ORA-12514 error

It is related to Linux, Oracle 9.2.0. I am new to Oracle. I am trying to connect to Oracle database say A, but as I am running this command dbstart the error is “ORA-12514: TNS: listener could not resolve SERVICE_NAME given in connect descriptor” I have successfully started lsnrctl. Here... (3 Replies)
Discussion started by: yajneshilu
3 Replies
Login or Register to Ask a Question