Using the SQL Plus integration and runWith attribute with Liquibase Pro and Oracle


  • Use Liquibase 3.10 or later.
  • Specify how Liquibase can find SQL Plus by adding SQL Plus to your PATH. Alternatively, pass its location in the liquibase.sqlplus.conf file or from the command prompt during runtime. See liquibase.sqlplus.path in SQL Plus integration arguments.

Note: Liquibase searches the SQL Plus location in the following order: runtime arguments, .conf file values, your PATH.

Using the SQL Plus integration

  1. Add the runWith attribute to the needed changesets in the changelog you use:
    • runWith:sqlplus for an SQL changelog
    • runWith="sqlplus" for an XML changelog
    • "runWith": "sqlplus" for a JSON changelog
    • runWith: sqlplus for a YAML changelog

    Note: See runWith and sqlplus examples.

  1. Specify the SQL Plus integration arguments in one of the following ways:
    • Add the values to liquibase.sqlplus.conf or the Liquibase properties file.

    Note: You can use the liquibase.sqlplus.conf file along with the Liquibase properties file. If you use Liquibase Pro and SQL Plus in automation, set arguments in the liquibase.sqlplus.conf file instead of running them every time at the command prompt.

    • Set the values as environment variables
    • Run the values as Java system properties (JAVA_OPTS) along with any command at the command prompt:
  1. Run a Liquibase command:
  2. Example: liquibase update --changelog-file=sqlplus_script.sql

    Note: If the command fails, you will receive an error message. However, if you add a property that is not used in Liquibase to the liquibase.sqlplus.conf file, no error occurs. Liquibase only ignores it.

SQL Plus integration arguments

Property Environment variable CLI Description
liquibase.sqlplus.args LIQUIBASE_SQLPLUS_ARGS --sqlplus
[Optional] Extra arguments to pass to the sqlplus executable. For more information about SQL Plus arguments, see SQL Plus documentation.

Note: The delimiter for arguments is a space " ". Do not use a comma "," or semicolon ";".

liquibase.sqlplus.keep.temp LIQUIBASE_SQLPLUS_KEEP_TEMP --sqlplus
Flag to indicate whether or not to keep a temporary SQL file after the execution of SQL Plus. If true, the file is not deleted. Default: false. LIQUIBASE_SQLPLUS_KEEP_TEMP_NAME --sqlplus-keep-temp-name [Optional] Flag to indicate the name of a temporary SQL file after the execution of SQL Plus.
liquibase.sqlplus.keep.temp.overwrite LIQUIBASE_SQLPLUS_KEEP_TEMP_OVERWRITE --sqlplus-keep-temp-overwrite Flag to overwrite any files in the specified directory with the same name. Default: true.
liquibase.sqlplus.keep.temp.path LIQUIBASE_SQLPLUS_KEEP_TEMP_PATH --sqlplus-keep-temp-path [Optional] Flag to indicate the location to store a temporary SQL file after the execution of SQL Plus. If not specified, the files are stored in the system's temp directory.
liquibase.sqlplus.path LIQUIBASE_SQLPLUS_PATH --sqlplus-path Path to the sqlplus executable.
liquibase.sqlplus.timeout LIQUIBASE_SQLPLUS_TIMEOUT --sqlplus-timeout

Seconds to wait for the sqlplus timeout:

  • "-1" disables the timeout
  • "0" returns an error
  • 1800 seconds (30 minutes) is the default value

SQL Plus best practices

  • Do not set the endDelimiter or splitStatements=true property on SQL Plus changesets. SQL Plus handles delimiters and statement splitting natively.
  • Prevent hanging queries by configuring the SQL Plus timeout. In your liquibase.sqlplus.config file, add liquibase.sqlplus.timeout=nn, where nn is time in seconds to wait before stopping the process.
  • Save the output of your SQL Plus spool files to your temp directory by adding liquibase.sqlplus.keep.temp=true to the liquibase.sqlplus.config file.

Related links