Pregunta

I just installed Oracle 19c and SQL Developer. I open SQL Developer and try to establish a new connection but I get

"Listener refused the connection with the following error:ORA-12505, TNS:listener does not currently know of SID given in connect descriptor (CONNECTION_ID=HYjeJ...==)".

I am trying to connect with

Username: SYS
Role: SYSDBA
Hostname: localhost
SID: xe (this is the default, I know nothing about it)

I tried to change the SYS user password with "ALTER USER SYS IDENTIFIED BY oracle ACCOUNT UNLOCK;" as recommended here. I am only able to login to SQL Plus using SYS as SYSDBA and no password. I have tried to create a user and setup their profile to allow logging in but get errors doing that.

Edit:

lsnrctl status

LSNRCTL for 64-bit Windows: Version 19.0.0.0.0 - Production on 08-MAR-2021 19:39:44

Copyright (c) 1991, 2019, 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 19.0.0.0.0 - Production
Start Date                04-MAR-2021 07:42:09
Uptime                    4 days 11 hr. 57 min. 52 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   C:\Desktop\Drawer\Tutorials\Oracle\WINDOWS.X64_193000_db_home\network\admin\listener.ora
Listener Log File         C:\Desktop\Drawer\Tutorials\Oracle\diag\tnslsnr\AlbuGierke\listener\alert\log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1521ipc)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=AlbuGierke)(PORT=5500))(Security=(my_wallet_directory=C:\DESKTOP\DRAWER\TUTORIALS\ORACLE\admin\orcl\xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "0154b89e82cd4245957cd2ed1b57502d" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "52448234712340b69f274bcc790ecfe0" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "CLRExtProc" has 1 instance(s).
  Instance "CLRExtProc", status UNKNOWN, 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 "orclpdb" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully

Edit II:

Taking @EdStevens solution a step further, I identified the available users by running the command SELECT * FROM all_users ORDER BY CREATED; in SQL Plus. I then used the PDBADMIN user created when I did the installation (there were several users that appear to have been created when 19c was released) to complete the connection.

¿Fue útil?

Solución

Now that we see what your listener knows, we see that you have pluggable database with a service name of 'orclpdb'.

Service "orclpdb" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...

And we know that it is taking tcp connections at 127.0.0.1, on port 1521 (all the default)

Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))

So your SQL Dev properties should be

Connection name - whatever you want that helps identify the specific database

Connection type - basic

host name - 127.0.0.1

port - 1521

service name - orclpdb

I typically do NOT supply username and password as part of the connection properties. If you don't supply it, you will be prompted when you try to connect. And I never connect AS SYSDBA (and thus, never connect as SYS) when using SQL Dev. To connect as user SYS is to go into full-on DBA-working-without-a-net mode. For that I always work at a command line with sqlplus.

I do not know what XE is

XE is a cut-down edition of oracle, intended for light use on desktop environments. It has no licensing cost. It has a limit on total database size. I've never used it, but from what I've seen, it is used more by people who just want to learn SQL, rather than learning to be a DBA. It appears you have installed either Enterprise or Standard edition, which can also be free - IF you downloaded from the correct source and abide by the restrictive licensing agreement to use it only for personal study.

I am not sure if my local instance is multitenant. How can I check that? I do not know if I have created PDB on it. How can I check that?

Well, you installed it. How did you respond to the various inputs you were asked for when you created the database? (BTW, installing the software and createing the database are two distinct operations, though the installation will ask if you want to create a database or perform 'software install only'. If you respond to 'create a database' it will install the software then go straight to Datbase Creation Assistant (aka DBCA). But DBCA is still a separate operation that can be invoked apart from and any time after installation.

To see what you've got:

SQL> col pdb_name for a10
SQL> --
SQL> show user
USER is "SYS"
SQL> select cdb
  2  from v$database;

CDB
---
YES

1 row selected.

SQL> --
SQL> select pdb_id,
  2         pdb_name
  3  from cdb_pdbs;

    PDB_ID PDB_NAME
---------- ----------
         3 PDB01
         2 PDB$SEED

2 rows selected.

SQL> --
SQL> spo off

You really, really need to spend some quality time with the Database Concepts manual.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a dba.stackexchange
scroll top