Ora 12154 как исправить

automated-testing.info

Загрузка…

  • testomat.io управление авто тестами
  • Python
  • Реклама
  • Работа
  • Консультации
  • Обучение

I am trying to connect to oracle 11g installed on Linux EL 5 and and getting the following error

SQL> connect sys/password@ud06 as sysdba
ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor

my listener.ora under network/admin is as follows

LISTENER=
  (DESCRIPTION=
    (ADDRESS_LIST=
      (ADDRESS=(PROTOCOL=tcp)(HOST=ud06)(PORT=1521))
      (ADDRESS=(PROTOCOL=ipc)(KEY=extproc))))

SID_LIST_LISTENER=
  (SID_LIST=
    (SID_DESC=
      (GLOBAL_DBNAME=orcl)
      (ORACLE_HOME=/home/oracle/app/oracle/product/11g)
      (SID_NAME=orcl))
    (SID_DESC=
      (SID_NAME=plsextproc)
      (ORACLE_HOME=/home/oracle/app/oracle/product/11g)
      (PROGRAM=extproc)))

MY tnsnames.ora is as follows

ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  )

EXTPROC_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
    )
    (CONNECT_DATA =
      (SID = PLSExtProc)
      (PRESENTATION = RO)
    )
  )

UD06=
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = ud06)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = orcl)
    )
  )

MY lsnrctl status shows as follows:

LSNRCTL> status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ud06.us.server.com)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                17-FEB-2010 16:23:06
Uptime                    0 days 0 hr. 12 min. 33 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /home/oracle/app/oracle/product/11g/network/admin/listener.ora
Listener Log File         /home/oracle/app/oracle/product/11g/log/diag/tnslsnr/ud06/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ud06.us.server.com)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=extproc)))
Services Summary...
Service "orcl" has 1 instance(s).
  Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
Service "plsextproc" has 1 instance(s).
  Instance "plsextproc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

I need to use PLSQL Developer to access oracle databases. I get the following error when I try to connect to my database. ORA-12154: TNS:could not resolve the connect identifier specified. I am able to use SQLPLUS from the command line to connect to the database, and tnsping returns successfully, but I can’t figure out why PLSQL Developer will not work – it’s using the right tnsnames.ora file, and the connection string in there is correct because it’s the same one that tnsping uses.

Anyone have an idea what I can do to fix this? I’ve looked at other threads about this specific error with no luck.

tnsnames.ora

    ORCL =
      (DESCRIPTION = 
      (ADDRESS = (PROTOCOL = TCP)(HOST = MININT-AIVKVBM)(PORT = 1521)) 
      (CONNECT_DATA = 
        (SERVER = DEDICATED) 
        (SERVICE_NAME = orcl)
      )
    )

sqlnet.ora

     SQLNET.AUTHENTICATION_SERVICES= (NTS)
     NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)

sqlpus command line
image here

PLSQL Developer Connection Preferences: image here

asked Oct 10, 2012 at 18:09

ZakTaccardi's user avatar

ZakTaccardiZakTaccardi

12.1k15 gold badges58 silver badges104 bronze badges

11

The answer was simply moving the PLSQL Developer folder from the “Program Files (x86) into the “Program Files” folder – weird!

answered Oct 11, 2012 at 14:19

ZakTaccardi's user avatar

ZakTaccardiZakTaccardi

12.1k15 gold badges58 silver badges104 bronze badges

4

This error is very common, often the very first one you get on trying to establish a connection to your database.
I suggest those 6 steps to fix ORA-12154 :

  1. Check instance name has been entered correctly in tnsnames.ora.
  2. There should be no control characters at the end of the instance or database name.
  3. All paranthesis around the TNS entry should be properly terminated
  4. Domain name entry in sqlnet.ora should not be conflicting with full database name.
  5. If problem still persists, try to re-create TNS entry in tnsnames.ora.
  6. At last you may add new entries using the SQL*Net Easy configuration utility.

For more informations : http://turfybot.free.fr/oracle/11g/errors/ORA-12154.html

answered Feb 17, 2013 at 16:13

tufy's user avatar

tufytufy

312 bronze badges

As I can’t add a comment, just thought I’d post this for completion. tufy’s answer is correct, it’s to do with parenthesis (brackets) in the path to the application being run.

There is an existing networking bug where the networking layer is
unable to parse program locations that contain parenthesis in the path
to the executable which is attempting to connect to Oracle.

Filed with Oracle, Bug 3807408 refers.

Source

answered Sep 5, 2013 at 14:34

Dave Salomon's user avatar

Dave SalomonDave Salomon

3,2771 gold badge17 silver badges29 bronze badges

copy paste pl sql developer in program files x86 and program files both. if client is installed in other partition/drive then copy pl sql developer to that drive also. and run from pl sql developer folder instead of desktop shortcut.

ultimate solution ! chill

answered Feb 28, 2017 at 8:38

Abdul Nasir Khayam's user avatar

  • It did not work so i switched to oracle sql developer and it worked
    with no problems (making connection under 1 minute).
  • This link gave me an idea connect to MS Access so i created a
    user in oracle sql developer and the tried to connect to it in Toad
    and it worked.

Or second solution

you can try to connect using Direct not TNS by providing host and port in the connect screen of Toad

Community's user avatar

answered Jun 24, 2013 at 14:23

shareef's user avatar

shareefshareef

9,17013 gold badges58 silver badges89 bronze badges

For me it was bad formatting of the tnsnames.ora connect identifier. The indentation of the identifier string is required as shown in the tnsnames.ora example in the comment.

answered Jul 31, 2013 at 14:44

Jan Matousek's user avatar

Jan MatousekJan Matousek

9463 gold badges13 silver badges15 bronze badges

Just wanted to add — apparently this can also be caused by installing Instant Client for 10, then realizing you want the full install and installing it again in a parallel directory. I don’t know why this broke it.

answered Oct 28, 2013 at 21:05

TallDave's user avatar

Also in addition to above solutions,
also check the location where the tnsname ora file exists and compare with the path in the environment variable

answered Jun 19, 2014 at 15:37

venky_ferrari's user avatar

I had an issue at work. The oracle server was “patched” and one of the databases I use could not be connect via the TNSNames entry but via Basic connection. The Database was up and admin could see it was up and running.

Addionally any application that used TNS for connecting to the database would not work either.

The problem found was that the database name was not correct in the TNS file but for some reason it’s been working for years. Correcting the name fixed it for us. I did find that Oracle SQL Developer kept using the old TNS entry even after I updated it and I don’t feel like reinstalling it for just one DB Connection. It appears that when the database was created it was given a smaller name then the others and via some cut and paste action within the TNSNames file it got mixed up. No one is sure how its worked as we’re investigating it but the oracle patch ensured that the name had to be correct

An example of the name was it was down as “DBName.Part1.Part2” but in fact the DB name was “DBName”

answered Nov 5, 2014 at 9:58

user2960847's user avatar

JUST copy and paste tnsnames and sqlnet files from Oracle home in PLSQL Developer Main folder.
Use below Query to get oracle home

select substr(file_spec, 1, instr(file_spec, ”, -1, 2) -1) ORACLE_HOME
from dba_libraries
where library_name = ‘DBMS_SUMADV_LIB’;

answered Oct 18, 2015 at 2:04

Alok's user avatar

I had the same issue with a VM running CentOS7 and Oracle 11GR2 accesible from Windows 7, the solution were weird, at my local machine the tnsnames pointing to the DB had a space before the service name, I just deleted the space and then I was able to connect.

