Unable to connect to a database using sqlplus - oracle

I have configurated into my tnsnames.ora my connection string. In my sqlnet.ora my content is as follows:
NAMES.DIRECTORY_PATH= (LDAP, TNSNAMES, HOSTNAME)
NAMES.DEFAULT_DOMAIN = WORLD
TRACE_LEVEL_CLIENT = OFF
SQLNET.EXPIRE_TIME = 30
When I make a tnsping call to a SID from tnsnames.ora I'm gettin the error:
TNS-03505: Failed to resolve name
Sample configuration from tnsname.ora
TNS_NAME =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = HOST.NAME)(PORT = PORT_NUMBER))
)
(CONNECT_DATA =
(SERVICE_NAME = SID)
)
)
What am I doing wrong?

I have used the following connect string without using tnsnames.ora for mappings in order to connect to remote database:
sqlplus username/password#(DESCRIPTION =
(ADDRESS = (PROTOCOL= TCP)(Host= hostname.network)(Port= remote_port))
(CONNECT_DATA = (SID = remote_SID))
)

Related

Oracle Database 12c Connection

I have already set up an Oracle Database but I am facing a connectivity problem in the below manner:
sqlplus CISADM/CISADM#<IP>:1521/PSRM
sqlplus CISADM#PSRM
With the above two options I successfully connect to the database. Although, when I try to connect as:
sqlplus CISADM#<IP>:1521/PSRM
I get the following error :
ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA
I can perform ping either with IP, or hostname, tnsping with IP and hostname successfully.
My tnsnames.ora file:
PSRM =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = <IP>)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = PSRM)
)
)
My sqlnet.ora file:
SQLNET.AUTHENTICATION_SERVICES= (NTS)
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
I am connecting from client PC to a Database which is located in a VM. The above files are from client
Files from VM, where Database is hosted:
tnsnames.ora:
PSRM =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = <IP>)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = PSRM)
)
)
listener.ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = <IP>)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
Any ideas?
You should run it like this :
sqlplus CISADM#\"<IP>:1521/PSRM\"
Important: The \" in the beginning and end of the server:port/service is part of the syntax.

cannot connect to oracle database with SQLPLUS via service name

I am trying to connect to an Oracle database from SQLPLUS using service_name but I received the
ORA-12154 error (ORA-12154: TNS:could not resolve the connect identifier specified.
NOTE: when I am using the SQL Developer, everything works fine.
here it is my tnsnames.ora settings:
SAMPLEDB =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = sampledb)
)
)
This is the connection command I use:
sqlplus test/password#localhost:1521/sampledb
Can someone tell me what am I doing wrong, please?
Besides the obvious (the command to start SQL*Plus is, of course, sqlplus), you are missing a line in the definition of the SAMPLEDB connect identifier.
Insert between the first and the second line the following line (EXACTLY as written below):
(DESCRIPTION =
You must have deleted it somehow.
SAMPLEDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = sampledb)
)
)

Status : Failure -Test failed: Listener refused the connection with error: ORA-12514, TNS:listener does not currently know of service requested

I am getting this error while connecting to oracle 12c from SQL Developer,
Status : Failure -Test failed: Listener refused the connection with the following error:
ORA-12514, TNS:listener does not currently know of service requested in connect descriptor
My tnsnames.ora file contents is:
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
) )
ORCL1 = (DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.1.10)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl.abc.com)
) )
ORCL = (DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = INT.abc.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl.abc.com)
) )
My listener.ora file contents is:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = C:\app\oracle\product\12.1.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:C:\app\oracle\product\12.1.0\dbhome_1\bin\oraclr12.dll")
)
)
LISTENER = (DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = INT.abc.com)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
) )
I am using Service Name as 'orcl1' and Host Name as '10.10.1.10' in sql developer "Add Connection" window and getting the above error.
I am able to connect to sqlplus using cmd with proper username and password.
Any help will be appreciated.
I was able to connect to SQL Developer, once i changed my Service Name to "orcl.abc.com"
It seems like you are connecting through sqlplus using orcl. check your hostname. In tnsnames.ora you are using int. abc.cm and in listener you are using ipaddress. Try to keep both same. Change hostname in tnsnames.ora to ipaddress.

