当使用sqlcl运行时,使liquibase输出假脱机到当前假脱机文件



假设我们有以下一组脚本:

test.sql

create or replace view asdas
as
select 1 val from dual
/

controller.xml

<?xml version="1.0" encoding="UTF-8"?> 
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.9.xsd">
<changeSet author="tim" id="01_tab1_seq" runAlways="true" >
<sqlFile dbms="oracle"
endDelimiter=";"
path="test.sql"
splitStatements="true"
stripComments="false"/>
</changeSet>
</databaseChangeLog> 

main.sql

spool output.log
lb update -changelog controller.xml
spool off
exit

当调用main.sql文件时,我得到以下输出:

roman@UBUNTU-LT:/mnt/c/Users/%USERNAME%/Desktop/preset$ sql testuser/testuser@dev-db1 @main.sql
SQLcl: Release 21.1 Production on Thu Jul 22 16:36:34 2021
Copyright (c) 1982, 2021, Oracle.  All rights reserved.
Last Successful login time: Thu Jul 22 2021 16:36:37 +03:00
Connected to:
Oracle Database 19c Standard Edition 2 Release 19.0.0.0.0 - Production
Version 19.7.0.0.0
SQL> set serveroutput on
SQL> set scan on
SQL> set linesize 4000
SQL> spool output.log
SQL> lb update -changelog controller.xml
ScriptRunner Executing: create or replace view asdas
as
select 1 val from dual
/Liquibase Executed:create or replace view asdas
as
select 1 val from dual
/
######## ERROR SUMMARY ##################
Errors encountered:0
SQL> spool off
SQL> exit
Disconnected from Oracle Database 19c Standard Edition 2 Release 19.0.0.0.0 - Production
Version 19.7.0.0.0

我在output.log:中看到的

SQL> lb update -changelog controller.xml
######## ERROR SUMMARY ##################
Errors encountered:0
SQL> spool off

相反,我希望看到我在屏幕上看到的整个日志输出。我能以某种方式强制sqlcl将其写入我假脱机到的文件吗?

我试图将-log选项添加到lb update中,但sqlcl只是在名称末尾创建了一个类似时间戳的文件,但这个文件是空的。

这将是一个错误。无论您在控制台中看到什么,都应该进入SPOOL文件。我会为你记录错误-感谢测试用例&汇报

最新更新