Oracle connection unable to connect with SID defined - oracle

I have a single database instance and I'm able to connect to it by just using the user and password as such:
sqlplus system/password
However if I try to add an SID to the connection I get the following error:
sqlplus system#db1/password
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
I tried to enter a different incorrect SID to check if I get the same error but I get another error:
sqlplus system#wrongdb/password
ORA-12514: TNS:could not resolve the connect identifier specified
I've used the netcfa to create the listener and the service entry is present in the TNSNAMES.ora file. What is preventing the connection with SID?
EDIT: I'm also able to tnsping the service:
tnsping SCDEMO
Used TNSNAMES adapter to resolve the alias Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = localhos t)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = SCDEMO)))
OK (0 msec)

The syntax is wrong, it must be
sqlplus system/password#db1

Related

how do i set up oracle instant client on ubuntu 18.04?

so I'm trying to monitor oracle database by ODBC on zabbix, but my zabbix server is ubuntu 18.04 and I really confused because oracle is using rpm.
i do this step by step to configure oracle instant client:
https://sudonull.com/post/110401-Monitoring-Oracle-Database-through-ODBC-in-Zabbix
but while im trying to install sqlplus I got confused because of tnsnames.ora,
on tutorial he said to create a connection to the database with the name TESTDB for example, it's look like this:
TESTDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oratestdb)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = testdb)
)
)
so I made it exactly look like above, I do config /etc/hosts too but it got this error "TNS NO LISTENER" while trying to connect sqlplus.
I try to start lsnrctl but apparently it doesn't have lsnrctl.service
my question is,
is it "TESTDB" something that i just made up or it should be the name of database on oracle database?
when you finally try login in "sqlplus example/example#example" is it using user and password from oracle database that you have?
is it "TESTDB" something that i just made up or it should be the name
of database on oracle database?
Taking your own example
TESTDB = -- you can give any name of your wish here
(DESCRIPTION =
(ADDRESS = -- following 3 fields are details of DB server
(PROTOCOL = TCP)
(HOST = oratestdb)
(PORT = 1521)
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = testdb) -- This is the service name of the DB on given server
)
)
when you finally try login in "sqlplus example/example#example" is it
using user and password from oracle database that you have?
Yes this is the password of oracle DB user
sqlplus scott/tiger#TESTDB

Need Help To Resolve ORA-12154

I installed Oracle 12cR2.
Everything is fine.
Connected as SYS, Successful.
Now, what I did is changed my Container DB i.e. CDB$ROOT to ORCLPDB (Using Alter Session). And Created a User Called demo with password. Granted necessary permissions. Successful.
In that same session, I tried to connect to demo User, but unable to connect to it.
Error Shows as Follow:
ORA-12154: TNS:could not resolve the connect identifier specified.
How can I resolve this issue?
(Note: The user is in PDB)
tnsnames.ora
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SID = orcl)
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
you are trying to connect to Demo/Password#ORCLPDB
there is no alias ORCLPDB in your tnsnames.ora, so Oracle complains that it can't find it
therefore:
connect to Demo/Password#ORCL (as you have ORCL in tnsnames.ora), or
modify the file and
add the new database alias (ORCLPDB) if it is a different database, or
add yet another alias for the same database, e.g. ORCL, ORCLPDB = ...

Oracle Listener stopped working