A quick example.

Wrong tnsnames.

[this is a empty space]XE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
)
)

EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC_FOR_XE))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)

Right tnsnames.

XE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
)
)

EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC_FOR_XE))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)

answered Apr 7, 2017 at 14:20

sandatomo's user avatar

sandatomosandatomo

1034 silver badges10 bronze badges

ORA-12154: TNS:could not resolve the connect identifier specified (PLSQL Developer)

Answer: Go to the folder where you have installed ORACLE DATABASE. such as E:oracleproduct10.2.0 [or as your oracle version]db-1networkADMIN and then copy the two files (1) sqlnet.ora, (2) tnsnames.ora and close this folder.
Go to the folder where you have installed ORACLE DEVELOPER. such as E:DevSuitHome_1NETWORKADMIN then rename the two files (1) sqlnet.ora, (2) tnsnames.ora and paste the two copied files here and Your are OK.

answered Oct 10, 2014 at 9:39

mr ali's user avatar

mr alimr ali

692 silver badges8 bronze badges

Fix ORA-12154 TNS Could Not Resolve The Connect Identifier Specified Error

While using Oracle database, you may come across several errors due to some uncertain reasons and one of the error is the ORA-12154 error. If you are the one who has got this error then you don’t have to worry at all. I am saying so because here I am going to show you how to fix ora-12154 error with ease. Yes, you are so lucky that you have visited this webpage because after going through the solutions, you will be definitely able to resolve ora-12154 error in no time.

But, before we proceed to the solutions let us know something more about this ORA-12154 error that takes place while using Oracle database.

If you receive ora-12154 error then it means that the Oracle database client has been failed while he/she tries to connect with the listener on the desired server.

Or, in Oracle language, this error is defined as ‘a connection to the service or the database was requested using a connect identifier, as well as the connect identifier that is specified could not be resolved into a connect descriptor with the use of one of the naming methods configured.’ As for example, if the type of connect identifier used was actually a net service name then the net service name is not found in a naming method repository or the repository is actually be reached or located.

There are several reasons that are responsible for causing this oracle error and due to the unknown reasons, it has become quite tricky to fix ora-12154 error. However, here I have tried to solve this error based on some reasons that may cause this error to occur.

What Causes ORA-12154 Error To Occur?

As I have already mentioned that there are several causes due to which ora-12154 error takes place. Here are some of the major known causes:

  • Missing tnsnames.ora File
  • Searching for Wrong Domain
  • Absent Local Naming Method
  • Missing Parenthesis
  • Connect Identifier Mismatch

How To Fix ORA-12154: TNS:could not resolve the connect identifier specified?

ora-12154 error

Here, you will get to know the best ways to fix ORA-12154: TNS:could not resolve the connect identifier specified error based on the error message you get. All these solutions are very easy and effective that will definitely fix ora-12154 error.

Error Message #1: ORA-12154 Due to Missing tnsnames.ora File

When you deliberately deleted tnsnames.ora file for testing the effect, you get the message:

C:UsersEd>dir /w %TNS_ADMIN%tnsnames.ora
Volume in drive C has no label.
Volume Serial Number is C4BB-3A0E

Directory of C:appclientAdministratorproduct12.2.0client_1networkadmin

File Not Found

After getting this message, when you try to connect to the database, you get the below message:

C:UsersEd>sqlplus /nolog

SQL*Plus: Release 12.2.0.1.0 Production on Sat Jun 7 19:12:14 2019

Copyright (c) 1982, 2017, Oracle.  All rights reserved.

SQL> conn hr/hr@ORCL
ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified

You get these message because of the sqlplus found no file to lookup the connect identifier.

Solution To Fix This Error:

In order to fix this error, you can create a new tnsnames.ora or you can also restore the original one.

C:UsersEd>dir /w %TNS_ADMIN%tnsnames.ora
Volume in drive C has no label.
Volume Serial Number is C4BB-3A0E

Directory of C:appclientAdministratorproduct12.2.0client_1networkadmin

tnsnames.ora
1 File(s)            388 bytes
0 Dir(s)  179,702,697,984 bytes free

After doing so, you can again try to connect to the Oracle database:

C:UsersEd>sqlplus /nolog

SQL*Plus: Release 12.2.0.1.0 Production on Sat Jun 7 19:20:41 2019

Copyright (c) 1982, 2017, Oracle.  All rights reserved.

SQL> conn hr/hr@ORCL
Connected.

Error Message #2: ORA-12154 Due to Absent Local Naming Method

When you set TNS_ADMIN environment variable explicitly, you try this:

C:UsersEd>set TNS_ADMIN=C:appclientAdministratorproduct12.2.0client_1networkadmin

Check the content of sqlnet.ora. There’s no TNSNAMES naming method.

C:UsersEd>type %TNS_ADMIN%sqlnet.ora

SQLNET.AUTHENTICATION_SERVICES= (NTS)
NAMES.DIRECTORY_PATH= (EZCONNECT)

After this, you try to connect to the database:

C:UsersEd>sqlplus /nolog

SQL*Plus: Release 12.2.0.1.0 Production on Sat Jun 7 19:02:33 2019

Copyright (c) 1982, 2017, Oracle.  All rights reserved.

SQL> conn hr/hr@ORCL
ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified

Here, you can get ora-12154 error in sqlplus because there is no TNSNAMES naming method available to support the connection.

#1: Solution To Fix This Error: Add TNSNAMES Method

You can fix ora-12154 error here by adding TNSNAMES method back to NAMES.DIRECTORY_PATH.

C:UsersEd>type %TNS_ADMIN%sqlnet.ora

SQLNET.AUTHENTICATION_SERVICES= (NTS)
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)

Then we tried to connect to the database again.

C:UsersEd>sqlplus /nolog

SQL*Plus: Release 12.2.0.1.0 Production on Sat Jun 7 19:05:24 2019

Copyright (c) 1982, 2017, Oracle.  All rights reserved.

SQL> conn hr/hr@ORCL
Connected.

Using this way, you will be able to fix this ora-12154 error with ease.

#2: Solution To Fix This Error: Easy Connect Naming Method

You can also try connect naming method to fix ora-12154 error and connect to the database. For this, you have to make sure that you have EZCONNECT in the list of NAMES.DIRECTORY_PATH.

If you don’t have then you will get ora-12154 like this and it will solve your problem soon:

SQL> conn hr/hr@ora11g.example.com:1521/orcl
ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified

Error Message #3: ORA-12154 Due to Connect Identifier Mismatch

If you changed the connect identifier while connecting the database using the method below then you can sometime get this error:

SQL> conn hr/hr@ORCL123
ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified

Solution To Fix This Error

If you get this error due to connect identifier mismatch then you can try the correct connect identifier so that you can connect to the database easily. To do so, you have to try the below query:

SQL> conn hr/hr@ORCL
Connected.

It is always advisable that you should always use a matched identifier which also exists in tnsnames.ora.

Error Message #4: ORA-12154 Due to Missing Parenthesis

Sometimes it happens that you may not notice that there is one parenthesis that is missing from the connect descriptor; generally it is the right side one. You can take an entry in tnsnames.ora, as for example:

ERPAPP =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.42.21)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = ERPAPP)
(SERVER = DEDICATED)
)

Have you found any error in the above entry? No…..but I have noticed that there is a single parenthesis missing. Even if the connect identifier is correct but its connect descriptor is not correct then it will cause ORA-12154 error in oracle.

