Xml 对Oracle数据库运行Liquibase GenerateChangeLog命令会导致在特定点之后日志文件/控制台中没有输出的空闲
我正试图根据现有的Oracle数据库创建新的LiqbaseXml 对Oracle数据库运行Liquibase GenerateChangeLog命令会导致在特定点之后日志文件/控制台中没有输出的空闲,xml,oracle,command-line-interface,liquibase,ojdbc,Xml,Oracle,Command Line Interface,Liquibase,Ojdbc,我正试图根据现有的Oracle数据库创建新的LiqbaseDatabaseChangeLog.xml文件,该数据库具有特定的模式来获取数据库结构。目标是用变更集格式替换现有的sql脚本,并使Liquibase迁移在PostgreSQL和Oracle数据库上都能工作 我已将我的liquibase.properties文件指定为: changeLogFile: DatabaseChangelog.xml schemas: schema1,schema2,schema3 driver: oracle.
DatabaseChangeLog.xml
文件,该数据库具有特定的模式来获取数据库结构。目标是用变更集格式替换现有的sql脚本,并使Liquibase迁移在PostgreSQL和Oracle数据库上都能工作
我已将我的liquibase.properties
文件指定为:
changeLogFile: DatabaseChangelog.xml
schemas: schema1,schema2,schema3
driver: oracle.jdbc.OracleDriver
classpath: ojdbc8.jar
url: jdbc:oracle:thin:@host:port:SID
username: User
password: PASSWORD
logLevel: debug
logFile: log.txt
在cli中执行liquibase generateChangeLog
时,我会得到以下输出:
Liquibase Community 4.0.0 by Datical
Starting Liquibase at 12:44:52 (version 4.0.0 #19 built at 2020-07-13 19:45+0000)
一段时间后,它会输出一个错误:
Unexpected error running Liquibase: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: Connection could not be created to jdbc:oracle:thin:@host:port:SID with driver oracle.jdbc.OracleDriver. Possibly the wrong driver for the given database URL
For more information, please use the --logLevel flag
log.txt的输出不包含任何错误消息,并且liquibase似乎与数据库连接良好,但日志意外结束。
这是一根圆木:
[2020-09-14 12:44:52] FINE [liquibase.database] Properties:
[2020-09-14 12:44:52] FINE [liquibase.database] Key:'password' Value:'**********'
[2020-09-14 12:44:52] FINE [liquibase.database] Key:'user' Value:'USER'
[2020-09-14 12:44:52] FINE [liquibase.database] Connecting to the URL:'jdbc:oracle:thin:@host:port:SID' using driver:'oracle.jdbc.OracleDriver'
[2020-09-14 12:44:52] FINE [liquibase.servicelocator] Loaded liquibase.database.DatabaseConnection instance liquibase.database.jvm.JdbcConnection
[2020-09-14 12:44:52] FINE [liquibase.servicelocator] Loaded liquibase.database.DatabaseConnection instance com.datical.liquibase.ext.database.jvm.ProJdbcConnection
[2020-09-14 12:44:59] FINE [liquibase.database] Connection has been created
[2020-09-14 12:45:00] FINE [liquibase.database] Connected to USER@jdbc:oracle:thin:@host:port:SID
[2020-09-14 12:45:00] FINE [liquibase.database] Setting auto commit to false from true
...
[2020-09-14 12:45:40] FINE [liquibase.executor] Executing with the 'jdbc' executor
最后一行是日志文件中的最后一行
Liquibase版本是社区4.0.0,oracle驱动程序是ojdbc8.jar
我的ojdbc8.jar
目录与liquibase.properties
目录相同
DB和用户凭据是正确的,我可以使用DBForge连接到数据库(在tnsnames.ora
格式中使用相同的地址和用户凭据)
是否有人在尝试从现有oracle数据库创建新的数据库changelog.xml
时遇到过同样的问题?我很乐意看到任何建议
提前谢谢
已编辑:
实际上,它在工作1小时后给了我一个输出:
Unexpected error running Liquibase: liquibase.exception.DatabaseException: java.sql.SQLRecoverableException: No data to read from socket
For more information, please use the --logLevel flag
但是模式中有数据/表。您可以使用命令行工具从现有模式生成变更日志。 使用下面的命令并注意额外的空格,因为liquibase会对此抱怨 确保复制从以下提到的位置下载的liquibase zip的lib文件夹中的
ojdbc8-19.3.0.0.jar
。
我已经从这里下载了liquibase.zip,并使用了以下命令
或
您可以使用相同的方法。我已经在liquibase.properties文件中替换了类似的属性,并且工作正常。请注意,两者之间没有空格
键=值
对于SID,请按如下方式替换URL
url=jdbc:oracle:thin:@localhost:1521:sid
谢谢你的回答!我已经用你提到的方法替换了属性,没有空格和“=”符号,但是我仍然得到了相同的结果。在url中的SID前面使用斜杠而不是分号也不会影响generateChangeLog命令的行为。我也尝试过使用ojdbc.jar的其他版本,但没有成功。您是否也遇到同样的错误?您是否可以尝试为一个架构生成变更日志并查看。您是否尝试了第一种方法?
changeLogFile=DatabaseChangelog.xml
schemas=TEST
driver=oracle.jdbc.OracleDriver
url=jdbc:oracle:thin:@localhost:1521/service_name
username=TEST_A
password=password
logLevel=debug
logFile=log.txt
url=jdbc:oracle:thin:@localhost:1521:sid