Cannot connect to oracle pluggable database - oracle

Iinstalled oracle in my Windows 10 64 bit pc and I started doing verification steps mentioned in the tutorial which's given in the oracle website which can be found in the link below.
http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/12c/r1/Windows_DB_Install_OBE/Installing_Oracle_Db12c_Windows.html
When I try to connect to my pluggable database using this command
C:\Users\Chathura>sqlplus sys/Oracle_1#orclpdb as sysdba;
it gives me following message
SQL*Plus: Release 12.2.0.1.0 Production on Tue Jan 30 19:34:25 2018
Copyright (c) 1982, 2016, Oracle. All rights reserved.
ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified
Enter user-name:
But when I try to connect to container database it connects successfully.
This is how I created pluggable database.
I read articles regarding this tried adding TNS_ADMIN system variable too, but non of those worked.
What I am doing wrong here?

You have to use the service name for your pluggable, you can't use the SID..that's only going to work for the container.
So find out the service name
[oracle#vbgeneric ~]$ lsnrctl status
LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 30-JAN-2018 10:05:02
Copyright (c) 1991, 2016, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.2.0.1.0 - Production
Start Date 25-JAN-2018 12:14:50
Uptime 4 days 21 hr. 50 min. 12 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Default Service orcl12c
Listener Parameter File /u01/app/oracle/product/12.2/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/vbgeneric/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=vbgeneric)(PORT=8081))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "49b6c41a4c152576e0530100007feda7" has 1 instance(s).
Instance "orcl12c", status READY, has 1 handler(s) for this service...
Service "4bb765ec28ff1109e0530100007f49e5" has 1 instance(s).
Instance "orcl12c", status READY, has 1 handler(s) for this service...
Service "app_con" has 1 instance(s).
Instance "orcl12c", status READY, has 1 handler(s) for this service...
Service "orcl" has 1 instance(s).
Instance "orcl12c", status READY, has 1 handler(s) for this service...
Service "orcl12c" has 2 instance(s).
Instance "orcl12c", status UNKNOWN, has 1 handler(s) for this service...
Instance "orcl12c", status READY, has 1 handler(s) for this service...
Service "orcl12cXDB" has 1 instance(s).
Instance "orcl12c", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle#vbgeneric ~]$
Then connect, use #servicename vs #SID
in my case that's #orcl
Or connect to your container, then switch over to your PDB
oracle#vbgeneric oracle]$ sqlplus sys/oracle#orcl12c as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on Tue Jan 30 10:09:28 2018
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL> ALTER SESSION SET container = orcl;
Session altered.
SQL>
Tim talks about this here.

connect to your database ( pluggable database) and make thing configuration
`
startup mount;
ALTER SYSTEM ENABLE RESTRICTED SESSION;
ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;
ALTER SYSTEM SET AQ_TM_PROCESSES=0;
ALTER DATABASE OPEN;
`
and also that
`
update sys.props$ set VALUE$='WE8MSWIN1252' where NAME='NLS_CHARACTERSET';
commit;
shutdown immediate;
startup;
`
after that just check your tnsnames.ora`enter code here`

WINDOWS 10:
Don't know if this is exactly your problem, but I got one very similar. After creating new users to PDB, I couldn't connect to Database. Here is what I did (don't know if you need all of this, but it worked for me).
Try this options on SQL Dev Connection:
connection
On $ORACLE_HOME/network/admin add:
ORCLPDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = hostname)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orclpdb)
)
)
On network/admin/sqlnet.ora file add:
SQLNET.ALLOWED_LOGON_VERSION_CLIENT = 8
SQLNET.ALLOWED_LOGON_VERSION_SERVER = 8

Related

Can't log into Oracle DB 19c on command line - SQL Developer is fine