I have an issue with my Oracle listener. I am running on RHEL6 and all of a sudden Listener stopped working. I am able to sqlplus / as syadmin and it works fine from terminal.
Whenever I run command lsnrctl status, lsnrctl start, lsnrctl stop it gives below error.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dev32018)(PORT=1521)))
TNS-12538: TNS:no such protocol adapter
TNS-12560: TNS:protocol adapter error
TNS-00508: No such protocol adapter..
I can ping dev32018 and it is successful. And in the log file below message is shown.
type=UNKNOWN level=16 host_id=dev32018
host_addr=10.68.11.186
TNS-01150: The address of the specified listener name is incorrect
TNS-01153: Failed to process string: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dev32018)(PORT=1521)))
Everything was working fine and no modifications was made on listener.ora or any configuration file, the issue happened all of a sudden, we restarted the machine , restarted the network and still no use.
Anybody who can help in resolving issue.?
I have an issue with my Oracle listener. I am running on RHEL6 and all of a sudden Listener stopped working. I am able to sqlplus / as syadmin and it works fine from terminal.
Whenever I run command lsnrctl status, lsnrctl start, lsnrctl stop it gives below error.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dev32018)(PORT=1521)))
TNS-12538: TNS:no such protocol adapter
TNS-12560: TNS:protocol adapter error
TNS-00508: No such protocol adapter..
I can ping dev32018 and it is successful. And in the log file below message is shown.
type=UNKNOWN level=16 host_id=dev32018
host_addr=10.68.11.186
TNS-01150: The address of the specified listener name is incorrect
TNS-01153: Failed to process string: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dev32018)(PORT=1521)))
Everything was working fine and no modifications was made on listener.ora or any configuration file, the issue happened all of a sudden, we restarted the machine , restarted the network and still no use.
Anybody who can help in resolving issue.?
Updated as requested in comments
tnsnames.ora Network Configuration File: /app1/oracle/product/11.2.0.4/db_1/network/admin/tnsnames.ora
Generated by Oracle configuration tools.
DEV32018 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = dev32018)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = dev32018.corp.ae)
)
)
DEV3DB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = dev32018)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = dev32018.corp.ae)
)
)
Listener.ora
listener.ora Network Configuration File: /app1/oracle/product/11.2.0.4/db_1/network/admin/listener.ora
Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = dev32018)(PORT = 1521))
)
)
LISTENER2 =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = dev32018)(PORT = 1522))
)
)
ADR_BASE_LISTENER = /app1/oracle
---------------------------------nslookup 10.68.11.186------------
oracle#dev32018 admin]$ nslookup 10.68.11.186
Server: 10.51.156.161
Address: 10.51.156.161#53
** server can't find 186.11.68.10.in-addr.arpa.: NXDOMAIN
--------------------------------nslookup dev32018---------------------------
[root#dev32018 etc]# nslookup dev32018
;; Got SERVFAIL reply from 10.51.156.161, trying next server
;; Got SERVFAIL reply from 10.55.155.32, trying next server
Server: 10.37.164.207
Address: 10.37.164.207#53
** server can't find dev32018: SERVFAIL
-------Telnet
[root#dev32018 etc]# telnet dev32018 1521
Trying 10.68.11.186...
telnet: connect to address 10.68.11.186: Connection refused
I have solved the problem by running the script "relink " in oracle home/bin directory
$ORACLE_HOME/bin
relink all
It took some 30 seconds to complete and afer that the listener command started working.
I am not sure what was the problem and what this script has corrected.
Thank you for all
Make you sure that you are running lsnrctl status in Oracle user if not.
Please try in terminal or log as Oracle USER.
$ su
# su - oracle
$ whoami
In this point whoami should give you back Oracle and you can run lsnrctl status
And the listener will be start now :D
You can do a sh file and add this to etc/init.d to autorun that when you start again the machine.
Update
You will need to run the next comand in Oracle user.
. /u01/app/oracle/product/11.2.0/xe/bin/oracle_env.sh
This is for Oracle XE, you can find this specific comand in the documentation of installation of you Oracle Version. And next you will be able to run lsnrctl status

ORA-12560: TNS: Error protocol Adapter

I would like to export database schema with expdp/impdp. For that reason I am trying to do the same steps like in this tutorial.
when I enter sqlplus / as sysdba in the command line, I will be ased to enter user name and pasword. When I do this and click Enter, the following errors is comming:
ORA-12560: TNS: Error protocol Adapter
I am using windows 7 and have installed oracle 12c. All oracle services are started. I login from cmd.exe as adminstrator
I think I know the problem. You said that you did the same steps in the tutorial.
In the tutorial, he did this step C:>set oracle_sid=db.
Did you have the same name of the Oracle SID ? If you did a default installation, by the default the Oracle SID is orcl .
In your case, do this C:>set oracle_sid=ORCL. To verify the Oracle SID, go to this path C:\oracle\app\oracle\product\11.2.0\server\network\ADMIN and open the listener.ora and check the host name.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST =ORCL)(PORT = 1521)
)
)
)
If you have HOST=ORCL, then you must do this C:>set oracle_sid=ORCL. If you have another name, do this C:>set oracle_sid=NAME_OF_YOUR_HOST
TNS adpater is because you are creating a local uses under orcl, please create a user under pdborcl, this will solve your connectivity problem.

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

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
The answer to this problem is very simple. Do not worry about the .ora files or any other configuration. Oracle does all these just perfect.
Only while connecting via command line, it gets confused with passwords that have a # symbol in them.
Therefore while connecting through command line SQL, do not use a password with a '#' in it. Just use the web interface to create an account having a password without an '#' symbol in it.
That is!! Problem solved. I had been breaking my head for quite a few days, and now my problem is solved!!
Can you ping ud06 successfully (as ud06, not ud06.us.server.com)?
What does the command
lsnrctl services
show?
EDIT:
It sounds to me like maybe the database instance name isn't actually "orcl"? What the lsnrctl services output tells me is that the "orcl" service, although defined in the listener.ora file, is not actually running.
Can you log on with a direct connection on the server? If so, what do you use as the ORACLE_SID environment variable value? Log in as the SYS user and issue the command:
ALTER SYSTEM REGISTER;
Then issue the lsnrctl services command again and see if an additional instance doesn't show up.
Also, as Alex points out, the tnsping command is reporting a fully qualified service name. Edit the sqlnet.ora file and set the NAMES.DEFAULT_DOMAIN value to NULL if it has a value.
EDIT 2: Does tnsping ud06 on the server work? Or is my assumption that client and server are on different systems wrong?
The SERVICE_NAME in the tnsping output doesn't match the entry in tnsnames.ora; is that file from the Windows box or the Linux box? It looks like you don't have a local (Windows) tnsnames.ora entry for u06 and it's guessing what the service name should be expanding it - I think that's what the reference to the hostname adapter means.
I also run into ORA-12154: TNS:could not resolve the connect identifier specified, and adding the user trying to connect to the oinstall group of oracle fixed it.
first try whether the oracle instance is started :
for windows:
start->configuration panel-> administration touls->Services->ORACLESERVICEORCL(my instance by the way)->start
Provide the connection string like this:
ServerName:port/ServiceName;User Name;Password
I was also facing the same error, try this code:
SQL> conn hr/hr #pdborcl;
and if you find same error, it means that you have a different pluggable database name.
Check the pluggable database name by just writing the following command in sqlplus
sql> SELECT name, con_id FROM v$pdbs;
I fixed this problem using this steps.
First of all, this error occured , if you didn't install same directory or drive.
But the answer is here.
Login windows as a Adminstrator.
Go to Control Panel.
System Properties and click Enviroment
Find the OS variable and change name as a "TNS_ADMIN"
And change the value as a "tnsnames's directory address"
Restart the system.
Congrulations.

Resources