0

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

测试.sql

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

控制器.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> 

主.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 updatesqlcl只是创建名称末尾带有时间戳的文件,但该文件为空。

4

1 回答 1

1

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

于 2021-07-22T14:22:06.417 回答