I can't log into Oracle 19c DB on the command line. This is the error I get:
PS C:\Windows\system32> sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Fri Nov 19 16:35:55 2021
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
ERROR:
ORA-12560: TNS:protocol adapter error
Enter user-name:
If I check the status of the listener it looks like it's running to me (unless I'm mistaken):
PS C:\Windows\system32> lsnrctl status LISTENER1
LSNRCTL for 64-bit Windows: Version 19.0.0.0.0 - Production on 19-NOV-2021 16:37:29
Copyright (c) 1991, 2019, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=DESKTOP-0T5DL1G)(PORT=1555)))
STATUS of the LISTENER
------------------------
Alias LISTENER1
Version TNSLSNR for 64-bit Windows: Version 19.0.0.0.0 - Production
Start Date 19-NOV-2021 16:07:28
Uptime 0 days 0 hr. 30 min. 10 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File D:\Oracle_1\instantclient\network\admin\listener.ora
Listener Log File D:\Oracle_1\app09\oracle\base\diag\tnslsnr\DESKTOP-0T5DL1G\listener1\alert\log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=DESKTOP-0T5DL1G)(PORT=1555)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1555ipc)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=DESKTOP-0T5DL1G)(PORT=5500))(Security=(my_wallet_directory=D:\ORACLE_1\APP09\ORACLE\BASE\admin\aws\xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "52448234712340b69f274bcc790ecfe0.company.com" has 1 instance(s).
Instance "aws", status READY, has 2 handler(s) for this service...
Service "5f0fbe5bc87148669145f9e2458c91b2.company.com" has 1 instance(s).
Instance "aws", status READY, has 2 handler(s) for this service...
Service "CLRExtProc" has 1 instance(s).
Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "aws.company.com" has 1 instance(s).
Instance "aws", status READY, has 2 handler(s) for this service...
Service "pdb1.company.com" has 1 instance(s).
Instance "aws", status READY, has 2 handler(s) for this service...
The command completed successfully
Yet, I can log in with SQL Developer and run queries:
If I try to start the service it says that it's already been started:
PS C:\Users\bluet> net start OracleServiceAWS
The requested service has already been started.
More help is available by typing NET HELPMSG 2182.
I'm really curious as to why I can't log in on the command line and in Oracle SQL developer it's fine! I'd like to correct this so I can log in again on the command line.
Looks like you have to specify the container you're connecting to. For example:
sqlplus sys/its_password#pdb as sysdba
----
this is your pluggable database

How to connect to oracle from SQL Developer

I have problem with connecting to Oracle from Sql developer. When I try this connection settings. it returns error from printscreen:
when I tried tns ping, it returns to me
C:\Windows\system32>tnsping XE
TNS Ping Utility for 64-bit Windows: Version 18.0.0.0.0 - Production on 09-APR-2021 23:47:25
Copyright (c) 1997, 2018, Oracle. All rights reserved.
Used parameter files:
C:\app\Uzivatel\product\18.0.0\dbhomeXE\network\admin\sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = XE)))
OK (0 msec)
Can someone give me a point what I doing wrong? Thanks for help.
l
snrctl status is C:\Windows\system32> lsnrctl status
LSNRCTL for 64-bit Windows: Version 18.0.0.0.0 - Production on 09-APR-2021 23:57:42
Copyright (c) 1991, 2018, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for 64-bit Windows: Version 18.0.0.0.0 - Production
Start Date 09-APR-2021 23:09:50
Uptime 0 days 0 hr. 47 min. 52 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Default Service XE
Listener Parameter File C:\app\Uzivatel\product\18.0.0\dbhomeXE\network\admin\listener.ora
Listener Log File C:\app\Uzivatel\product\18.0.0\diag\tnslsnr\PoŔÝtaŔ\listener\alert\log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1521ipc)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))
Services Summary...
Service "CLRExtProc" has 1 instance(s).
Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
When I tryed to change to Sid, it returns me:
when I try to
C:\Windows\system32>lsnrctl reload
LSNRCTL for 64-bit Windows: Version 18.0.0.0.0 - Production on 10-APR-2021 00:10:54
Copyright (c) 1991, 2018, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
64-bit Windows Error: 2: No such file or directory
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))
The command completed successfully
But problem is still same:
I tried lsnrctl status and It return to me
C:\Users\Uzivatel>lsnrctl status
LSNRCTL for 64-bit Windows: Version 18.0.0.0.0 - Production on 10-APR-2021 02:01:20
Copyright (c) 1991, 2018, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for 64-bit Windows: Version 18.0.0.0.0 - Production
Start Date 10-APR-2021 00:44:34
Uptime 0 days 1 hr. 16 min. 45 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Default Service XE
Listener Parameter File C:\app\Uzivatel\product\18.0.0\dbhomeXE\network\admin\listener.ora
Listener Log File C:\app\Uzivatel\product\18.0.0\diag\tnslsnr\PoŔÝtaŔ\listener\alert\log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=PoŔÝtaŔ)(PORT=1521)))
Services Summary...
Service "ORCL" has 1 instance(s).
Instance "xe", status BLOCKED, has 1 handler(s) for this service...
Service "XE" has 1 instance(s).
Instance "XE", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
it seems that there is some problem, isnt it?
UPDATE
I wrongly supposed your Database was running.
Start your database by issuing a startup
CMD> sqlplus /as sysdba
SQL> startup
Before attempting to connect, check your listener with lsnrctl status you should now see the XE service there.
If everything's in place, you should then be able to connect.
As far as I can see, there's no service named XE
You can either connect by selecting SID instead of SERVICE NAME
Or try to add a static registration to your listener.ora
LISTENER =
(DESCRIPTION_LIST =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
  )
)
SID_LIST_LISTENER=
(SID_LIST =
   (SID_DESC=
     (SID_NAME=XE)
     (SERVICE_NAME=XE)
     (ORACLE_HOME=C:\app\Uzivatel\product\18.0.0\dbhomeXE)
   )
)
Reload the listener
lsnrctl reload
And then try to connect via SQL Developer, using the SERVICE NAME
Another thing you can try, is getting inside the Database and issue a
alter system register;
To see if the database register against the listener by itself.
Are you sure that "XE" is your services name??
Try selecting SID and set a name to the connection