Solution To Fix This Error:

You can try the below codes to fix ORA-12154 due to missing parenthesis:

 ERPAPP =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.42.21)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = ERPAPP)
(SERVER = DEDICATED)
)
)

Using the above codes, the connect identifier is correct.

Error Message #5: ORA-12154 Due to Searching for Wrong Domain

There are some database environments that have been set to the default domain for search which may result ora-12154 error is there is some connect descriptor are configured wrong by these queries:

C:UsersEd>type %TNS_ADMIN%sqlnet.ora

SQLNET.AUTHENTICATION_SERVICES= (NTS)
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
NAMES.DEFAULT_DOMAIN = example.com

Then we tried to connect to the database.

C:UsersEd>sqlplus /nolog

SQL*Plus: Release 12.2.0.1.0 Production on Sat Jun 7 19:31:50 2019

Copyright (c) 1982, 2017, Oracle.  All rights reserved.

SQL> conn hr/hr@ORCL
ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified

Solution To Fix This Error

If the ora-12154 error takes place due to wrong domain then you can turn off by connecting out NAMES.DEFAULT_DOMAIN by the following queries:

C:UsersEd>type %TNS_ADMIN%sqlnet.ora

SQLNET.AUTHENTICATION_SERVICES= (NTS)
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
#NAMES.DEFAULT_DOMAIN = example.com

After this, you can again try to connect to the database by following these queries:

C:UsersEd>sqlplus /nolog

SQL*Plus: Release 12.2.0.1.0 Production on Sat Jun 7 19:33:55 2019

Copyright (c) 1982, 2017, Oracle.  All rights reserved.

SQL> conn hr/hr@ORCL
Connected.

You will then see that it has been connected.

Ultimate Solution: Fix ORA-12154 Error Using Oracle File Repair Tool

Apart from all these fixes, if you are unable to fix ORA-12154: TNS:could not resolve the connect identifier specified you get due to any of the reasons mentioned above then just Oracle File Repair Tool. This tool has the capability to fix any kind of error you get while using Oracle database. Several reasons are there that may cause this error but now you can easily fix it by using this tool. It has great features that allow your oracle database to overcome any kind of error and get back the database easily as it was previously saved before. All you have to do is to download and install Oracle File Repair Tool and use the step by step guide and fix the Oracle database error easily.

Steps To Fix ORA-12154 Error Using Oracle File Repair Tool

Step 1: Search the Initial screen of Stellar Phoenix Oracle Recovery with a pop-up window showing options to select or search corrupt Oracle databases on your computer.1

Step 2: Click Scan File to initiate the scan process after selecting the oracle database. The recoverable database objects get listed in left-side pane.

2

Step 3: Click an object to see its preview.

3

Step 4: Click Start Repair in the icon bar to start the repair process. A pop-up window is displayed which show the steps needed to perform further. Click next and continue.

4

Step 5: Give the user name, password and path of the blank database where you want to save the repaired database objects.

5

Step 6: Repairing and restoring various database objects after establishing a connection with blank oracle database.

6

Final Words

If you ever get ORA-12154 error while connecting to the database then stop worrying and just try the solutions mentioned in the above section of this blog. Yes, all these solutions vary and are based on the causes due to which you get ORA-12154: TNS:could not resolve the connect identifier specified. Apart from this, if you find yourself unsuccessful in fixing this error then you can try Oracle File Repair Tool. This tool will help you get rid of ORA-12154 error easily. So, all the best to you….

Jacob Martin is a technology enthusiast having experience of more than 4 years with great interest in database administration. He is expertise in related subjects like SQL database, Access, Oracle & others. Jacob has Master of Science (M.S) degree from the University of Dallas. He loves to write and provide solutions to people on database repair. Apart from this, he also loves to visit different countries in free time.

I recently deploy one web application in one of my development servers. I’m using oracle, asp.net and c#. When I run the application in the server everything works fine, but when I try to run the application outside of the server (using my pc, for example) i get this error:

ORA-12154: TNS:could not resolve the connect identifier specified

If i run the application in my pc with visual studio it works fine.

Oracle is installed in Server «A» and the application is in server «B». Server «A» is in one domain and server «B» is in other domain.My pc is in the same domain has Server «A».

In my pc I can find the file tnsname.ora in C:oracleproduct10.2.0client_1NETWORKADMIN, but in Server «B» i can´t find it anywhere

any idea?
Thanks for the help.

OMG Ponies's user avatar

OMG Ponies

321k79 gold badges516 silver badges499 bronze badges

asked Oct 2, 2008 at 14:53

Hugo Assanti's user avatar

2

