我想在安装 liquibase 和 sqlcli 后执行“lb generate-schema -split”,但是当我点击上面的命令时,它没有连接到可插拔数据库 (xepdb1)。它总是尝试连接到“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
它不连接到可插拔数据库(xepdb1)。它总是尝试连接到“xe”或“orcl”服务名称
正如它所说,曾经是真的,现在不再是真的了。这取决于您如何命名数据库(或留给 Oracle 来决定),而在 newer 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