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

Whenever I try to login or connect into SQL command line or SQL*Plus (11g Standard Edition Win64) I get an error
ORA-12154: TNS:could not resolve the connect identifier specified.
I have tried to solve this problem with google help but I can't.
so please help me out of this!

You are trying to connect to a database v. "v" is the connect identifier. However, your Oracle client does not know of v. This is what the error message is trying to tell you.
Try
c:>tnsping v
Hopefully this will give you something like this:
C:\Users\rwe>tnsping v
TNS Ping Utility for 64-bit Windows: Version 12.2.0.1.0 - Production on 21-MAR-2018 15:49:51
Copyright (c) 1997, 2016, Oracle. All rights reserved.
Used parameter files:
C:\app\rwe\product\11.2.0\dbhome_1\network\admin\sqlnet.ora
TNS-03505: Failed to resolve name
What you can extract from this is the location:
C:\app\rwe\product\11.2.0\dbhome_1\network\admin\
This is where your tnsnames.ora file resides. Edit this file and add the correct information for your database v. Substitute servername for the machine your Oracle database is on.
V =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = tcp)(HOST = servername)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = V)
)
)

Related

Running PL SQL script in Jenkins

I am able to download code from clear case using Jenkins.
Now I am trying to run a SQL script from Jenkins.
Please see my configuration below:
enter image description here
When I am running the same script from command prompt it runs but through Jenkins I am getting the following error:
SQL*Plus: Release 11.2.0.3.0 Production on Mon Sep 17 16:12:40 2018
Copyright (c) 1982, 2011, Oracle. All rights reserved.
ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified
Enter user-name:
Do you have an idea what I am doing wrong here?
Thanks,
Raj Vardhan
It looks like from the error you've shown that sqlplus isn't able to resolve the connection you're attempting to use in your tnsnames.ora file (DEVGEM12.ikeadt.com).
Double check that your tnsnames.ora file (usually located in $ORACLE_HOME/network/admin) contains a definition for this connection, something like this:
DEVGEM12 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.0)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = DEVGEM12.ikeadt.com)
)
)
Or alternatively you could change how you're calling sqlplus to skip using tnsnames.ora, and use EZconnect syntax like so:
sqlplus user/password#//hostname:port/service_name
Or in your case:
sqlplus gemini/password#devgem12.ikeadt.com/yourservicenamehere #\\ITINBAC-DWW0260\Jenkins\TEST.sql > your_log.log

Oracle Database Connection Error Listener Refused the Connection

I just installed Oracle 11g on my work dev computer which has Windows 7 64-bit and is on a network with a domain set up. When I try to connect to the "XE" database/SID using SQL Developer I get the following errors list below.
Any ideas?
I've researched online and tried a number of the solutions suggested and cannot get it to work. I can confirm the following:
The database is started. I can connect using SQL Plus.
Both the OracleServiceXE and OracleXETNSListener services are started
Internet Information Systems (IIS) is installed and working properly.
In addition to not being able to connect with SQL Developer, when I the the "Get Started" web application, it doesn't work.
When I first tried to connect, the settings in SQL Developer were as follows:
Hostname: localhost
Port: 1521
SID: xe
However, I got the following error:
Status : Failure -Test failed: Listener refused the connection with the following error: ORA-12505
After researching I found that I should look at the listener end points (whatever that means) in the "listner.ora" file and confirm the hostname. That file has the following:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = C:\Oracle\oraclexe\app\oracle\product\11.2.0\server)
(PROGRAM = extproc)
)
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = C:\Oracle\oraclexe\app\oracle\product\11.2.0\server)
(PROGRAM = extproc)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = mycomputername.abc.de.mycompany.com.)(PORT = 1521))
)
)
DEFAULT_SERVICE_LISTENER = (XE)
When I saw that the host name was different I first tried changing "HOST" in the listener.ora file from "mycomputername.abc.de.mycompany.com." to "localhost" and then to "127.0.0.1" (note the previous really has an extra period at the end). After doing that, I still got the same error message.
Then, I put everything back the way it was in the "listener.ora" file and instead went to SQL Developer and changed my login information to the following:
Hostname: mycomputername.abc.de.mycompany.com. (again... there really is a period at the end)
Port: 1521
SID: xe
I even tried it with just "mycomputername". Again, I got the error message:
Status : Failure -Test failed: Listener refused the connection with the following error: ORA-12505
I found help from a friend of a friend. Here's what he did.
First, note that he left the settings in the "listener.ora" file alone. Instead he did the following... all from the command prompt.
Step 1: Run SQL Plus directly from the command prompt as the "sysdba" to simulate SQL Plus within the command prompt.
C:\windows\system32>sqlplus / as sysdba
Step 2: Enter the following SQL Plus command to verify the database name (aka global name or SID). The return value was "XE".
SQL> select * from global_name;
Step 3: Enter the following SQL Plus command to set the listner to use the 'localhost' as the "HOST". Apparently, the listener this will override the settings in the "listner.ora" file. I think he said this is saved in the database somewhere and is not saved in a file.
SQL> alter system set LOCAL_LISTENER='(DESCRIPTION_LIST = (DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) (ADDRESS = (PROTOCOL = TCP)
(HOST = localhost)(PORT = 1521))))';
Step 4: Enter the following SQL Plus command to register what you set in step 3 above.
SQL> alter system register;
Step 5: Exit the SQL plus simulation in the command prompt.
SQL> exit