Have you tried this yet? (from http://ora-12154.ora-code.com/)

ORA-12154: TNS:could not resolve the connect identifier specified
Cause: A connection to a database or other service was requested using a connect identifier, and the connect identifier specified could not be resolved into a connect descriptor using one of the naming methods configured. For example, if the type of connect identifier used was a net service name then the net service name could not be found in a naming method repository, or the repository could not be located or reached.
Action:
— If you are using local naming (TNSNAMES.ORA file):

  • Make sure that «TNSNAMES» is listed as one of the values of the NAMES.DIRECTORY_PATH parameter in the Oracle Net profile (SQLNET.ORA)

  • Verify that a TNSNAMES.ORA file exists and is in the proper directory and is accessible.

  • Check that the net service name used as the connect identifier exists in the TNSNAMES.ORA file.

  • Make sure there are no syntax errors anywhere in the TNSNAMES.ORA file. Look for unmatched parentheses or stray characters. Errors in a TNSNAMES.ORA file may make it unusable.

  • If you are using directory naming:

  • Verify that «LDAP» is listed as one of the values of the NAMES.DIRETORY_PATH parameter in the Oracle Net profile (SQLNET.ORA).

  • Verify that the LDAP directory server is up and that it is accessible.

  • Verify that the net service name or database name used as the connect identifier is configured in the directory.

  • Verify that the default context being used is correct by specifying a fully qualified net service name or a full LDAP DN as the connect identifier

  • If you are using easy connect naming:

  • Verify that «EZCONNECT» is listed as one of the values of the NAMES.DIRETORY_PATH parameter in the Oracle Net profile (SQLNET.ORA).

  • Make sure the host, port and service name specified are correct.

  • Try enclosing the connect identifier in quote marks. See the Oracle Net Services Administrators Guide or the Oracle operating system specific guide for more information on naming.

answered Oct 2, 2008 at 14:59

warren's user avatar

warrenwarren

31.7k21 gold badges86 silver badges121 bronze badges

Resolving TNS errors can be a real pain. A few things to keep in mind.

Most development environments (like visual studio) keep their own copy of the TNS connection information, and do not use the TNSNAMES.ora file. The file where this information is kept does not have to be called TNSNAMES.ora, that’s just the default name. Which may be the reason you can’t find it on Server B.

If you have the oracle client software (or an oracle database) you can use tnsping to check if your TNSNAMES.ora file is configured correctly.

The most frequent problems with a TNSNAMES.ora file configuration are using the wrong service name and/or using the wrong host name. You may need to change the «ODB_A» to «ODB_A.WORLD» or vice versa, depending upon the SQLNET settings. For Oracle 10, the latter is the default SQLNET setting. For the latter, you need to use ping to see server «A», and know if you need to use «SERVERA» or «SERVERA.DOMIN.COM» or an IP address.

answered Oct 2, 2008 at 15:14

Thomas Jones-Low's user avatar

Thomas Jones-LowThomas Jones-Low

6,9392 gold badges32 silver badges36 bronze badges

0

Do not put @ in the password you are setting or remove it from the password.
I was also getting the error and after changing it, the error got resolved.

answered Mar 12, 2022 at 18:04

Shinjini's user avatar

Guess: An oracle client is not installed on Server B.

If you do have an oracle client installed then you can still put a tnsnames file in any location (Such as a directory on a network share). In order to do this, set a TNS_ADMIN system variable (System Properties->Advanced->Environment Variables on XP) to the directory containing your tnsnames files.

For me for example I have a system variable: TNS_ADMIN — C:oracleora92networkADMIN

answered Oct 2, 2008 at 14:59

George Mauer's user avatar

George MauerGeorge Mauer

115k129 gold badges371 silver badges603 bronze badges

Is ORACLE_HOME set on server B?

answered Oct 2, 2008 at 14:59

dacracot's user avatar

dacracotdacracot

21.8k26 gold badges105 silver badges151 bronze badges

1

It seems you need to install Oracle Client on «Server B» (the application server), and configure it’s TNSNAMES.ORA file. This is required since otherwise, the running code will have no idea where to look for the database you use in the application (probably you’re configured a data source in web.config or hard-coded something).
Remember — you cannot access Oracle (easily) without Oracle Client.

answered Oct 2, 2008 at 15:00

Moshe's user avatar

MosheMoshe

2,6182 gold badges28 silver badges32 bronze badges

Had the same problem. Turns out the TNSNAMES.ORA in out deployment environment had a different ADDRESS_NAME and SID/SERVICE_NAME ,and the application was configured to use the SID — which caused the problem.

Your connection string must contain the ADDRESS_NAME and not the SID

Alessandro Minoccheri's user avatar

answered Oct 22, 2012 at 8:02

Stikut's user avatar

StikutStikut

461 silver badge4 bronze badges

Possible Resolutions —

Verify that the TNSNAMES.ORA exists and is accessible.

Make sure that there are no syntax errors in TNSNAMES.ORA.

Verify that the connection string is correct.

Verify if there are any DNS issues.

If the problem is while connect to server using PL sql developer client.try to install SQL developer within Program File instead of Program Files(x86)’s

answered Dec 24, 2013 at 2:41

Vivek Vermani's user avatar

Add the environment:

Variable Name: TNS_ADMIN

Variable Value: (YourDrive):app(UserName)product11.2.0dbhome_1NETWORKADMIN

Josh Crozier's user avatar

Josh Crozier

228k54 gold badges386 silver badges301 bronze badges

answered Jan 7, 2014 at 7:34

Rohit Hans's user avatar

I had faced the similar issue. The below code was working in my system but was not working in another server even though I had added a tns entry in tnsnames.ora file.

con = new OracleConnection();
con.ConnectionString = "User Id=username;Password=password;Data Source=uit45";
con.Open(); // throws error here

After digging and digging, I found out the solution for this. We need to ignore the entry in tns file and can be given tns entry as connection string, which worked fine for me. Try the below code.

con = new OracleConnection("Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=db-uit45.xxx)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SID=uit45)));User Id=username;Password=password");
con.Open();

Note that you need to give the associated values, especially for HOST,PORT,SID,User Id and Password.

answered Sep 17, 2016 at 11:56

Sarath Subramanian's user avatar

I recently deploy one web application in one of my development servers. I’m using oracle, asp.net and c#. When I run the application in the server everything works fine, but when I try to run the application outside of the server (using my pc, for example) i get this error:

ORA-12154: TNS:could not resolve the connect identifier specified

If i run the application in my pc with visual studio it works fine.

Oracle is installed in Server «A» and the application is in server «B». Server «A» is in one domain and server «B» is in other domain.My pc is in the same domain has Server «A».

In my pc I can find the file tnsname.ora in C:oracleproduct10.2.0client_1NETWORKADMIN, but in Server «B» i can´t find it anywhere

any idea?
Thanks for the help.

OMG Ponies's user avatar

OMG Ponies

321k79 gold badges516 silver badges499 bronze badges

asked Oct 2, 2008 at 14:53

Hugo Assanti's user avatar

2

Have you tried this yet? (from http://ora-12154.ora-code.com/)

ORA-12154: TNS:could not resolve the connect identifier specified
Cause: A connection to a database or other service was requested using a connect identifier, and the connect identifier specified could not be resolved into a connect descriptor using one of the naming methods configured. For example, if the type of connect identifier used was a net service name then the net service name could not be found in a naming method repository, or the repository could not be located or reached.
Action:
— If you are using local naming (TNSNAMES.ORA file):

  • Make sure that «TNSNAMES» is listed as one of the values of the NAMES.DIRECTORY_PATH parameter in the Oracle Net profile (SQLNET.ORA)

  • Verify that a TNSNAMES.ORA file exists and is in the proper directory and is accessible.

  • Check that the net service name used as the connect identifier exists in the TNSNAMES.ORA file.

  • Make sure there are no syntax errors anywhere in the TNSNAMES.ORA file. Look for unmatched parentheses or stray characters. Errors in a TNSNAMES.ORA file may make it unusable.

  • If you are using directory naming:

  • Verify that «LDAP» is listed as one of the values of the NAMES.DIRETORY_PATH parameter in the Oracle Net profile (SQLNET.ORA).

  • Verify that the LDAP directory server is up and that it is accessible.

  • Verify that the net service name or database name used as the connect identifier is configured in the directory.

  • Verify that the default context being used is correct by specifying a fully qualified net service name or a full LDAP DN as the connect identifier

  • If you are using easy connect naming:

  • Verify that «EZCONNECT» is listed as one of the values of the NAMES.DIRETORY_PATH parameter in the Oracle Net profile (SQLNET.ORA).

  • Make sure the host, port and service name specified are correct.

  • Try enclosing the connect identifier in quote marks. See the Oracle Net Services Administrators Guide or the Oracle operating system specific guide for more information on naming.

answered Oct 2, 2008 at 14:59

warren's user avatar

warrenwarren

31.7k21 gold badges86 silver badges121 bronze badges

Resolving TNS errors can be a real pain. A few things to keep in mind.

Most development environments (like visual studio) keep their own copy of the TNS connection information, and do not use the TNSNAMES.ora file. The file where this information is kept does not have to be called TNSNAMES.ora, that’s just the default name. Which may be the reason you can’t find it on Server B.

If you have the oracle client software (or an oracle database) you can use tnsping to check if your TNSNAMES.ora file is configured correctly.

The most frequent problems with a TNSNAMES.ora file configuration are using the wrong service name and/or using the wrong host name. You may need to change the «ODB_A» to «ODB_A.WORLD» or vice versa, depending upon the SQLNET settings. For Oracle 10, the latter is the default SQLNET setting. For the latter, you need to use ping to see server «A», and know if you need to use «SERVERA» or «SERVERA.DOMIN.COM» or an IP address.

answered Oct 2, 2008 at 15:14

Thomas Jones-Low's user avatar

Thomas Jones-LowThomas Jones-Low

6,9392 gold badges32 silver badges36 bronze badges

0

Do not put @ in the password you are setting or remove it from the password.
I was also getting the error and after changing it, the error got resolved.

answered Mar 12, 2022 at 18:04

Shinjini's user avatar

Guess: An oracle client is not installed on Server B.

If you do have an oracle client installed then you can still put a tnsnames file in any location (Such as a directory on a network share). In order to do this, set a TNS_ADMIN system variable (System Properties->Advanced->Environment Variables on XP) to the directory containing your tnsnames files.

For me for example I have a system variable: TNS_ADMIN — C:oracleora92networkADMIN

answered Oct 2, 2008 at 14:59

George Mauer's user avatar

George MauerGeorge Mauer

115k129 gold badges371 silver badges603 bronze badges

Is ORACLE_HOME set on server B?

answered Oct 2, 2008 at 14:59

dacracot's user avatar

dacracotdacracot

21.8k26 gold badges105 silver badges151 bronze badges

1

It seems you need to install Oracle Client on «Server B» (the application server), and configure it’s TNSNAMES.ORA file. This is required since otherwise, the running code will have no idea where to look for the database you use in the application (probably you’re configured a data source in web.config or hard-coded something).
Remember — you cannot access Oracle (easily) without Oracle Client.

answered Oct 2, 2008 at 15:00

Moshe's user avatar

MosheMoshe

2,6182 gold badges28 silver badges32 bronze badges

Had the same problem. Turns out the TNSNAMES.ORA in out deployment environment had a different ADDRESS_NAME and SID/SERVICE_NAME ,and the application was configured to use the SID — which caused the problem.

Your connection string must contain the ADDRESS_NAME and not the SID

Alessandro Minoccheri's user avatar

answered Oct 22, 2012 at 8:02

Stikut's user avatar

StikutStikut

461 silver badge4 bronze badges

Possible Resolutions —

Verify that the TNSNAMES.ORA exists and is accessible.

Make sure that there are no syntax errors in TNSNAMES.ORA.

Verify that the connection string is correct.

Verify if there are any DNS issues.

If the problem is while connect to server using PL sql developer client.try to install SQL developer within Program File instead of Program Files(x86)’s

answered Dec 24, 2013 at 2:41

Vivek Vermani's user avatar

Add the environment:

Variable Name: TNS_ADMIN

Variable Value: (YourDrive):app(UserName)product11.2.0dbhome_1NETWORKADMIN

Josh Crozier's user avatar

Josh Crozier

228k54 gold badges386 silver badges301 bronze badges

answered Jan 7, 2014 at 7:34

Rohit Hans's user avatar

I had faced the similar issue. The below code was working in my system but was not working in another server even though I had added a tns entry in tnsnames.ora file.

con = new OracleConnection();
con.ConnectionString = "User Id=username;Password=password;Data Source=uit45";
con.Open(); // throws error here

After digging and digging, I found out the solution for this. We need to ignore the entry in tns file and can be given tns entry as connection string, which worked fine for me. Try the below code.

con = new OracleConnection("Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=db-uit45.xxx)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SID=uit45)));User Id=username;Password=password");
con.Open();

Note that you need to give the associated values, especially for HOST,PORT,SID,User Id and Password.

answered Sep 17, 2016 at 11:56

Sarath Subramanian's user avatar


First published on MSDN on Jun 30, 2010

This is one of the most common errors while creating linked server to Oracle database. Today I will discuss the reason for this error and possible resolutions.

Full error message:


OLE DB provider «MSDAORA» for linked server «LINKED_ORA» returned message «ORA-12154: TNS:could not resolve the connect identifier specified».


Msg 7303, Level 16, State 1, Line 1


Cannot initialize the data source object of OLE DB provider «MSDAORA» for linked server «LINKED_ORA».

First of all make sure you have reviewed the following Microsoft KB article that has a lot of good information on troubleshooting Oracle linked server issues.

How to set up and troubleshoot a linked server to an Oracle database in SQL Server

http://support.microsoft.com/kb/280106

Also make sure you have installed Oracle Client on the SQL server. If the SQL server is 64 bit then we need to install 64 bit Oracle provider. You can also create linked server using Oracle ODBC driver together with Microsoft OLE DB provider for ODBC. Once again on a 64 bit SQL server you need to install the

64-Bit OLEDB Provider for ODBC (MSDASQL)

and 64 bit Oracle ODBC drivers. However 64-Bit OLEDB Provider for ODBC (MSDASQL) is already there in Windows Vista/Windows Server 2008 and later OS.

This particular error message is a very general error message and can happen for quite a number of reasons. For general understanding of the error, you can review oracle documentation like this

http://ora-12154.ora-code.com/

In SQL Server Linked Server, it could indicate a few things (not limited to)–

1.       SQL Server (and oracle net libraries) is not able to get the TNS alias from tnsnames.ora file.

2.       Something is wrong with the way the alias is created in the tnsnames.ora file (incorrect syntax)

3.       TNS alias could not be resolved into a connect descriptor

Below is a list of things that you can try to resolve this issue.

1. Verify that the tnsnames.ora file has the alias and the service name that the customer is using.

TNS entry for the Oracle database

===========================

OracleDB_Dev =

(DESCRIPTION =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = TCP)(HOST = server01.mydomain.com)(PORT = 1521))

)

