How I can connect to Pluggable Database Directly?
I'm trying this.
sqlplus scott/tiger#pdborcl;
But I'm getting ORA-12154: TNS:could not resolve the connect identifier specified
After that I tried to add localhost.
sqlplus scott/tiger#localhost/pdborcl;
Then I got
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
But when I connected as System, then I can easily connect using.
sqlplus scott/tiger#pdborcl;
Please help me I really want to get rid of System login again and again.
#TNSNAMES.ora File
# tnsnames.ora Network Configuration File: C:\app\OracleHome\product\12.1.0\dbhome_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
LISTENER_ORCL =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
PDBORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = pdborcl)
)
)
SQLNET
# sqlnet.ora Network Configuration File: C:\app\OracleHome\product\12.1.0\dbhome_1\network\admin\sqlnet.ora
# Generated by Oracle configuration tools.
# This file is actually generated by netca. But if customers choose to
# install "Software Only", this file wont exist and without the native
# authentication, they will not be able to connect to the database on NT.
SQLNET.AUTHENTICATION_SERVICES= (NTS)
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
tnsping pdborcl
You basically need a couple of items to be in place before a direct connection to a pluggable database can be established.
Ensure the pluggable database is started and open, there is a tnsnames.ora entry for the pdb, confirm the listener has picked up the tnsnames entry for the pdb after you added it, reload the listener configuration if already running.
If you have issues connecting to the pdb using different users, check for permission differences between them.
Related
Dear stackoverflow community,
I know this question was already asked, but I tried to find a solution and unfortunately I'm blocked since 3 days now.
I installed Oracle 12c in Linux centos 7 server. When I try to access to the Oracle DB with SQL developer I have the following error:
Listener refused the connection with following error: ORA-12514, TNS:listener does not currently know of service requested in connect descriptor
What I do not understand is that if I restart the database I can connect. But Once I disconnect a try a reconnect I got the same error. Here is my listener.ora file
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ns3008269.ip-151-80-45.eu)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
And my tnsnames.ora is :
rspdata =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ns3008269.ip-151-80-45.eu)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = rspdata)
)
)
oraclepdb =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ns3008269.ip-151-80-45.eu)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = oraclepdb)
)
)
And finally you can fin in attachment a screenshot of my Installation configuration.
I tried lot of and lot of thing... but still blocked.
Hello Stackoverflow community,
I was able to solve this issue. I re-installed Oracle 12c in Linux server and I used the tools netmgr and catmgr in order to configure the listener for the global DBname and also configure the services for PDB. This will automatically will modified the listener.ora and tnsnames.ora.
So my conclusion is that when installing Oracle12c do not modify by hand the listener.ora and tnsnames.ora.
Thank you all for your help and for the tips.
I tried to connect to an AWS RDS that I created. I used SQL Developer to add the connection. I used the default SYSTEM user of Oracle. I have configured my tnsnames and listener files by adding the following entries.
LISTENER
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1522))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1522))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = final.c3ixwyhkuph6.ap-south-1.rds.amazonaws.com)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1522))
)
)
TNSNAMES
FINAL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 'final.c3ixwyhkuph6.ap-south-1.rds.amazonaws.com')(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = final)
)
)
LISTENER_FINAL =
(ADDRESS = (PROTOCOL = TCP)(HOST = final.c3ixwyhkuph6.ap-south-1.rds.amazonaws.com)(PORT = 1521))
As you can see from this screenshot
AWS RDS Description Screenshot
the hostname is 'final.c3ixwyhkuph6.ap-south-1.rds.amazonaws.com', and the port number is 1521. Also, the SID here is 'final'. These have been added correctly by my above TNSNAMES and LISTENER entries.
However when I attempt to connect, I get the following
Error on SQL Developer
Status Failure -Test failed: IO Error: The Network Adapter could not establish the connection.
What could be the source of the error?
Make sure that your SID in SQL Developer is your database name on AWS and that you are using the correct username. In your screenshot, you have it as SYSTEM but the default username on AWS is admin. Go to the Configuration page in AWS and verify the highlighted portions in the screenshot below:
Assuming your DB Name in your Configuration page above is indeed "final", you should be selecting the SID option instead of Service name in SQL Developer, and inputting "final" as demonstrated in the snippet below.
I am to trying connect to a database using TNS, and I am able to connect successfully using an alias:
sqlplus user/password#UHKGLXXX
However, when I connect to same database using the service name, I get the below error:
sqlplus user/password#pl0676o.hk.bbc:2006/UHKGLXXX.hk.bbc
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
Can someone please help me out with this.
Below is the TNSNAMES entry :
UHKGLXXX =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = pl0676o.hk.bbc)(PORT = 2006))
)
(CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = UHKGLXXX.hk.bbc)
)
)
LISTENER_UHKGLXXX = (ADDRESS = (PROTOCOL = TCP)(HOST = pl0676o.hk.bbc)(PORT = 2006))
Have a look at your sqlnet.ora file.
Maybe it contains:
NAMES.DIRECTORY_PATH = (TNSNAMES)
This only allows for TNSNAMES alias use.
Change this to:
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
I have an Oracle 12.2.01 installed on Windows 2008 server. Whenever I try to connect a batch file using sqlplus sys/password#master as sysdba #E:/script.sql I get
ORA-12545:Connect failed because target host or object does not exist.
I can ping, tnsping and connect through sqlplus using the exact same syntax.
If I remove the "#master" the script will work. I need to figure out why because some of our scripts will need to use "#master" at customer locations.
Listener file:
# listener.ora Network Configuration File: C:\oracle\product\12.2.0\dbhome_1\NETWORK\ADMIN\listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = MASTER)
(ORACLE_HOME = C:\oracle\product\12.2.0\dbhome_1)
(SID_NAME = MASTER)
)
)
LISTENER =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = WIN-VFT0F2BL0T6)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.82)(PORT = 1521))
)
)
> ADR_BASE_LISTENER = C:\oracle\product\12.2.0\dbhome_1\log
SQLNET file:
# sqlnet.ora Network Configuration File: c:\oracle\product\12.2.0\dbhome_1\network\admin\sqlnet.ora
# Generated by Oracle configuration tools.
# This file is actually generated by netca. But if customers choose to
# install "Software Only", this file wont exist and without the native
# authentication, they will not be able to connect to the database on NT.
# SQLNET.AUTHENTICATION_SERVICES= (NONE)
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
SQLNET.ALLOWED_LOGON_VERSION_SERVER=8
tnsnames file:
# tnsnames.ora Network Configuration File: C:\oracle\product\12.2.0\dbhome_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
MASTER =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.82)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = MASTER)
)
)
I've installed Oracle 12c (desktop class) on my machine, and I can use it via sql developer on the same machine. Now how can I use the same database from another machine (for java application) in the LAN? I tried using the jdbc thin driver as follows: jdbc:oracle:thin:#10.0.11.69:1521:orcl where 10.0.11.69 is my ip address where Oracle is installed. Do i need to install any server where oracle is installed(10.0.11.69) to connect to my db from another machine?
I'm trying this from past 3 days and referred to many questions of the same model but none solved my issue.
My tnsnames.ora description is as follows:
LISTENER_ORCL =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
Thanks in advance.
You need to connect to PDB if it is a Oracle 12c installation. You can add the following entry in tnsnames.ora:
pdborcl =
(DESCRIPTION =
(ADDRESS = (PROTOCOL=TCP)(HOST=localhost)(PORT=1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = pdborcl)
)
)
After setting this, the listener needs to be restarted.
lsnrctl stop
lsnrctl start
Then the connect string will be something like this:
jdbc:oracle:thin:#//10.0.11.69:1521/pdborcl
Note the connect string above uses service name instead of SID, because in 12C we need to use service name instead of SID to connect to PDB. Check this post for more details.
Java application will not use tnsnames.ora by it's own. You have to call:
System.setProperty("oracle.net.tns_admin", "..path to tnsnames.ora");
To tell the driver where to search for it.
Also note, that some tnsnames.ora constructs are not supported by thin driver. For examples the "include" directive.
Thanks for the following link, Configuring the connection between client and server Oracle 10g
after researching for a long time I found that I need to add my LAN address(10.0.11.69) in the listener.ora file which solves my problem.
so my listener.ora will looks like this now:
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST=
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.0.11.69)(PORT = 1521))
)
)
)