Allow remote access to Oracle 12c (listener failed)

After finish the installation of Oracle 12c on Centos 7, now I try to allow access on my PC (via SQL Delopper) to the server. But the probleme is that when I do:
lsnrctl status
I get this error:
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 2: No such file or directory
So, I try to start the listener with:
lsnrctl start
And I get this error:
TNS-01198: Listener failed to initialize valid node list
NL-07007: internal error
NL-00408: cannot find or read value
NL-00408: cannot find or read value
NL-00408: cannot find or read value
To finish I go to this website: https://wiki.scn.sap.com/wiki/display/ORA/TNS-01198%3A+Listener+failed+to+initialize+valid+node+list+post+upgrade+from+11g+to+12c
Then I added, as he tell the following line on the listener.ora file
VALID_NODE_CHECKING_REGISTRATION_<LISTENER_SERVICENAME> = OFF
but nothing change.
To finish, this is my listener.ora file:
#listener.ora Network Configuration File: /home/oracle/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
#Generated by Oracle configuration tools.
VALID_NODE_CHECKING_REGISTRATION_<LISTENER_SID> = OFF
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 84.254.25.9)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
Does anyone have a solution?

Can't connect to Oracle database with SQL Developer (Ora00604 error occurred at recursive level 1 ORA - 12705)

I have installed Oracle 11g Express Edition from http://www.oracle.com/technetwork/database/database-technologies/express-edition/downloads/index-083047.html and also installed SQL Developer, but when I try connect to Oracle Database from Developer (I try create new connection) next error appears:
Ora00604 error occurred at recursive level 1 ORA - 12705.
What should I enter at: Hostname, port and SID
TNSNAMES provided below:
XE = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = DYedilkhan-ПК)(PORT = 1521))
(CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = XE)))
Add this rows into ..\sqldeveloper\ide\bin\ide.conf file
AddVMOption -Duser.language=en
AddVMOption -Duser.region=us
It's working for me.
if you don't know what language and region to use, you can add
AddVMOption -Duser.region=
(nothing after =)
It worked in my case as macloving solution did too
Solved by changing system language. In my case the problem occurred because Windows decided to change my "display language" to English(Kenyan), and unsurprisingly it wasn't supported by the Database.

How to query an external MS Access DB from an Oracle DB?