(CONNECT_DATA =

(SERVICE_NAME = OracleDB)

(SERVER = DEDICATED)

)

)

In the above tnsnames.ora file Alias = OracleDB_Dev

Service Name: OracleDB (Actual Oracle service name [instance name in SQL])

2.  Check the sqlnet.ora file under ‘Admin’ folder in Oracle home [Dir:appproduct11.1.0client_1networkadmin] and ensure that we have TNSNames in NAMES.DIRECTORY_PATH

NAMES.DIRECTORY_PATH= (TNSNAMES, ONAMES, HOSTNAME)

3. Verify if you can connect to Oracle from the SQL server machine using tools installed with Oracle Client [For example «SQL Developer» or “SQL Plus”] with the same user id/password or TNS alias.

5. Check if the environment variable ‘PATH’ has the path for tnsnames.ora file specified.

Sample Value of Environment Variable PATH:


E:appproduct11.1.0client_1bin

;C:Program FilesBusiness ObjectsCommon3.5binNOTES;C:Program FilesBusiness ObjectsCommon3.5binNOTESDATA;%Systemroot%Microsoft.NETFrameworkv1.1.4322;%SystemRoot%system32;%SystemRoot%;%SystemRoot%System32Wbem;C:Program FilesDellSysMgtomabin;C:Program FilesMicrosoft SQL Server80ToolsBINN;C:Program FilesCommon FilesMicrosoft Sharedweb server extensions60TEMPLATEADMIN1033;C:Program FilesMicrosoft SQL Server80ToolsBinn;C:Program FilesMicrosoft SQL Server90DTSBinn;C:Program FilesMicrosoft SQL Server90Toolsbinn;C:Program FilesMicrosoft SQL Server90ToolsBinnVSShellCommon7IDE;C:Program FilesMicrosoft Visual Studio 8Common7IDEPrivateAssemblies;C:Program FilesMicrosoft Network Monitor 3


Note: make sure that the path is a valid path and there is no space.

6. Check the value of the key  ”Oracle_Home” in the registry under  HKEY_LOCAL_MACHINESOFTWAREORACLEKEY_OraClient11g_home1  and verify that it has the right path for the Oracle home.

7.  Check for the registry key “TNS_ADMIN” at HKEY_LOCAL_MACHINESOFTWAREORACLE. If it exists then make sure it has the right value as “Dir:appproduct11.1.0client_1networkadmin”. If you don’t see the key then create the key and set appropriate value as below.

Regedit->HKEY_LOCAL_MACHINE->Software->Oracle->RightClick NEW->StringValue and name