Oracle Database service running but cannot connect

I am having the following trouble. I have created three different database schemas in my laptop, each has a different service.
I activate and deactivate the service that I want to use each time. But I have been facing a problem after I created the third schema.
Task Manager - Services
When I activate the OracleServiceIANBG I am able to connect properly through SQL developer in that instance. When I deactivate it and activate one of the other two instances, the corresponding connections in the SQL developer that I have created are giving me the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
SQL Developer snapshot
Can someone explain why this is happening and how I can troubleshoot it?
On your cmd line check lsnrctl and see what services are running.
>lsnrctl status
LSNRCTL for Linux: Version 18.0.0.0.0 - Production on 13-NOV-2018 14:15:59
Copyright (c) 1991, 2018, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 18.0.0.0.0 - Production
Start Date 13-NOV-2018 14:15:36
Uptime 0 days 0 hr. 0 min. 23 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /opt/oracle/product/18c/dbhome_1/network/admin/listener.ora
Listener Log File /opt/oracle/diag/tnslsnr/c132613c345e/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))
Services Summary...
Service "64a52f53a7683286e053cda9e80aed76" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "758e766d38d80b9de053020011acb4c6" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orcl" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "xe" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully
If the expected services are not listed, they can be registered with an alter system register command.
sqlplus / as sysdba
SQL*Plus: Release 18.0.0.0.0 - Production on Tue Nov 13 14:17:28 2018
Version 18.3.0.0.0
Copyright (c) 1982, 2018, Oracle. All rights reserved.
Connected to:
Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production
Version 18.3.0.0.0
SQL> alter system register;
System altered.
SQL>
just enter the ./sqlplus command.
it should prompt for username:
username: "sys as sysdba" use this entire phrase
password: {password during installation}
then it should connect
but if you want to connect to the instance: like oraclxdba
you should use an external SQL management tool right? then you can just specify the SID you want to connect to with the same username and password