How to configure Oracle to be able to query a MS Access database (.accdb) that is lcoated in the same server (localhost)?
Which steps to follow?
Version of Oracle: 11g -> 11.2.0.1.0
Version of Windows: Windows Server 2008
Steps to complete:
Create System DSN with Microsoft Access Driver
Modify listener.ora file
Create the file initaccess.ora
Modify tnsnames.ora file
Restart listener
Check connection with access database
Create the DB Link in Oracle
STEP 1: Create system DSN
First go to ODBC Data Source Administrator click on System DSN tab. The create a DSN with the following parameter (you can choose the name link that you prefer but then you need to keep the same name all over the process).
In our case:
Driver: Microsoft Access Driver (*.mdb,*.accdb)
Name: access
Description: (doesn't matter)
Database -> Select -> (Select the .accdb or .mdb database)
Save the configuration
Make sure you see this listed once you save it:
Name - Driver
access - Microsoft Access Driver (*.mdb,*.accdb)
STEP 2: Modify listener.ora file
Let's locate the file. In our case:
E:\app\Administrador\product\11.2.0\dbhome_1\NETWORK\ADMIN
We need to add the following text at the end. By the way, look at I posted as 'oracle_home' the directory in C: drive. That's because I had more than one directory related to Oracle, and I still don't understand it but worked in my case. Maybe in yours there's only one.
Parameters you need to modify:
In first block:
SID_NAME: name chosen in the step above. The name of the dsn created ('access' in our case)
ORACLE_HOME: Home directory of Oracle
PROGRAM = dg4odbc (I think that from Oracle 11g and beyond, 'dg4odbc' is mandatory.
In second block:
HOST: The name of the hostname (not sure if localhost' or an IP address are supported, but I guess they are)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC=
(SID_NAME = access)
(ORACLE_HOME = C:\app\Administrador\product\11.2.0\dbhome_1)
(PROGRAM = dg4odbc)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = host_name)(PORT = 1521))
)
)
Make sure there is no space before 'SID_LIST_LISTENER' or 'LISTENER' in the file you modify:
STEP 3: Create the initaccess.ora file
Go to:
E:\app\Administrador\product\11.2.0\dbhome_1\hs\admin
There, make a copy of 'initdg4odbc.ora' file (I deleted it after I made a copy). Add the following text to the file:
HS_FDS_CONNECT_INFO = access
HS_FDS_TRACE_LEVEL = 0
HS_FDS_CONNECT_INFO: Here we write the name of the link created in the ODBC source tool in the first step, so it's 'access'
HS_FDS_TRACE_LEVEL: Leave it with a 0
STEP 4: Modify tnsnames.ora file:
Let's locate the file. In our case:
E:\app\Administrador\product\11.2.0\dbhome_1\NETWORK\ADMIN
Parameters to modify:
HOST: hostname of the server
SID: this is the name of the 'initaccess.ora' file BUT taking away the 'init' part and '.ora' file extension: then 'access'.
(HS=OK) = don't forget this.
access =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = host_name) (PORT = 1521))
(CONNECT_DATA =
(SID = access)
)
(HS=OK)
)
Be sure that you don't leave spaces before the 'access =' parameter.
STEP 5: Restart the listener
Open a command line terminal
Go to: C:\app\Administrador\product\11.2.0\dbhome_1\BIN
Stop the listener
C:\app\Administrador\product\11.2.0\dbhome_1\BIN>LSNRCTL.EXE stop
You should see a message saying it was successfull
Restart the listener
C:\app\Administrador\product\11.2.0\dbhome_1\BIN>LSNRCTL.EXE start
You should see a message saying it was successfull
You should also see, (in the output, when restarting the server) a message talking about the 'access' service we just added
El servicio "access" tiene 1 instancia(s).
La instancia "access", con estado UNKNOWN, tiene 1 manejador(es) para este ser
vicio...
El comando ha terminado correctamente
STEP 6: Test connection with the access database
Open a command line terminal
Go to: C:\app\Administrador\product\11.2.0\dbhome_1\BIN
Run tnsping.exe (as argument, pass the name of the link: 'access'):
C:\app\Administrador\product\11.2.0\dbhome_1\BIN>tnsping.exe access
You should see a message saying it was correctly run and displaying the delay in msecs
TNS Ping Utility for 64-bit Windows: Version 11.2.0.1.0 - Production on 06-JUN-2
014 11:04:35
Copyright (c) 1997, 2010, Oracle. All rights reserved.
Archivos de parßmetros utilizados:
E:\app\Administrador\product\11.2.0\dbhome_1\network\admin\sqlnet.ora
Adaptador TNSNAMES utilizado para resolver el alias
Intentando contactar con (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = CUPCA
KE) (PORT = 1521)) (CONNECT_DATA = (SID = access)) (HS=OK))
Realizado correctamente (20 mseg)
STEP 7: Create the DB Link in Oracle and query the Ms Access database:
Create the DB Link (always as **sys):**
CREATE public DATABASE LINK accessdblink USING 'access';
* 'access': Same name as in tnsnames.ora -> 'access = '
Query the database:
SELECT * FROM table_name#accessdblink;

Resources