it TNS_ADMIN and give the value  “X:appproduct11.1.0client_1networkadmin”


Note: This is not a must but in some cases this is what fixed the issue.

8.   Check if SQL server start up account has permission to the Oracle Home. Also collect Process monitor log and check for “access denied”.  Process monitor log should show if we are able to find the tnsnames.ora file.

9. Make sure you don’t have multiple Oracle homes or multiple Oracle clients installed. Check the «HKEY_LOCAL_MACHINESOFTWAREORACLEALL_HOMESHOME_COUNTER» key value.

10. Check if Oracle OLE DB provider is running InProcess. If ‘yes’ then try to run out-of- process and see if that resolves the issue.

Note: You can check and verify if MS OLE DB Provider for Oracle is running InProcess from the registry key at HKEY_LOCAL_MACHINESOFTWAREMicrosoftMSSQLServerProvidersMSDAORA

11. You can try collecting simultaneous Network trace from both SQL and Oracle servers and check if there are any communications between the two servers.

12. Try to connect to Oracle from the SQL server using the UDL.  Use the same TNS name. If you get the same error that means the issue is not specific to SSMS or linked server.

Creating and Configuring Universal Data Link (.udl) Files

http://msdn.microsoft.com/en-us/library/e38h511e(VS.71).aspx

13.  Try to specify all the information in the data source instead of using the TNS alias to connect to the Oracle database (this is a way to bypass tnsnames.ora file when connecting to Oracle).

Sample Data Source:

Data Source=(DESCRIPTION=(CID=GTU_APP)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST= server01.mydomain.com)(PORT=1521)))(CONNECT_DATA=(SID=OracleDB)(SERVER=DEDICATED)));

Author : Mohammad(MSFT) SQL Developer Engineer, Microsoft

Reviewed by : Azim(MSFT), SQL Developer Technical Lead , Microsoft

Arrhhh!! I RAN INTO THIS AGAIN!!!

Just install ToadForOracle in C: or any directory without parenthesis in the path.


In my case its because I was on a x64 PC and still using the old Oracle 9i with the 32bit drivers!

I am using SQL Reporting Services with an Oracle Database. The problem is the brackets in the path to Visual Studio (BIDS). Oracle doesn’t like apps that start in a path with brackets:

RDBMS 10g XE problem with parenthesis in path

So I made a BAT file to open Visual Studio with Progra~2 as the short path name for «Program Files (x86)».

Here is the contents of the BAT file:

rem Progra~2 is short path name for "Program Files (x86)" and works around an Oracle client bug that doesn't like the ()'s in the path
start /B "C:Progra~2Microsoft Visual Studio 9.0Common7IDE" "C:Progra~2Microsoft Visual Studio 9.0Common7IDEdevenv.exe"

I name this BAT file StartBIDS.BAT and put it in the directory:

«C:Program FilesMicrosoft SQL ServerStart BIDS.bat»

Then I make a short cut to the BAT file on my Desktop and also my Start Menu and change the ShortCuts icon. This allows me to open TOAD, Visual Studio, BIDS and etc apps that I use to work with Oracle.

Update:

Alternatively make a Junction:

mklink /J "C:Program Files (x86)" "C:Program Files x86"

Then remove the brackets in the shortcut:

enter image description here

pimpom wrote:
hi i got this error when i try to connect through database client and through interoperability function from othe software to access the database.

could anyone help me on this?

ORA-12154: TNS:could not resolve the connect identifier specified

thanks.

=================================
ORA-12154: TNS:could not resolve the connect identifier specified

This error means one thing, and one thing only. The client could not find the specified entry in the tnsnames.ora file being used.

As a follow-on to that statement, remember that when you use a dblink, the database in which the link is defined is acting as a client to the database that is the target of the link. So in this case, the tnsnames.ora file on the host of your source should have an entry for your target db, as defined in the db_link.

And for the umpteenth time … this error has nothing to do with the status of a listener. The connection request never got far enough to reach a listener. If anyone tells you to check a listener, they are not paying attention, or do not understand how TNS works. This error is the equivelent of not being able to place a telephone call because you don’t know the number of the party you want to reach. You wouldn’t debug that situation by going to the other guy’s house and testing his telephone, or by going to the phone company and testing the switchboard. And you don’t debug a ORA-12154 by checking the listener. If I had a top ten list of «Incredibly Simple Concepts ™» that should be burned into the brain of everyone who claims to be an Oracle DBA, it would include «ORA-12154 Has Nothing To Do With The Listener».

=====================================

Assume you have the following in your tnsnames.ora:

larry =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = myhost)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = curley)
    )
  )

Now, when you issue a connect, say like this:

$> sqlplus scott/[email protected]

tns will look in your tnsnames.ora for an entry called ‘larry’. Next, tns sends a request to (PORT = 1521) on (HOST = myhost) using (PROTOCOL = TCP), asking for a connection to (SERVICE_NAME = curley).

Where is (HOST = myhost) on the network? When the request gets passed from tns to the next layer in the network stack, the name ‘myhost’ will get resolved to an IP address, either via a local ‘hosts’ file, via DNS, or possibly other less used mechanisms. You can also hard-code the ip address (HOST = 123.456.789.101) in the tnsnames.ora.

Next, the request arrives at port 1521 on myhost. Hopefully, there is a listener on myhost configured to listen on port 1521, and that listener knows about SERVICE_NAME = curley. If so, you’ll be connected.

A couple of important points.

First, the listener is a server side only process. It’s entire purpose in life is the receive requests for connections to databases and set up those connections. Once the connection is established, the listener is out of the picture. It creates the connection. It doesn’t sustain the connection. One listener, running from one oracle home, listening on a single port, will serve multiple database instances of multiple versions running from multiple homes. It is an unnecessary complexity to try to have multiple listeners. That would be like the telephone company building a separate switchboard for each customer.

Second, the tnsnames.ora file is a client side issue. It’s purpose is for addressess resolution — the tns equivelent of the ‘hosts’ file further down the network stack. The only reason it exists on a host machine is because that machine can also run client processes.

What can go wrong?

First, there may not be an entry for ‘larry’ in your tnsnames. In that case you get «ORA-12154: TNS:could not resolve the connect identifier specified» No need to go looking for a problem on the host, with the listener, etc. If you can’t place a telephone call because you don’t know the number (can’t find your telephone directory (tnsnames.ora) or can’t find the party you are looking for listed in it (no entry for larry)) you don’t look for problems at the telephone switchboard.

Maybe the entry for larry was found, but myhost couldn’t be resolved to an IP address (say there was no entry for myhost in the local hosts file). This will result in «ORA-12545: Connect failed because target host or object does not exist»

Maybe there was an entry for myserver in the local hosts file, but it specified a bad IP address. This will result in «ORA-12545: Connect failed because target host or object does not exist»

Maybe the IP was good, but there is no listener running: «ORA-12541: TNS:no listener»

Maybe the IP was good, there is a listener at myhost, but it is listening on a different port. «ORA-12560: TNS:protocol adapter error»

Maybe the IP was good, there is a listener at myhost, it is listening on the specified port, but doesn’t know about SERVICE_NAME = curley. «ORA-12514: TNS:listener does not currently know of service requested in connect descriptor»

=================================

Kalinkin92

0 / 0 / 0

Регистрация: 05.08.2014

Сообщений: 9

1

06.08.2014, 10:12. Показов 73301. Ответов 18

Метки нет (Все метки)


