无法连接到PDB,Oracle 19C Linux RH7.7 ORA-01034,ORA-27101

问题描述

所以我在Oracle上挣扎了将近2天,于是我放弃了。我相信我已经检查了Google叔叔可用的所有解决方案。

总结我的问题:

  1. 我已经在Linux RH 7.7上部署了Oracle 19C。 SID = orcl,PDBS = orclpdb和PDB
  2. 我可以从主机和远程计算机连接到Oracle实例
  3. 我可以更改会话集容器= PDB;更改可插入数据库PDB的状态;

但是当我尝试通过以下方式登录到pdb时

-sqlplus(localhost)-oracle / product / 19 / dbhome / bin / sqlplus system / password @ pdb

-Impdp(localhost)

-sqldeveloper(远程)

enter image description here

我收到一个错误

ERROR:ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux-x86_64 Error: 2: No such file or directory
Additional information: 4376
Additional information: -1774770425
Process ID: 0
Session ID: 0 Serial number: 0

我的环境如下:

show pdbs;
    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
     2 PDB$SEED                       READ ONLY  NO        
     3 ORCLPDB                        MOUNTED              
     4 PDB                            READ WRITE NO     

$ echo $ORACLE_HOME
/oracle/product/19/dbhome
$ echo $ORACLE_SID
orcl

侦听器:

cat /oracle/product/19/dbhome/network/admin/listener.ora
# listener.ora Network Configuration File: /oracle/product/19/dbhome/network/admin/listener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
  (GLOBAL_dbnAME = orcl)
  (ORACLE_HOME = /oracle/product/19/dbhome)
  (SID_NAME = orcl)
)
(SID_DESC =
  (GLOBAL_dbnAME = orclpdb)
  (ORACLE_HOME = /oracle/product/19/dbhome)
  (SID_NAME = orclpdb)
)
(SID_DESC =
  (GLOBAL_dbnAME = pdb)
  (ORACLE_HOME = /oracle/product/19/dbhome)
  (SID_NAME = pdb)
)
)

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
  (ADDRESS = (PROTOCOL = TCP)(HOST = 10.103.19.240)(PORT = 1521))
  (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)

昵称:

cat /oracle/product/19/dbhome/network/admin/tnsnames.ora
ORCL=
(description=
(address_list=
 (address = (protocol = TCP)(host = 10.103.19.240)(port = 1521))
 )
(connect_data =
(service_name=orcl)
)
)
PDB=
(description=
(address_list=
 (address = (protocol = TCP)(host = 10.103.19.240)(port = 1521))
 )
(connect_data =
(service_name=pdb)
)
)

基于 https://community.oracle.com/thread/2572501

cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4

收听者状态:

$ /oracle/product/19/dbhome/bin/lsnrctl start
LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 15-SEP-2020 12:11:13

copyright (c) 1991,2019,Oracle.  All rights reserved.

Starting /oracle/product/19/dbhome/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 19.0.0.0.0 - Production
System parameter file is /oracle/product/19/dbhome/network/admin/listener.ora
Log messages written to /oracle/diag/tnslsnr/ies-phipdb-r77/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.103.19.240)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.103.19.240)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                15-SEP-2020 12:11:13
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /oracle/product/19/dbhome/network/admin/listener.ora
Listener Log File         /oracle/diag/tnslsnr/ies-phipdb-r77/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.103.19.240)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "orcl" has 1 instance(s).
  Instance "orcl",status UNKNowN,has 1 handler(s) for this service...
Service "orclpdb" has 1 instance(s).
  Instance "orclpdb",has 1 handler(s) for this service...
Service "pdb" has 1 instance(s).
  Instance "pdb",has 1 handler(s) for this service...
The command completed successfully

有什么想法为什么不起作用?以及如何使其起作用?

问候 皮奥特

解决方法

这是您在listener.ora中的SID_LIST_LISTENER配置

其中具有“ SID”的可插拔列表意味着侦听器将这些名称当作实例提供。这就是为什么您获得“共享领域等”的原因,因为那些实例不存在(因此被启动)。

典型的listener.ora看起来像

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1519))
    )
  )

SID_LIST_LISTENER19 =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = CLRExtProc)
      (ORACLE_HOME = C:\oracle\product\19)
      (PROGRAM = extproc)
      (ENVS = "EXTPROC_DLLS=ONLY:C:\oracle\product\19\bin\oraclr19.dll")
    )
  )