how to create TNS connection with SID "orcl" in apex listener

I almost finished to install the experimental Oracle Apex Listener. But during final installing step i got a problem: TNS name with SID with name "orcl" does not exist and it wasn't in the file "tnsnames.ora" among the others TNS names.
For beginning i tried to input SID characteristics for name "orcl" in the "tnsnames.ora" over notepad++ manually , but it's not helped (link to picture is below):
ORA-12505
2. Later i tried to input the data for SID "orcl" and open access to this over command prompt:
C:\oraclexe\app\oracle\product\11.2.0\server\apex>sqlplus sys as sysdba
Enter password:
Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production
SQL> alter system set local_listener = '(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)
PORT=1521))' scope = both;
System altered.
SQL> alter system register;
System altered.
C:\oraclexe\app\oracle\product\11.2.0\server\apex>lsnrctl stat
LSNRCTL for 64-bit Windows: Version 11.2.0.2.0 - Production on 29-JUN-2016 21:28
:13
Copyright (c) 1991, 2014, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for 64-bit Windows: Version 11.2.0.2.0 - Produ
ction
Start Date 29-JUN-2016 20:37:36
Uptime 0 days 0 hr. 50 min. 37 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Default Service XE
Listener Parameter File C:\oraclexe\app\oracle\product\11.2.0\server\network\a
dmin\listener.ora
Listener Log File C:\oraclexe\app\oracle\diag\tnslsnr\MrPloomipuu\listen
er\alert\log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1ipc)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=MrPloomipuu)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=MrPloomipuu)(PORT=8025))(Presentatio
n=HTTP)(Session=RAW))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
Services Summary...
Service "CLRExtProc" has 1 instance(s).
Instance "CLRExtProc", 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...
Service "XEXDB" has 1 instance(s).
Instance "xe", status READY, has 1 handler(s) for this service...
Service "xe" has 1 instance(s).
Instance "xe", status READY, has 1 handler(s) for this service...
The command completed successfully
And all the same can't create SID with name 'orcl' and install TNS connecton with apex listener over that SID. What me to do here ?

ORA-12514 TNS:listener does not currently know of service requested in connect descriptor for existing service

I know that this is a pretty popular problem, and I had run into it several times before but were able to resolve it but not this time.
I had made sure that I'm using the correct service name by running
SQL> select value from v$parameter where name='service_names';
VALUE
--------------------------------------------------------------------------------
XE
My tnsnames.ora has the XE service name:
XE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
)
)
When I start the listener, it appear to recognize the service:
[root#aa-axm admin]# lsnrctl start
LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 09-OCT-2015 12:58:28
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Starting /u01/app/oracle/product/11.2.0/xe/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.2.0 - Production
System parameter file is /u01/app/oracle/product/11.2.0/xe/network/admin/listener.ora
Log messages written to /u01/app/oracle/product/11.2.0/xe/log/diag/tnslsnr/aa-axm/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC_FOR_XE)) (SERVICE_NAME=XE))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521))(SERVICE_NAME=XE))
Connecting to (DESCRIPTION=(SERVICE_NAME=XE)(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC_FOR_XE)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.2.0 - Production
Start Date 09-OCT-2015 12:58:28
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Default Service XE
Listener Parameter File /u01/app/oracle/product/11.2.0/xe/network/admin/listener.ora
Listener Log File /u01/app/oracle/product/11.2.0/xe/log/diag/tnslsnr/aa-axm/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC_FOR_XE))(SERVICE_NAME=XE))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521))(SERVICE_NAME=XE))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
And yet, I'm still getting that blasted error
[root#aa-axm admin]# sqlplus SYSTEM/**********#XE
SQL*Plus: Release 11.2.0.2.0 Production on Fri Oct 9 12:58:36 2015
Copyright (c) 1982, 2011, Oracle. All rights reserved.
ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
What am I missing? TIA
I had it finally resolved by doing
alter system set local_listener='XE' scope=both;
alter system register;
thanks to Alex Poole for setting me on the right path.

Resources