Доброго времени суток. Знаю, что эта проблема уже не раз здесь обсуждалась.
Но ни одно предложенное решение мне не помогло.
Oracle DB 11g XE, ОС windows 7.
Сервер и клиент на одной машине.
При коннекте через FORM BUILDER и другие средства из dev. suit. выдаётся ошибка «ora-12154: TNS…..»
Через SQL console и SQL developer коннектится без проблем.

Bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#tnsname.ora
XE =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = Игорь-ПК)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = XE)
    )
  )
 
EXTPROC_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
    )
    (CONNECT_DATA =
      (SID = PLSExtProc)
      (PRESENTATION = RO)
    )
  )
 
ORACLR_CONNECTION_DATA = 
  (DESCRIPTION = 
    (ADDRESS_LIST = 
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1)) 
    ) 
    (CONNECT_DATA = 
      (SID = CLRExtProc) 
      (PRESENTATION = RO) 
    ) 
  )

Пожалуйста помогите!

__________________
Помощь в написании контрольных, курсовых и дипломных работ, диссертаций здесь

0

Модератор

4186 / 3026 / 576

Регистрация: 21.01.2011

Сообщений: 13,099

06.08.2014, 11:41

2

Если работа идет через Forms (кстати какой версии?), то он использует своего клиента. Ты из какого ORACLE_HOME показываешь tnsnames.ora?

1

0 / 0 / 0

Регистрация: 05.08.2014

Сообщений: 9

06.08.2014, 13:37

 [ТС]

3

Grossmeister,
Forms версия 10.1.2.0.2

ORACLE_HOME значение= C:oraclexeapporacleproduct11.2.0server
ORACLE_HOME_KEY = SOFTWAREORACLEKEY_XE
ORACLE_HOME_NAME = XE

tnsnames.ora находится по адресу C:oraclexeapporacleproduct11.2.0servernetwo rkADMIN

0

6 / 6 / 1

Регистрация: 28.07.2014

Сообщений: 49

06.08.2014, 14:25

4

tnsping проходит?

0

Модератор

4186 / 3026 / 576

Регистрация: 21.01.2011

Сообщений: 13,099

06.08.2014, 16:03

5

Цитата
Сообщение от Kalinkin92
Посмотреть сообщение

ORACLE_HOME значение= C:oraclexeapporacleproduct11.2.0server

Я не понял. Если на компе стоят и клиент, и сервер, то ORACLE_HOME д.б. минимум 2.

Кстати, если HOST действительно с таким именем, то в некоторых версиях Oracle не нравились имена с тире.

0

0 / 0 / 0

Регистрация: 05.08.2014

Сообщений: 9

06.08.2014, 17:31

 [ТС]

6

Grossmeister,
Запись в реестре ORACLE_HOME только одна

Добавлено через 3 минуты
Vic345,
>tnsping XE
TNS Ping Utility for 64-bit Windows: Version 11.2.0.2.0 — Production on 06-└┬├-2
014 17:29:28
Copyright (c) 1997, 2014, Oracle. All rights reserved.
Used parameter files:
C:oraclexeapporacleproduct11.2.0servernetwo rkadminsqlnet.ora

Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = ╚уюЁ№-╧╩
)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = XE)))
OK (110 msec)
Пинг проходит.
Проблема может быть в том, что имя компьютера на русском?

0

Модератор

4186 / 3026 / 576

Регистрация: 21.01.2011

Сообщений: 13,099

07.08.2014, 09:41

7

Цитата
Сообщение от Kalinkin92
Посмотреть сообщение

Проблема может быть в том, что имя компьютера на русском?

Это легко проверить. Можно вместо имени хоста писать ip

0

0 / 0 / 0

Регистрация: 05.08.2014

Сообщений: 9

08.08.2014, 10:32

 [ТС]

8

Какой IP адрес указывать если сервер и клиент на одной машине?

0

Модератор

4186 / 3026 / 576

Регистрация: 21.01.2011

Сообщений: 13,099

08.08.2014, 10:48

9

Цитата
Сообщение от Kalinkin92
Посмотреть сообщение

Какой IP адрес указывать если сервер и клиент на одной машине?

Локальный ip завсегда был 127.0.0.1

Кстати, что означает твоя фраза, что клиент и сервер на одной машине? Если имеется ввиду Oracle Client, то он обязательно ставится в свой ORACLE_HOME, а из твоих слов у тебя на компе только 1 ORACLE_HOME

0

0 / 0 / 0

Регистрация: 05.08.2014

Сообщений: 9

10.08.2014, 21:22

 [ТС]

10

Grossmeister, Да всё верно, ORACLE_HOME только одна запись в реестре. Значит у меня не создан клиент? Из-за этого не удаётся подключиться к бд через oracle forms?

Добавлено через 2 часа 3 минуты
Отредактировал tnsnames.ora в oracle dev. suit. Проблема решилась.
Но теперь при подключении появляется
ORA — 00604:error occured at recursive SQL level 1
ORA — 12705:Cannot access NLS data files or invalid environment
выполнил действия
Как связать Oracle Forms с базой данных? изменений нет.
NLS_LANG = AMERICAN_AMERICA.CL8MSWIN1251

0

Модератор

4186 / 3026 / 576

Регистрация: 21.01.2011

Сообщений: 13,099

11.08.2014, 10:07

11

Цитата
Сообщение от Kalinkin92
Посмотреть сообщение

ORA — 00604:error occured at recursive SQL level 1
ORA — 12705:Cannot access NLS data files or invalid environment

Обычно такая ошибка появляется в случае, когда неправильно прописан PATH. Посмотри, что там у тебя, заодно увидишь, есть там пути к 1, или к 2 ORACLE_HOME (что-нибудь типа …ora…bin)

1

0 / 0 / 0

Регистрация: 05.08.2014

Сообщений: 9

11.08.2014, 10:38

 [ТС]

12

Grossmeister,
ORACLE_HOME=C:oraclexeapporacleproduct11.2.0 server
если добавить в конце bin, то не запускается даже sql console
NLS_LANG=AMERICAN_AMERICA.CL8MSWIN1251

>SELECT USERENV (‘language’) FROM DUAL
Выдаёт также AMERICAN_AMERICA.CL8MSWIN1251

0

Модератор

4186 / 3026 / 576

Регистрация: 21.01.2011

Сообщений: 13,099

11.08.2014, 10:50

13

PATH — это переменная окружения (environment var) Win. Просмотр — Мой компьютер — прав. кн. мыши — Свойства — Дополнительно. Или дать команду set в командной строке.

1

0 / 0 / 0

Регистрация: 05.08.2014

Сообщений: 9

11.08.2014, 11:01

 [ТС]

14

Path=C:oraclexeapporacleproduct11.2.0server bin;; <- здесь указано 2 символа ‘;’
C:DevSuiteHome_1jdkjrebinclassic;
C:DevSuiteHome_1jdkjrebin;
C:DevSuiteHome_1jdkjrebinclient;
C:DevSuiteHome_1jlib;
C:DevSuiteHome_1bin;
C:DevSuiteHome_1jre1.4.2binclient;
C:DevSuiteHome_1jre1.4.2bin;
…..
пути для других программ

0

Модератор

4186 / 3026 / 576

Регистрация: 21.01.2011

Сообщений: 13,099

11.08.2014, 12:23

15

