Java - How to use different tablespaces for tables and indexes with liquibase in Java
I'm using liquibase (3.6.3) in Spring Boot (2.1.8) java (1.8) application for managing database (Oracle 12.2) schema changes. My liquibase changesets does not contain 'tablespace' params and all data (including indexes) is creating in default tablespace 'USERS'. Now I need to relocate all existing indexes to another tablespace 'INDX' and create all future indexes not in default 'USERS' tablespace, but in new 'INDX' tablespace.
So, my questions:
How can I migrate old indexes from 'USERS' tablespace to 'INDX' tablespace?
How can I create new indexes in 'INDX' tablespace? I know 'primaryKeyTablespace' param for column/constraint element and 'tablespace' param for createIndex element, is there any other solutions? Possibly I can specify 'INDX' tablespace for all indexes centralized?
There are 2 suggested solutions here and each one has been listed below with a detailed description. The following topics have been covered briefly such as Java, Indexing, Oracle, Liquibase, Tablespace. These have been categorized in sections for a clear and precise explanation.