不连接到oracle可插拔数据库

9cbw7uwe  于 2023-04-29  发布在  Oracle
关注(0)|答案(1)|浏览(130)

我想在安装liquibase和sqlcli后执行“lb generate-schema -split”,但是当我点击上面的命令时,它没有连接到可插拔数据库(xepdb 1)。它总是试图连接到'xe'或'orcl'服务名称。谁能帮我解决这个问题?

D:\Software\sqlcl-latest\sqlcl\bin>sql

SQLcl: Release 23.1 Production on Sat Apr 29 12:27:03 2023

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

Username? (''?) apexuser@**xepdb1**

Password? (**********?) **********

Last Successful login time: Sat Apr 29 2023 12:27:17 +09:30

Connected to:
Oracle Database 21c Express Edition Release 21.0.0.0.0 - Production
Version 21.3.0.0.0

SQL> lb generate-schema -split
--Starting Liquibase at 12:27:24 (version 4.17.0 #0 built at 2022-11-02 21:48+0000)

  USER          = apexuser
  URL           = jdbc:oracle:oci8:@
  Error Message = ORA-12560: TNS:protocol adapter error
  USER          = apexuser
  URL           = jdbc:oracle:thin:@localhost:1521/orcl
  Error Message = Listener refused the connection with the following error:
ORA-12514, TNS:listener does not currently know of service requested in connect descriptor
  (CONNECTION_ID=zW40jSIGS5KejZYrbKvK/A==)
  USER          = apexuser
  URL           = jdbc:oracle:thin:@localhost:1521/xe
  Error Message = ORA-01017: invalid username/password; logon denied
hmmo2u0o

hmmo2u0o1#

不连接可插拔数据库(xepdb 1)。它总是尝试连接到'xe'或'orcl'服务名称
就像它说的,过去是真的,现在不再是真的了。它取决于您如何命名数据库(或由Oracle决定),在 * 较新的 * XE数据库中,它是xepdb1
这是我的XE数据库(我知道它的名字;我只是在展示我的TNSNAMES里的东西。ORA):

c:\temp>tnsping pdb1

TNS Ping Utility for 64-bit Windows: Version 21.0.0.0.0 - Production on 29-APR-2023 06:27:14

Copyright (c) 1997, 2021, Oracle.  All rights reserved.

Used parameter files:
C:\Users\littlefoot\Documents\sqlnet.ora

Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = lf_laptop)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = XEPDB1)))
OK (60 msec)

看到上一行末尾的SERVICE_NAME了吗?

c:\temp>sqlplus scott/tiger@lf_laptop:1521/xepdb1

SQL*Plus: Release 21.0.0.0.0 - Production on Sat Apr 29 06:27:52 2023
Version 21.3.0.0.0

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

Last Successful login time: Fri Apr 14 2023 21:02:45 +02:00

Connected to:
Oracle Database 21c Express Edition Release 21.0.0.0.0 - Production
Version 21.3.0.0.0

SQL>

因此,尝试与Liquibase相同;我不使用它,所以我不能帮助它,但我认为这应该修改:

URL           = jdbc:oracle:thin:@localhost:1521/xepdb1
                                                 ------
                                                 this

相关问题