Creating an oracle database connection with Talend Open Studio

I want to create a database connection with talend open studio. I have installed oracle 10g and sqlplus environnement.
When I have tried creating a connection, I get this error:
java.lang.RuntimeException: java.sql.SQLException: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
at org.talend.core.model.metadata.builder.database.JDBCDriverLoader.getConnection(JDBCDriverLoader.java:164)
at org.talend.core.model.metadata.builder.database.ExtractMetaDataUtils.connect(ExtractMetaDataUtils.java:1049)
at org.talend.core.model.metadata.builder.database.ExtractMetaDataFromDataBase.testConnection(ExtractMetaDataFromDataBase.java:311)
at org.talend.repository.ui.utils.ManagerConnection.check(ManagerConnection.java:266)
at org.talend.repository.ui.wizards.metadata.connection.database.DatabaseForm.checkConnection(DatabaseForm.java:2294)
at org.talend.repository.ui.wizards.metadata.connection.database.DatabaseForm.access$45(DatabaseForm.java:2217)
at org.talend.repository.ui.wizards.metadata.connection.database.DatabaseForm$26.widgetSelected(DatabaseForm.java:2549)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:234)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4066)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
....
Here is my login and password:
this is the tnsnames.ora's content
# tnsnames.ora Network Configuration File: D:\oracle\product\10.2.0\db_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = user)(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)
)
)

Oracle TNS-12505 Error

I am working with Oracle and what I had to do was to export the existing database to new installation.
I have installed new oracle client 8.1 (Previous was 8.0), I have successfully imported all the instance of database,(Users,Roles, everything).
Basically it is Server and from other individual clients it shares data.
What I am facing a problem now is ,
any XYZ client can not varify its login credentials. I am getting two different types of erros. below I will mention:
TNS-12505: TNS:listener could not resolve SID given in connect descriptor
TNS-12500: TNS:listener failed to start a dedicated server process
TNS-12560: TNS:protocol adapter error
TNS-00530: Protocol adapter error
I have tried almost every option by googling the specified errors.
I have configured the TNSNAMES.ora and LISTENER.ora at server installation and test , they are working well.
But the issue is when I connect through client after configuring TNSNAMES using "Net8 Assitant" it shows the following error.
TNS-12505: TNS:listener could not resolve SID given in connect descriptor
I will try to attach the Configuration files data:
TNSNAMES.ora # Server
# D:\ORANT\NETWORK\ADMIN\TNSNAMES.ORA Configuration File:d:\orant\NETWORK\ADMIN\tnsnames.ora
# Generated by Oracle Net8 Assistant
DATA =
(DESCRIPTION =
(SOURCE_ROUTE = OFF)
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.109)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = data)
(GLOBAL_NAME = data)
(SRVR = DEDICATED)
)
)
LISTENER.ora # Server
# D:\ORANT\NETWORK\ADMIN\LISTENER.ORA Configuration File:d:\orant\NETWORK\ADMIN\listener.ora
# Generated by Oracle Net8 Assistant
LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = rwr_mis)(PORT = 1521))
(PROTOCOL_STACK =
(PRESENTATION = TTC)
(SESSION = NS)
)
)
And Finally TNSNAMES.ora # Client
# C:\ORANT\NET80\ADMIN\TNSNAMES.ORA Configuration File:C:\orant\net80\admin\tnsnames.ora
# Generated by Oracle Net8 Assistant
data =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS =
(PROTOCOL = TCP)
(Host = 192.168.0.109)
(Port = 1521)
)
)
(CONNECT_DATA = (SID = ORCL)
)
)
From above settings I am gettin gthe followin gerror at Client side:
TNS-12505: TNS:listener could not resolve SID given in connect descriptor
kindly suggest any solution, I will be very thankful .
update TNSNAMES.ora # client with following code
DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.109)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = data)
)
)

Resources