在这里您可以看到条目仅用于支持主机/端口和外部程序。每个可插拔都将愉快地向侦听器注册,然后将其提供为 services

,

在我的Vagrant / Virtualbox环境中:

重命名listener.ora(使用默认设置)

[oracle@localhost ~]$ mv /u01/app/oracle/product/19.0.0/grid/network/admin/listener.ora /u01/app/oracle/product/19.0.0/grid/network/admin/listener.ora.1

重新启动监听器

[oracle@localhost ~]$ lsnrctl stop; lsnrctl start; lsnrctl status

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 16-SEP-2020 11:10:41

Copyright (c) 1991,2019,Oracle.  All rights reserved.

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
The command completed successfully

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 16-SEP-2020 11:10:41

Copyright (c) 1991,Oracle.  All rights reserved.

Starting /u01/app/oracle/product/19.0.0/dbhome_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Log messages written to /u01/app/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                16-SEP-2020 11:10:41
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /u01/app/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))
The listener supports no services
The command completed successfully

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 16-SEP-2020 11:10:41

Copyright (c) 1991,Oracle.  All rights reserved.

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                16-SEP-2020 11:10:41
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /u01/app/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))
The listener supports no services
The command completed successfully

还没有通过侦听器公开的服务!

# A database background process is responsible for registration every 30 sec,# but we can force service registration
[oracle@localhost ~]$ echo 'alter system register;' | sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Wed Sep 16 11:11:41 2020
Version 19.3.0.0.0

Copyright (c) 1982,Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL>
System altered.

SQL> Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

哦,是的!服务在那里

[oracle@localhost ~]$ lsnrctl status

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 16-SEP-2020 11:12:12

Copyright (c) 1991,Oracle.  All rights reserved.

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                16-SEP-2020 11:10:41
Uptime                    0 days 0 hr. 1 min. 30 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /u01/app/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM",status READY,has 1 handler(s) for this service...
Service "+ASM_DATA" has 1 instance(s).
  Instance "+ASM",has 1 handler(s) for this service...
Service "86b637b62fdf7a65e053f706e80a27ca.oradb3.private" has 1 instance(s).
  Instance "orcl",has 1 handler(s) for this service...
Service "af547de90c477ffee055000000000001.oradb3.private" has 1 instance(s).
  Instance "orcl",has 1 handler(s) for this service...
Service "orcl.oradb3.private" has 1 instance(s).
  Instance "orcl",has 1 handler(s) for this service...
Service "orclXDB.oradb3.private" has 1 instance(s).
  Instance "orcl",has 1 handler(s) for this service...
Service "pdb1.oradb3.private" has 1 instance(s).
  Instance "orcl",has 1 handler(s) for this service...
The command completed successfully

我的CDB被命名为:orcl.oradb3.private

# now,let's connect!
[oracle@localhost ~]$ sqlplus system/Welcome1@localhost:1521/orcl.oradb3.private

SQL*Plus: Release 19.0.0.0.0 - Production on Wed Sep 16 11:21:05 2020
Version 19.3.0.0.0

Copyright (c) 1982,Oracle.  All rights reserved.

Last Successful login time: Wed Sep 16 2020 11:20:48 +02:00

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> col name for a30
SQL> r
  1* select con_id,name from v$pdbs

    CON_ID NAME
---------- ------------------------------
         2 PDB$SEED
         3 PDB1

我的PDB命名为:pdb1.oradb3.private

# now,let's connect!
[oracle@localhost ~]$ sqlplus system/Welcome1@localhost:1521/pdb1.oradb3.private

SQL*Plus: Release 19.0.0.0.0 - Production on Wed Sep 16 11:24:46 2020
Version 19.3.0.0.0

Copyright (c) 1982,Oracle.  All rights reserved.

Last Successful login time: Wed Sep 16 2020 11:21:05 +02:00

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0


SQL> sho con_id

CON_ID
------------------------------
3
SQL>

确保可以使用EZConnect进行连接,然后更改tnsnames.ora以反映您公开的服务。

祝你好运!

,

感谢您的重播以及花费的时间。

通过在Listener.ora和tnsnames.ora中的PDB名称中添加FQDN后缀来解决。

也要进行远程连接,我也需要添加此后缀。

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...