chk.buddi
chk.buddi

Reputation: 603

How export objects to the given location in Liquibase

I have already installed Liquibase Version: 4.21.1 and SQLcl Version: 23.1.0.089.0929 and set the 'Path' in environmental variables like

C:\Program Files\liquibase 
D:\sqlcl\bin 

Also, it allows me to export objects like

Microsoft Windows [Version 10.0.19045.2965]
(c) Microsoft Corporation. All rights reserved.

D:\sqlcl\bin>sql username/Password@localhost:1521/xe


    SQLcl: Release 23.1 Production on Thu May 18 12:35:52 2023
    
    Copyright (c) 1982, 2023, Oracle.  All rights reserved.
    
    Last Successful login time: Thu May 18 2023 12:35:53 +09:30
    
    Connected to:
    Oracle Database 21c Express Edition Release 21.0.0.0.0 - Production
    Version 21.3.0.0.0
    
    SQL>
    SQL> lb generate-apex-object  -applicationid 100 -split

However, I need to export objects into given folder path instead of 'D:\sqlcl\bin' folder. Can anybody help me how to achieve this?

Upvotes: 2

Views: 247

Answers (1)

thatjeffsmith
thatjeffsmith

Reputation: 22412

SQLcl writes the changeLog and it's changeSets to whatever the current working directory is.

The 'pwd' command will show what your working directory is, for both reading and writing files.

SQL> pwd
c:\sqlcl\23.1\sqlcl\bin\
SQL>

Obviously, you don't want to write your source code/project work to the application bin directory, so what you'll do instead is use the CD command.

SQL> pwd
c:\sqlcl\23.1\sqlcl\bin\
SQL> cd c:\users\jdsmith\desktop
SQL> lb generate-object -object-name regions -object-type table
--Starting Liquibase at 08:47:17 (version 4.17.0 #0 built at 2022-11-02 21:48+0000)

Changelog created and written out to file regions_table.xml

Operation completed successfully.

SQL> !dir *.xml
 Volume in drive C is System
 Volume Serial Number is F897-6A6F

 Directory of C:\Users\JDSMITH\Desktop

05/19/2023  08:47 AM             3,718 regions_table.xml
               2 File(s)          5,522 bytes
               0 Dir(s)  91,137,302,528 bytes free

SQL>

This applies for doing things like using the LOAD and SPOOL commands. And of course, you can put this into your scripts so it's always going to use the files/directories you want it to.

Upvotes: 0

Related Questions