Не работал с Forms 10 (только с Forms 6), но предполагаю, что это — C:DevSuiteHome_1bin — ORACLE_HOME для Forms.
Для проверки можно поискать в этом директории sqlplus. Если это так, то в директории C:DevSuiteHome_1networkadmin находится тот tnsnames.ora, которым пользуется Forms. Нужно привести оба tnsnames.ora в соответствие (или в реестре сделать ключик TNS_ADMIN, в котором указать путь к правильному tnsnames.ora).

На текущий момент первым в PATH стоит путь к серверному ORACLE_HOME, с которым, возможно, Forms работать не может. Поэтому перед запуском Forms нужно менять ORACLE_HOME (для смены обычно используется Home Selector в OUI — Oracle Universal Installer). Правда не знаю, как в этом случае поведет себя запущенный сервер (встречал на некоторых версиях, что сервер при смене ORACLE_HOME падал).
Либо можно для запуска Forms создать cmd-файл, в котором сначала будет устанавливаться нужный PATH (в котором путь к директориям Forms будет «первее», чем путь к серверным директориям), а только потом запускаться Forms.

0

0 / 0 / 0

Регистрация: 05.08.2014

Сообщений: 9

11.08.2014, 13:12

 [ТС]

16

Grossmeister,
Какое значение должен иметь ORACLE_HOME?
На какую директорию он должен указывать чтобы формы подключались?

0

Модератор

4186 / 3026 / 576

Регистрация: 21.01.2011

Сообщений: 13,099

11.08.2014, 13:24

17

Цитата
Сообщение от Kalinkin92
Посмотреть сообщение

На какую директорию он должен указывать чтобы формы подключались?

Если мое предположение верно, то C:DevSuiteHome_1

0

0 / 0 / 0

Регистрация: 05.08.2014

Сообщений: 9

11.08.2014, 16:52

 [ТС]

18

Grossmeister,
Я изменил ORACLE_HOME на C:DevSuiteHome_1
Oracle form перестал отвечать.
Возможны ещё какие нибудь варианты решения?

Добавлено через 2 часа 53 минуты
Товарищ Grossmeister,
Очень надеюсь на вашу помощь!

0

0 / 0 / 0

Регистрация: 15.02.2011

Сообщений: 9

23.01.2019, 11:45

19

ГУГЛ поиск сосрана ERROR ORA 12154 TNS

ORACLE_HOME правильный путь где библиотека отвечает

OCI.DLL oraclient11.dll ORACORE11.DLL

вот и приложите правильный путь — ЖИРНАЯ это версия клиента ОРАКЛА 11

NLS_LANG = AMERICAN_AMERICA.CL8MSWIN1251 — это в REGEDIT
КомпьютерHKEY_LOCAL_MACHINESOFTWAREORACLE ищите там NLS_LANG

TNSNAMES
Мой компьютер — прав. кн. мыши — Свойства — Дополнительно. кнопка ПЕРЕМЕННЫЕ СРЕДЫ
там ПЕРЕМЕННЫЕ СРЕДЫ ПОЛЬЗОВАТЕЛЯ кнопка СОЗДАТЬ первой строке TNSNAMES , а ниже ORCL по умолчанию установки , а ваш как меняли ли при установке СЕРВИС SID ? XE

0

IT_Exp

Эксперт

87844 / 49110 / 22898

Регистрация: 17.06.2006

Сообщений: 92,604

23.01.2019, 11:45

Помогаю со студенческими работами здесь

ORA-12154
ORA-12154: TNS:невозможно разрешить заданный идентификатор соединения
Знаю что ошибка очень…

ORA-12154!
Пытаюсь подключиться к серву через PL/SQL developer и выдает эту ошибку( ORA-12514: TNS:listener…

Sqlplus из shell. ORA-12154
Доброго.

Немогу запустить sqlplus из скрипта. Если нужных значений в переменных $ORACLE_HOME,…

Forms Builder, ORA-12154
Хочу поставить на одной машине сервер базы и сервер приложений.

— Установилa Oracle Database…

Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:

19

Have you gotten an “ORA-12154: TNS:could not resolve the connect identifier specified” error? Learn what causes it and how to resolve it in this article.

ORA-12154 Cause

If you attempt to access or log on to an Oracle database, you might get this error:

ORA-12154: TNS:could not resolve the connect identifier specified

This means that the tnsnames.ora file was not found or has an error within it.

There are a few steps you can take to resolve this ORA-12154 error.

Check that the tnsnames.ora file exists

There is a tnsnames.ora on both the client and server systems. It’s located in the ORACLE_HOME/network/admin directory. I’ve written a guide to the TNSNAMES file here which has more information.

ORACLE_HOME is where your Oracle database is installed on the server, or on your own computer if you’re using Oracle Express.

For example, in my installed version of Oracle Express, my ORACLE_HOME is:

C:oraclexeapporacleproduct11.2.0server

If I open the network then admin folders, I will see a tnsnames.ora file.

TNSNAMES Location

If it exists in this folder, then you need to check that it has no errors (see the next step).

If it doesn’t exist, then you can create one.

To do this:

  1. Create a new file in this folder and call it tnsnames.ora.
  2. Open the file in a text editor and add the information in this format:

The syntax of the tnsnames.ora file is:

<addressname> =
(DESCRIPTION =
  (ADDRESS_LIST =
  (ADDRESS = (PROTOCOL = TCP)(Host = <hostname>)(Port = <port>))
  )
(CONNECT_DATA =
  (SERVICE_NAME = <service_name>)
)
)

The example in my Oracle Express instance is:

XE =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = Ben-PC)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = XE)
    )
  )

So, just copy and paste this into your new tnsnames.ora file, make changes as necessary, and save it.

Try your connection again (the one where you got the error) and see if it works.

Check that TNSNAMES.ORA has no syntax errors

If the file exists, open it and see that there are no syntax errors.

Using the example above:

XE =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = Ben-PC)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = XE)
    )
  )

Check that the brackets are all in the right place, there are no quotes in there, no missing lines or anything unexpected.

Check that TNSNAMES.ORA has your service name in it

To be able to connect to your database, the tnsnames.ora file needs to have your service name in it.

Open the tnsnames.ora file and add it in there if it does not exist, using the examples above.

Check that TNSNAMES.ORA has read permission

Sometimes, the file can exist and be syntactically correct, but doesn’t have any permissions.

If other users or processes cannot read the file, you’ll get the ORA-12154 error.

So, check that the file can be read by other users by applying read permissions to it.

Run the TNSPING Utility

Oracle includes a tnsping utility for checking that the TNSNAMES is OK.

You can find this by going to ORACLE_HOME/bin/tnsping.exe

For example:

C:oraclexeapporacleproduct11.2.0serverbin

If you’re on Windows, you can open the Command Prompt and CD to this directory.

Then, run tnsping xe (or your service name you want to check)

This should show if it is OK or not.

TNSADMIN Environment Variable is Missing

If you’re connecting on Windows, this error can sometimes happen if the TNSADMIN environment variable is missing.

To check this:

  1. Go to Start > Control Panel
  2. Open System
  3. Click “Advanced system settings”
  4. Click Environment Variables
  5. Add a new system variable called TNSADMIN with a value of ORACLE HOMEnetworkadmin

This is often not needed, but if you’ve tried everything else, and are still getting the ORA-12154 error, you can try adding the TNSADMIN environment variable.

So, there are a few solutions to the “ORA-12154: TNS:could not resolve the connect identifier specified” error.

Lastly, if you enjoy the information and career advice I’ve been providing, sign up to my newsletter below to stay up-to-date on my articles. You’ll also receive a fantastic bonus. Thanks!

Добавить комментарий